diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2fb66ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +Carthage +xcuserdata +.idea +build +.DS_Store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9682f33 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "Nem2SdkSwift/core/crypto/RHash"] + path = Nem2SdkSwift/core/crypto/RHash + url = https://github.com/rhash/RHash.git +[submodule "Nem2SdkSwift/core/crypto/ed25519"] + path = Nem2SdkSwift/core/crypto/ed25519 + url = https://github.com/orlp/ed25519.git diff --git a/.jazzy.yaml b/.jazzy.yaml new file mode 100644 index 0000000..7bea908 --- /dev/null +++ b/.jazzy.yaml @@ -0,0 +1,17 @@ +# minimum access control level [private | fileprivate | internal | public | open] +min_acl: public + +# clean output folder before generating +clean: true + +# output folder +output: docs + +# author +author: ProximaX Limited + +# module name +module: Nem2SdkSwift + +# arguments passing to xcodebuild +# xcodebuild_arguments: [-workspace,JazzySample.xcworkspace,-scheme,JazzySample] diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..7ff048f --- /dev/null +++ b/Cartfile @@ -0,0 +1,4 @@ +github "Alamofire/Alamofire" ~> 4.5.0 +github "ReactiveX/RxSwift" ~> 4.0 +github "krzyzanowskim/CryptoSwift" +github "daltoniam/Starscream" >= 3.0.2 diff --git a/Cartfile.resolved b/Cartfile.resolved new file mode 100644 index 0000000..2993231 --- /dev/null +++ b/Cartfile.resolved @@ -0,0 +1,4 @@ +github "Alamofire/Alamofire" "4.7.3" +github "ReactiveX/RxSwift" "4.3.1" +github "daltoniam/Starscream" "3.0.5" +github "krzyzanowskim/CryptoSwift" "0.12.0" diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..fdff7c3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 ProximaX Limited + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Nem2SdkSwift.xcodeproj/project.pbxproj b/Nem2SdkSwift.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1be6cd5 --- /dev/null +++ b/Nem2SdkSwift.xcodeproj/project.pbxproj @@ -0,0 +1,1598 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 5F61FE832159AC0500B8474A /* Nem2SdkSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F61FE792159AC0500B8474A /* Nem2SdkSwift.framework */; }; + 5F61FE882159AC0500B8474A /* Nem2SdkSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FE872159AC0500B8474A /* Nem2SdkSwiftTests.swift */; }; + 5F61FE8A2159AC0500B8474A /* Nem2SdkSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 5F61FE7C2159AC0500B8474A /* Nem2SdkSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5F61FED12159AD9E00B8474A /* APIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FE9C2159AD9E00B8474A /* APIHelper.swift */; }; + 5F61FED22159AD9E00B8474A /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FE9D2159AD9E00B8474A /* AlamofireImplementations.swift */; }; + 5F61FED32159AD9E00B8474A /* NetworkRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FE9F2159AD9E00B8474A /* NetworkRoutesAPI.swift */; }; + 5F61FED42159AD9E00B8474A /* TransactionRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA02159AD9E00B8474A /* TransactionRoutesAPI.swift */; }; + 5F61FED52159AD9E00B8474A /* AccountRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA12159AD9E00B8474A /* AccountRoutesAPI.swift */; }; + 5F61FED62159AD9E00B8474A /* BlockchainRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA22159AD9E00B8474A /* BlockchainRoutesAPI.swift */; }; + 5F61FED72159AD9E00B8474A /* MosaicRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA32159AD9E00B8474A /* MosaicRoutesAPI.swift */; }; + 5F61FED82159AD9E00B8474A /* NamespaceRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA42159AD9E00B8474A /* NamespaceRoutesAPI.swift */; }; + 5F61FED92159AD9E00B8474A /* NodeRoutesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA52159AD9E00B8474A /* NodeRoutesAPI.swift */; }; + 5F61FEDA2159AD9E00B8474A /* CodableHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA62159AD9E00B8474A /* CodableHelper.swift */; }; + 5F61FEDB2159AD9E00B8474A /* JSONEncodableEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA72159AD9E00B8474A /* JSONEncodableEncoding.swift */; }; + 5F61FEDC2159AD9E00B8474A /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA82159AD9E00B8474A /* APIs.swift */; }; + 5F61FEDD2159AD9E00B8474A /* AnyObjectDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEA92159AD9E00B8474A /* AnyObjectDictionary.swift */; }; + 5F61FEDE2159AD9E00B8474A /* NodeTimeDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEAB2159AD9E00B8474A /* NodeTimeDTO.swift */; }; + 5F61FEDF2159AD9E00B8474A /* NamespaceNameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEAC2159AD9E00B8474A /* NamespaceNameDTO.swift */; }; + 5F61FEE02159AD9E00B8474A /* AccountInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEAD2159AD9E00B8474A /* AccountInfoDTO.swift */; }; + 5F61FEE12159AD9E00B8474A /* NamespaceIds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEAE2159AD9E00B8474A /* NamespaceIds.swift */; }; + 5F61FEE22159AD9E00B8474A /* TransactionStatusDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEAF2159AD9E00B8474A /* TransactionStatusDTO.swift */; }; + 5F61FEE32159AD9E00B8474A /* MosaicInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB02159AD9E00B8474A /* MosaicInfoDTO.swift */; }; + 5F61FEE42159AD9E00B8474A /* TransactionPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB12159AD9E00B8474A /* TransactionPayload.swift */; }; + 5F61FEE52159AD9E00B8474A /* BlockMetaDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB22159AD9E00B8474A /* BlockMetaDTO.swift */; }; + 5F61FEE62159AD9E00B8474A /* CommunicationTimestamps.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB32159AD9E00B8474A /* CommunicationTimestamps.swift */; }; + 5F61FEE72159AD9E00B8474A /* MosaicDefinitionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB42159AD9E00B8474A /* MosaicDefinitionDTO.swift */; }; + 5F61FEE82159AD9E00B8474A /* TransactionIds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB52159AD9E00B8474A /* TransactionIds.swift */; }; + 5F61FEE92159AD9E00B8474A /* MosaicPropertiesDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB62159AD9E00B8474A /* MosaicPropertiesDTO.swift */; }; + 5F61FEEA2159AD9E00B8474A /* UInt64DTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB72159AD9E00B8474A /* UInt64DTO.swift */; }; + 5F61FEEB2159AD9E00B8474A /* MosaicDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB82159AD9E00B8474A /* MosaicDTO.swift */; }; + 5F61FEEC2159AD9E00B8474A /* Addresses.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEB92159AD9E00B8474A /* Addresses.swift */; }; + 5F61FEED2159AD9E00B8474A /* AnnounceTransactionInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEBA2159AD9E00B8474A /* AnnounceTransactionInfoDTO.swift */; }; + 5F61FEEE2159AD9E00B8474A /* NamespaceInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEBB2159AD9E00B8474A /* NamespaceInfoDTO.swift */; }; + 5F61FEEF2159AD9E00B8474A /* NodeInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEBC2159AD9E00B8474A /* NodeInfoDTO.swift */; }; + 5F61FEF02159AD9E00B8474A /* NetworkTypeDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEBD2159AD9E00B8474A /* NetworkTypeDTO.swift */; }; + 5F61FEF12159AD9E00B8474A /* MultisigAccountInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEBE2159AD9E00B8474A /* MultisigAccountInfoDTO.swift */; }; + 5F61FEF22159AD9E00B8474A /* BlockInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEBF2159AD9E00B8474A /* BlockInfoDTO.swift */; }; + 5F61FEF32159AD9E00B8474A /* MosaicNameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC02159AD9E00B8474A /* MosaicNameDTO.swift */; }; + 5F61FEF42159AD9E00B8474A /* MosaicIds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC12159AD9E00B8474A /* MosaicIds.swift */; }; + 5F61FEF52159AD9E00B8474A /* Multisig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC22159AD9E00B8474A /* Multisig.swift */; }; + 5F61FEF62159AD9E00B8474A /* BlockchainScoreDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC32159AD9E00B8474A /* BlockchainScoreDTO.swift */; }; + 5F61FEF72159AD9E00B8474A /* MultisigAccountGraphInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC42159AD9E00B8474A /* MultisigAccountGraphInfoDTO.swift */; }; + 5F61FEF82159AD9E00B8474A /* BlockchainStorageInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC52159AD9E00B8474A /* BlockchainStorageInfoDTO.swift */; }; + 5F61FEF92159AD9E00B8474A /* NamespaceDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC62159AD9E00B8474A /* NamespaceDTO.swift */; }; + 5F61FEFA2159AD9E00B8474A /* HeightDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC72159AD9E00B8474A /* HeightDTO.swift */; }; + 5F61FEFB2159AD9E00B8474A /* AccountDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC82159AD9E00B8474A /* AccountDTO.swift */; }; + 5F61FEFC2159AD9E00B8474A /* BlockDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FEC92159AD9E00B8474A /* BlockDTO.swift */; }; + 5F61FEFD2159AD9E00B8474A /* AccountMetaDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FECA2159AD9E00B8474A /* AccountMetaDTO.swift */; }; + 5F61FEFE2159AD9E00B8474A /* TransactionHashes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FECB2159AD9E00B8474A /* TransactionHashes.swift */; }; + 5F61FEFF2159AD9E00B8474A /* NamespaceMosaicMetaDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FECC2159AD9E00B8474A /* NamespaceMosaicMetaDTO.swift */; }; + 5F61FF002159AD9E00B8474A /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FECD2159AD9E00B8474A /* Extensions.swift */; }; + 5F61FF012159AD9E00B8474A /* JSONEncodingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FECE2159AD9E00B8474A /* JSONEncodingHelper.swift */; }; + 5F61FF022159AD9E00B8474A /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FECF2159AD9E00B8474A /* Models.swift */; }; + 5F61FF032159AD9E00B8474A /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FED02159AD9E00B8474A /* Configuration.swift */; }; + 5F61FF06215C462C00B8474A /* CryptoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F61FF04215C41C000B8474A /* CryptoSwift.framework */; }; + 5F61FF07215C463800B8474A /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F61FE942159AD3400B8474A /* Alamofire.framework */; }; + 5F61FF12215C55DC00B8474A /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F61FF11215C55DC00B8474A /* TestUtils.swift */; }; + 5F8EA5ED2160A6EB00646E6E /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F8EA5EC2160A6EB00646E6E /* RxSwift.framework */; }; + 5F8EA5EF2160CE4500646E6E /* RxBlocking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F8EA5EE2160CE4500646E6E /* RxBlocking.framework */; }; + 5F8EA5F12160CE5300646E6E /* RxTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F8EA5F02160CE5300646E6E /* RxTest.framework */; }; + 5FB684E9216C9CAA003EE6C4 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FB684E8216C9CAA003EE6C4 /* Starscream.framework */; }; + 6905707ACA9A77378D1A47D9 /* TransactionInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057D275DF3FC53B0EA3CC3 /* TransactionInfoTest.swift */; }; + 6905707DFE4005C3F155E9A8 /* NetworkType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057EF4745A4EE9E9E48B4F /* NetworkType.swift */; }; + 690570A45B9E1DCDC2351EA4 /* RawAPIExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905787D7DAE1DC68FD76A1A /* RawAPIExtensions.swift */; }; + 690570AD49E092E74FCD352C /* NamespaceHttp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B1C2125E0514A3F641C /* NamespaceHttp.swift */; }; + 690570C1362F8435E2C917A6 /* PlainMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905714A099BC3FEDBB0198E /* PlainMessage.swift */; }; + 690570C6893D95C6AD8C1750 /* SecretLockTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E566AF82EEF8FE20DEB /* SecretLockTransactionTest.swift */; }; + 69057117FE6F184A63D7CC32 /* TransactionMappingTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690576952CF286C600952C7A /* TransactionMappingTest.swift */; }; + 69057119B0E777FF9ED0584A /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057259D73A7A69F8A1F322 /* Message.swift */; }; + 6905711BFC742B753C83B64C /* MultisigCosignatoryModificationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057F4F84D5F4ADF0C5B362 /* MultisigCosignatoryModificationType.swift */; }; + 6905712ED91755C61C3ACDE1 /* MosaicHttp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057BEC41BBD5E8AE12371B /* MosaicHttp.swift */; }; + 69057142A9B5FD77BE8C7498 /* MosaicHttpTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905761CD4312FD3CA2C3BEB /* MosaicHttpTest.swift */; }; + 69057169165CE2A41BCFF2E9 /* AccountInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690574F6552C03CC0EF5EAB9 /* AccountInfo.swift */; }; + 6905716CDCE4B3592D7A1EE8 /* MosaicInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690576F415BDCEE642C47005 /* MosaicInfo.swift */; }; + 690571CC6E2EB69D74777661 /* PublicAccountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057CF0A24A83C01AE05275 /* PublicAccountTest.swift */; }; + 690571F613861BE679D2F026 /* NamespaceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B8C64DB61FA9B7752CC /* NamespaceInfo.swift */; }; + 690572088D906FDE88F78551 /* TransactionMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690570EBF3B3FB7A421B31A6 /* TransactionMapping.swift */; }; + 6905723DCFF220EE4753B17A /* MosaicInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B143B9D53F13373DE2C /* MosaicInfoTest.swift */; }; + 6905725E13CC6B0645DF993F /* Listener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690573E3895B54138ED246C3 /* Listener.swift */; }; + 6905727C1C4672097466B0E7 /* ListenerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905748467844716CF50795E /* ListenerTest.swift */; }; + 6905728A6826D6513BB2F206 /* FakeTransferTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057D00C1636A7080E7ED3E /* FakeTransferTransaction.swift */; }; + 690572AA0C8BAFFF13D257FA /* CosignatureTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057F9BAB23A1951B73643D /* CosignatureTransactionTest.swift */; }; + 690572CE2E26CB412508D639 /* LockFundsTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057169DC67318531BEB86F /* LockFundsTransactionTest.swift */; }; + 690572D82DDFC6C150ECD1E6 /* SignerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690573807F73618DE2D3F615 /* SignerTest.swift */; }; + 690572E36477A0B1AE1A365B /* TransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690578960B673554899B032C /* TransactionTest.swift */; }; + 6905731A7A6BC6972598E8C2 /* MosaicId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057FABD7E8E143066FF306 /* MosaicId.swift */; }; + 69057344AE8173DE1D4AB319 /* NamespaceRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057BBF6248EC257FF89A81 /* NamespaceRepository.swift */; }; + 6905736C1D5AD18B8443461F /* Decimal+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690577DDD4A8A7D4C0C28BFF /* Decimal+Extension.swift */; }; + 6905741E1CDBEF0B9E6111B4 /* SignedTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C90F97EEFD8C3366587 /* SignedTransactionTest.swift */; }; + 6905743441495CA4AA95419B /* TransactionStatusError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057A77D2C9D991A73D1E03 /* TransactionStatusError.swift */; }; + 6905744C5E59424E1B8E30C5 /* Hashes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B986E9819C1F7A1D9EC /* Hashes.swift */; }; + 690574500C2D312CE09E7D11 /* IdGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057112997DDD3A4EF8EBC0 /* IdGenerator.swift */; }; + 6905746FE8393463A2CC1401 /* AccountHttp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057403EDCE2B19C886B9AE /* AccountHttp.swift */; }; + 690574853CB166EF4A274535 /* BlockchainHttp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690574D86759166EEF643ACB /* BlockchainHttp.swift */; }; + 690574BC29D8CE86112D79CC /* PrivateKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905727D398B6D62B9C61123 /* PrivateKey.swift */; }; + 69057501D968DE546B20BCFC /* CosignatureTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C8FF4584C4E8042158C /* CosignatureTransaction.swift */; }; + 6905751D70865C6A49F707F7 /* MosaicSupplyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690577C24D98A72C4CB7DF9C /* MosaicSupplyType.swift */; }; + 6905752B85432CD893B0D8B3 /* byte_order.c in Sources */ = {isa = PBXBuildFile; fileRef = 6905747BED623BABFD230DF2 /* byte_order.c */; }; + 690575368C10C935E11C43E3 /* E2ETest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057CB170EBC57EF7ECB04F /* E2ETest.swift */; }; + 690575625593C7101D45D0CD /* BlockchainScore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690578CB485C1A31C05909AD /* BlockchainScore.swift */; }; + 69057574D65C44B3466A1CCE /* BlockchainStorageInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B48849993D77A35D369 /* BlockchainStorageInfoTest.swift */; }; + 690575796DD68942C15AF494 /* ge.c in Sources */ = {isa = PBXBuildFile; fileRef = 69057585A1423AC754379139 /* ge.c */; }; + 6905758CEDF305960798CF80 /* MosaicRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057D18406125EAEACC1E04 /* MosaicRepository.swift */; }; + 690575C5CC6A71EB4D7CB440 /* PublicKeyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905776CAA0896B7DF34FF8E /* PublicKeyTest.swift */; }; + 690575DA99588DFB0859B21F /* MosaicPropertiesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690579C22CC886582EC79684 /* MosaicPropertiesTest.swift */; }; + 6905760FA2663ACD2C428267 /* Base32Encoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690574D23B5D3EBBA29EBFD6 /* Base32Encoder.swift */; }; + 6905763DA5F52364EB1F9954 /* TransactionHttp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905735ED6414107AB39DF1F /* TransactionHttp.swift */; }; + 6905763E13F92E7E44871AEA /* KeyPairTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905717B170A44286FDCD3EE /* KeyPairTest.swift */; }; + 6905764928DE197A9ABFEB22 /* PrivateKeyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B18BD643365838E5B54 /* PrivateKeyTest.swift */; }; + 6905765B3730216B7035EE78 /* MultisigAccountGraphInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057F59588C03432487D5B4 /* MultisigAccountGraphInfo.swift */; }; + 6905768012569566BD4B413E /* DeadlineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905740FE2D8F4E4B5A59A52 /* DeadlineTest.swift */; }; + 690576921440AA6891AC0C14 /* SignedTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690574CCC7C029E93E28ED20 /* SignedTransaction.swift */; }; + 690576B7783EE70CCD6E601A /* SecretLockTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905798BCB6BF7D7B8EE5382 /* SecretLockTransaction.swift */; }; + 690576D77B2D9A4A6B0040BB /* MosaicProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690572698536339D078FD1A7 /* MosaicProperties.swift */; }; + 690576E5ACDB3BED7B4968F3 /* TransferTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057491F8A75A07FF9D490A /* TransferTransaction.swift */; }; + 690576ED0B81AB07E6B8C935 /* add_scalar.c in Sources */ = {isa = PBXBuildFile; fileRef = 6905742B882BD62863EE1875 /* add_scalar.c */; }; + 690576F420062D3140689D3C /* ed25519_sha3_512.c in Sources */ = {isa = PBXBuildFile; fileRef = 69057A6AD12E2FD2FCE8745C /* ed25519_sha3_512.c */; }; + 6905770438D8C8BD7BBD8C5D /* BlockchainHttpTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C9CE30A9606239BF731 /* BlockchainHttpTest.swift */; }; + 690577144A706221CF8EFA11 /* HashTypeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690578FE17F7BDC391CB3BCA /* HashTypeTest.swift */; }; + 690577369B0D00F3C8885071 /* HexEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057FC60D58BD558D368732 /* HexEncoder.swift */; }; + 69057742D05FD7E4D5847E36 /* AccountHttpTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B28935D68C52EB927D1 /* AccountHttpTest.swift */; }; + 6905776915E1DA81B48FFD9E /* NamespaceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057A5147947B6A7249E913 /* NamespaceType.swift */; }; + 6905777F73EC126E473FE6D0 /* NetworkRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057A2E1649B46DDF789F10 /* NetworkRepository.swift */; }; + 690577AF1346838F42290579 /* BlockInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057106C5D72C3CBE9B26E8 /* BlockInfoTest.swift */; }; + 690577C03BF283D9B8DBA2BE /* BlockchainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E5E41DAE47AC465CC80 /* BlockchainRepository.swift */; }; + 690577C701CCC94FFAF9C92E /* verify.c in Sources */ = {isa = PBXBuildFile; fileRef = 690571F6206682024B1E40D7 /* verify.c */; }; + 690577CF6F8C4E087A23297F /* sha3.c in Sources */ = {isa = PBXBuildFile; fileRef = 69057CF21D8CF0CFCC131070 /* sha3.c */; }; + 690578097FDE3E9D88C73B5A /* MosaicTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057285086811CF9DE548E1 /* MosaicTest.swift */; }; + 690578175F9E3E02D84D1256 /* MultisigCosignatoryModification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690572A284FA3D462A443FAF /* MultisigCosignatoryModification.swift */; }; + 690578656C085ED0408065AB /* Base32EncoderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E01EBBD0E4B04178344 /* Base32EncoderTest.swift */; }; + 6905786C788E2DCAA0F0F8BF /* NamespaceName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690579AB7AB64C884EE5C970 /* NamespaceName.swift */; }; + 69057881F0609A832C74C18D /* XEM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690579EEAA7C75A89014C5D0 /* XEM.swift */; }; + 69057895794CBA66D7EE0AB9 /* sc.c in Sources */ = {isa = PBXBuildFile; fileRef = 690578507B66793FECBA2F0A /* sc.c */; }; + 690578A61795D61A9DB9F71E /* BlockchainStorageInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690572C25E25A10F98A7624A /* BlockchainStorageInfo.swift */; }; + 690578A7AA0CBA81E10537C0 /* SecretProofTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690578533F76934BC08C3D36 /* SecretProofTransaction.swift */; }; + 690578DC1FFC70B977280598 /* ListenerMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690573CA21CEEA9AF55E845D /* ListenerMessage.swift */; }; + 690578F7868235C726FCC5E5 /* LockFundsTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905705462C18AB04D3D8645 /* LockFundsTransaction.swift */; }; + 69057911FA4937B511DEC16F /* Http.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690575369AEF5A6B15FC62BD /* Http.swift */; }; + 6905791F0E8D111544ED527F /* MosaicDefinitionTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690572497C2D5276F8440113 /* MosaicDefinitionTransactionTest.swift */; }; + 690579294EE5BF590E3403D3 /* NetworkTypeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690570F6F9476E445D8863F4 /* NetworkTypeTest.swift */; }; + 69057955EB51C8A7E7CDE39F /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057903B1B768C4F7287E6B /* String+Extension.swift */; }; + 6905796228E78B3FAFF0E471 /* AggregateTransactionCosignature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690579FC955C1EB98FEE7A0F /* AggregateTransactionCosignature.swift */; }; + 690579B343735F615A048C0A /* IdGeneratorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057453D469CD9EFF86885B /* IdGeneratorTest.swift */; }; + 690579B6D160A101638B413F /* message_encryption.h in Headers */ = {isa = PBXBuildFile; fileRef = 69057B6CAEBB676A1987E43B /* message_encryption.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 690579BAE0072106A6F98357 /* ListenerSubscribeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690572E901DB04148B68ABB7 /* ListenerSubscribeMessage.swift */; }; + 690579C173A1DBEE6D650C7F /* PublicAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B2553E3CC5D54EDF17F /* PublicAccount.swift */; }; + 690579C41DE2FBEBE4877A34 /* HashType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C4E59A05C27DEF1B5BA /* HashType.swift */; }; + 690579DFCC752F4D1AF2BB48 /* BlockInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905761A15DCC442C8F7F8D0 /* BlockInfo.swift */; }; + 690579F68338840EB8877801 /* ParameterizedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C4294CA4B0D25F48620 /* ParameterizedTest.swift */; }; + 69057A04191653530E655848 /* HashesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E5215C345873DA8F906 /* HashesTest.swift */; }; + 69057A0725F52E7C440AB07A /* MultisigAccountGraphInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E61A492377D5DDC3A89 /* MultisigAccountGraphInfoTest.swift */; }; + 69057A0C557391ED4AA0735F /* TestSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905782C6047C805089D0E68 /* TestSettings.swift */; }; + 69057A0E1B4ADA22B045E3ED /* TransactionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690576C9F957129A821B12C7 /* TransactionStatus.swift */; }; + 69057A144EE166DAE2A8DE5D /* Nem2SdkSwiftError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905730495192AEB7E21D480 /* Nem2SdkSwiftError.swift */; }; + 69057A1C7440FF0B548E8471 /* ed25519_sha3_512.h in Headers */ = {isa = PBXBuildFile; fileRef = 690575268C12C3192954B56D /* ed25519_sha3_512.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 69057A1FE9C98DE61F472095 /* PublicKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057CDC43DDAFC54C61784E /* PublicKey.swift */; }; + 69057A1FEC9163D276D20F2F /* MosaicIdTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057EABAF726B84BCAF3C0E /* MosaicIdTest.swift */; }; + 69057A2E7F3D991F58E95D23 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690575C4F456CE2B0DE840BB /* Account.swift */; }; + 69057A38B9CF581D1A14FB10 /* NamespaceIdTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905791348D84FAB2D6DE216 /* NamespaceIdTest.swift */; }; + 69057A527FC48129AB210E31 /* MultisigAccountInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057059EB3F51166CDC85A9 /* MultisigAccountInfoTest.swift */; }; + 69057A55CB73538238ACD2EB /* TransactionTypeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C5C79CEBF378E572E36 /* TransactionTypeTest.swift */; }; + 69057AB849308CAA4E7DD2CA /* MosaicSupplyChangeTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690578640B2CB08873F64D9A /* MosaicSupplyChangeTransactionTest.swift */; }; + 69057ACB1B528C924DDAD14E /* KeyPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905786C25DE553FF0602CFB /* KeyPair.swift */; }; + 69057AD1AF6C6CB6D9BE4343 /* AggregateTransactionCosignatureTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690571D98FE593C2834416F4 /* AggregateTransactionCosignatureTest.swift */; }; + 69057AFFAD182ECCE918C383 /* NamespaceInfoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057075D94E899081F295A2 /* NamespaceInfoTest.swift */; }; + 69057B07426B57FF6B08D44C /* FakeDeadline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905777C6724B5FC491A3509 /* FakeDeadline.swift */; }; + 69057B4A534509165833518E /* MosaicSupplyChangeTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690579680D4BBA9D6D539EE3 /* MosaicSupplyChangeTransaction.swift */; }; + 69057B4AED0A7AE37E8B96E8 /* CosignatureSignedTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905790DACEC769A1415FBB9 /* CosignatureSignedTransaction.swift */; }; + 69057B4D39C7C192615AFAD3 /* TransactionAnnounceResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690573498990C169FB7B406B /* TransactionAnnounceResponse.swift */; }; + 69057B6789E7B5D59CD8C3CE /* NamespaceHttpTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E67BFC0E3B643B5E17C /* NamespaceHttpTest.swift */; }; + 69057B67B08B2462FFEFEFA2 /* fe.c in Sources */ = {isa = PBXBuildFile; fileRef = 69057D7B2B50EAB2582920B0 /* fe.c */; }; + 69057B85703781CD0AF796B3 /* sign.c in Sources */ = {isa = PBXBuildFile; fileRef = 69057DB5799E9466FABD01E8 /* sign.c */; }; + 69057BF4D0ECEF89260E673F /* MultisigAccountInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690579BB951D521F5A6001BD /* MultisigAccountInfo.swift */; }; + 69057C19F9EEA2513D5CAC0F /* key_exchange.c in Sources */ = {isa = PBXBuildFile; fileRef = 6905780314E5BC9EE018E3B9 /* key_exchange.c */; }; + 69057C5A5902BB81585F803F /* Deadline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905745561E223913D92A755 /* Deadline.swift */; }; + 69057CA6BB9D31967EC30EE3 /* keypair.c in Sources */ = {isa = PBXBuildFile; fileRef = 690577A6DC35F61659405DBC /* keypair.c */; }; + 69057CA71B5AE801F35D7813 /* TransactionRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057DAE7F3578E77AFFF37F /* TransactionRepository.swift */; }; + 69057CAB8FFE1053A2288C22 /* SecretProofTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057174468FF2DD571A303C /* SecretProofTransactionTest.swift */; }; + 69057CB77D0053A4FD639A7F /* NamespaceNameTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690575526BC6A27D1D607A09 /* NamespaceNameTest.swift */; }; + 69057CCCF623E80286DB26D9 /* MosaicName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057227F40DF62DB4A43BB1 /* MosaicName.swift */; }; + 69057CDF383F3B7847470D13 /* RegisterNamespaceTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905763C5412EC92747DF5FA /* RegisterNamespaceTransaction.swift */; }; + 69057CF0A56ECAFB37A4D3AE /* AccountRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057769EED737D20D4A27CF /* AccountRepository.swift */; }; + 69057D0F2E49B31CC09595B0 /* ed25519.h in Headers */ = {isa = PBXBuildFile; fileRef = 6905736F848C7AA310EB90A2 /* ed25519.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 69057D1CFD6F2D5D44DFE8AF /* Numeric+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690570E4D59A5A2086AFAD50 /* Numeric+Extension.swift */; }; + 69057D3069176BD1444289EA /* HexEncoderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905778A1A7626B2A3649380 /* HexEncoderTest.swift */; }; + 69057D3BE1557B1F1E38914C /* Address.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905765D80D5647D4973C02B /* Address.swift */; }; + 69057D404705F2E8FF1790C7 /* seed.c in Sources */ = {isa = PBXBuildFile; fileRef = 690571D15DBE0C8FF2FC78B4 /* seed.c */; }; + 69057D9E0777B1B15E032836 /* ListenerChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690576B9A11D8064952EBE39 /* ListenerChannel.swift */; }; + 69057DADB6E41E6CBB3DA896 /* AccountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690570E50B0F12E595A5FCEE /* AccountTest.swift */; }; + 69057DC28F2E9D5E5C60AA8F /* TransactionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057704C467557E62EEB68E /* TransactionType.swift */; }; + 69057DE51AB6D5E3214C501C /* MosaicDefinitionTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057F2F9256F4874417EE94 /* MosaicDefinitionTransaction.swift */; }; + 69057DE9A6BAD91AC56E9CC6 /* CosignatureSignedTransactionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057AD954704059B2995E79 /* CosignatureSignedTransactionDTO.swift */; }; + 69057E14922B35EB7F984CB4 /* CosignatureSignedTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057D6B6E8E7E6D4EB1F79D /* CosignatureSignedTransactionTest.swift */; }; + 69057E4E2B2D43A649020ED7 /* AggregateTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057E01E3206A7FEDFC48CF /* AggregateTransactionTest.swift */; }; + 69057E7ACCD2B4301FD105C4 /* TransferTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057C96B2D6864C931AA9E6 /* TransferTransactionTest.swift */; }; + 69057E801BCC4D03090A7357 /* NetworkHttpTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057493B245CAB0C2306BBA /* NetworkHttpTest.swift */; }; + 69057E8DB2FE49313966D99C /* NamespaceId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690570DEB9A579F1B95846CB /* NamespaceId.swift */; }; + 69057E98E47E071C0FE45AC0 /* TransactionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905721FCA75E181EFBA2499 /* TransactionInfo.swift */; }; + 69057EA042EF6830A7A82E22 /* RegisterNamespaceTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690571C75DE69825A3F1538D /* RegisterNamespaceTransactionTest.swift */; }; + 69057EA6D18D682EF81DAC6D /* Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057B947479C8BD8B87D3DA /* Transaction.swift */; }; + 69057EC66807922AE0512EEC /* TransactionHttpTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690577986A36C1993CD747FC /* TransactionHttpTest.swift */; }; + 69057ED783CDF83A7E8A5F25 /* ModifyMultisigAccountTransactionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057F440B33EBC844939D1E /* ModifyMultisigAccountTransactionTest.swift */; }; + 69057EDADC61DA7FD86F9C6F /* NetworkHttp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057D3E95F1E0E5F4E1D0F7 /* NetworkHttp.swift */; }; + 69057EEFB64914C1EF95AE57 /* AggregateTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905748F462A3F35A03CE18C /* AggregateTransaction.swift */; }; + 69057F1BA311F9003BEC12A5 /* Signer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905778161C4D97D4AA6479E /* Signer.swift */; }; + 69057F1BAC45C87BFCC098D4 /* MosaicNameTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905744D8E99947745BD90A1 /* MosaicNameTest.swift */; }; + 69057F7D8CF4426BBBCF3DF1 /* ModifyMultisigAccountTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69057AC723A3A906C6E86F67 /* ModifyMultisigAccountTransaction.swift */; }; + 69057F7DAFEDDA4F609E9783 /* Mosaic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905747C5207ED71203E14EE /* Mosaic.swift */; }; + 69057F8BD40A9F0FFE782005 /* AddressTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6905794CBDD98953113DB2C1 /* AddressTest.swift */; }; + 69057FA6DCF028E773F08792 /* message_encryption.c in Sources */ = {isa = PBXBuildFile; fileRef = 690570C6B1960AADEB006D26 /* message_encryption.c */; }; + 69057FA7EC3B64EDB33652C5 /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 690576C66F7344706C982A81 /* sha512.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 5F61FE842159AC0500B8474A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5F61FE702159AC0500B8474A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5F61FE782159AC0500B8474A; + remoteInfo = Nem2SdkSwift; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 5F61FE792159AC0500B8474A /* Nem2SdkSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nem2SdkSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5F61FE7C2159AC0500B8474A /* Nem2SdkSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Nem2SdkSwift.h; sourceTree = ""; }; + 5F61FE7D2159AC0500B8474A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5F61FE822159AC0500B8474A /* Nem2SdkSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Nem2SdkSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5F61FE872159AC0500B8474A /* Nem2SdkSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Nem2SdkSwiftTests.swift; sourceTree = ""; }; + 5F61FE892159AC0500B8474A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5F61FE942159AD3400B8474A /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = ""; }; + 5F61FE9C2159AD9E00B8474A /* APIHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = ""; }; + 5F61FE9D2159AD9E00B8474A /* AlamofireImplementations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlamofireImplementations.swift; sourceTree = ""; }; + 5F61FE9F2159AD9E00B8474A /* NetworkRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA02159AD9E00B8474A /* TransactionRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA12159AD9E00B8474A /* AccountRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA22159AD9E00B8474A /* BlockchainRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA32159AD9E00B8474A /* MosaicRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA42159AD9E00B8474A /* NamespaceRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA52159AD9E00B8474A /* NodeRoutesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeRoutesAPI.swift; sourceTree = ""; }; + 5F61FEA62159AD9E00B8474A /* CodableHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodableHelper.swift; sourceTree = ""; }; + 5F61FEA72159AD9E00B8474A /* JSONEncodableEncoding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONEncodableEncoding.swift; sourceTree = ""; }; + 5F61FEA82159AD9E00B8474A /* APIs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = ""; }; + 5F61FEA92159AD9E00B8474A /* AnyObjectDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyObjectDictionary.swift; sourceTree = ""; }; + 5F61FEAB2159AD9E00B8474A /* NodeTimeDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeTimeDTO.swift; sourceTree = ""; }; + 5F61FEAC2159AD9E00B8474A /* NamespaceNameDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceNameDTO.swift; sourceTree = ""; }; + 5F61FEAD2159AD9E00B8474A /* AccountInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountInfoDTO.swift; sourceTree = ""; }; + 5F61FEAE2159AD9E00B8474A /* NamespaceIds.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceIds.swift; sourceTree = ""; }; + 5F61FEAF2159AD9E00B8474A /* TransactionStatusDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionStatusDTO.swift; sourceTree = ""; }; + 5F61FEB02159AD9E00B8474A /* MosaicInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicInfoDTO.swift; sourceTree = ""; }; + 5F61FEB12159AD9E00B8474A /* TransactionPayload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionPayload.swift; sourceTree = ""; }; + 5F61FEB22159AD9E00B8474A /* BlockMetaDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockMetaDTO.swift; sourceTree = ""; }; + 5F61FEB32159AD9E00B8474A /* CommunicationTimestamps.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommunicationTimestamps.swift; sourceTree = ""; }; + 5F61FEB42159AD9E00B8474A /* MosaicDefinitionDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicDefinitionDTO.swift; sourceTree = ""; }; + 5F61FEB52159AD9E00B8474A /* TransactionIds.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionIds.swift; sourceTree = ""; }; + 5F61FEB62159AD9E00B8474A /* MosaicPropertiesDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicPropertiesDTO.swift; sourceTree = ""; }; + 5F61FEB72159AD9E00B8474A /* UInt64DTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UInt64DTO.swift; sourceTree = ""; }; + 5F61FEB82159AD9E00B8474A /* MosaicDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicDTO.swift; sourceTree = ""; }; + 5F61FEB92159AD9E00B8474A /* Addresses.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Addresses.swift; sourceTree = ""; }; + 5F61FEBA2159AD9E00B8474A /* AnnounceTransactionInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnnounceTransactionInfoDTO.swift; sourceTree = ""; }; + 5F61FEBB2159AD9E00B8474A /* NamespaceInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceInfoDTO.swift; sourceTree = ""; }; + 5F61FEBC2159AD9E00B8474A /* NodeInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeInfoDTO.swift; sourceTree = ""; }; + 5F61FEBD2159AD9E00B8474A /* NetworkTypeDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkTypeDTO.swift; sourceTree = ""; }; + 5F61FEBE2159AD9E00B8474A /* MultisigAccountInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigAccountInfoDTO.swift; sourceTree = ""; }; + 5F61FEBF2159AD9E00B8474A /* BlockInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockInfoDTO.swift; sourceTree = ""; }; + 5F61FEC02159AD9E00B8474A /* MosaicNameDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicNameDTO.swift; sourceTree = ""; }; + 5F61FEC12159AD9E00B8474A /* MosaicIds.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicIds.swift; sourceTree = ""; }; + 5F61FEC22159AD9E00B8474A /* Multisig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Multisig.swift; sourceTree = ""; }; + 5F61FEC32159AD9E00B8474A /* BlockchainScoreDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainScoreDTO.swift; sourceTree = ""; }; + 5F61FEC42159AD9E00B8474A /* MultisigAccountGraphInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigAccountGraphInfoDTO.swift; sourceTree = ""; }; + 5F61FEC52159AD9E00B8474A /* BlockchainStorageInfoDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainStorageInfoDTO.swift; sourceTree = ""; }; + 5F61FEC62159AD9E00B8474A /* NamespaceDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceDTO.swift; sourceTree = ""; }; + 5F61FEC72159AD9E00B8474A /* HeightDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightDTO.swift; sourceTree = ""; }; + 5F61FEC82159AD9E00B8474A /* AccountDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountDTO.swift; sourceTree = ""; }; + 5F61FEC92159AD9E00B8474A /* BlockDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockDTO.swift; sourceTree = ""; }; + 5F61FECA2159AD9E00B8474A /* AccountMetaDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountMetaDTO.swift; sourceTree = ""; }; + 5F61FECB2159AD9E00B8474A /* TransactionHashes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionHashes.swift; sourceTree = ""; }; + 5F61FECC2159AD9E00B8474A /* NamespaceMosaicMetaDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceMosaicMetaDTO.swift; sourceTree = ""; }; + 5F61FECD2159AD9E00B8474A /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + 5F61FECE2159AD9E00B8474A /* JSONEncodingHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONEncodingHelper.swift; sourceTree = ""; }; + 5F61FECF2159AD9E00B8474A /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; + 5F61FED02159AD9E00B8474A /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; + 5F61FF04215C41C000B8474A /* CryptoSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CryptoSwift.framework; path = Carthage/Build/iOS/CryptoSwift.framework; sourceTree = ""; }; + 5F61FF11215C55DC00B8474A /* TestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestUtils.swift; sourceTree = ""; }; + 5F8EA5EC2160A6EB00646E6E /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = ""; }; + 5F8EA5EE2160CE4500646E6E /* RxBlocking.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxBlocking.framework; path = Carthage/Build/iOS/RxBlocking.framework; sourceTree = ""; }; + 5F8EA5F02160CE5300646E6E /* RxTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxTest.framework; path = Carthage/Build/iOS/RxTest.framework; sourceTree = ""; }; + 5FB684E8216C9CAA003EE6C4 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/iOS/Starscream.framework; sourceTree = ""; }; + 6905705462C18AB04D3D8645 /* LockFundsTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockFundsTransaction.swift; sourceTree = ""; }; + 69057059EB3F51166CDC85A9 /* MultisigAccountInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigAccountInfoTest.swift; sourceTree = ""; }; + 69057075D94E899081F295A2 /* NamespaceInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceInfoTest.swift; sourceTree = ""; }; + 690570C6B1960AADEB006D26 /* message_encryption.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = message_encryption.c; sourceTree = ""; }; + 690570DEB9A579F1B95846CB /* NamespaceId.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceId.swift; sourceTree = ""; }; + 690570E4D59A5A2086AFAD50 /* Numeric+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Numeric+Extension.swift"; sourceTree = ""; }; + 690570E50B0F12E595A5FCEE /* AccountTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountTest.swift; sourceTree = ""; }; + 690570EBF3B3FB7A421B31A6 /* TransactionMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionMapping.swift; sourceTree = ""; }; + 690570F6F9476E445D8863F4 /* NetworkTypeTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkTypeTest.swift; sourceTree = ""; }; + 69057106C5D72C3CBE9B26E8 /* BlockInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockInfoTest.swift; sourceTree = ""; }; + 69057112997DDD3A4EF8EBC0 /* IdGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdGenerator.swift; sourceTree = ""; }; + 6905714A099BC3FEDBB0198E /* PlainMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlainMessage.swift; sourceTree = ""; }; + 69057169DC67318531BEB86F /* LockFundsTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockFundsTransactionTest.swift; sourceTree = ""; }; + 69057174468FF2DD571A303C /* SecretProofTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretProofTransactionTest.swift; sourceTree = ""; }; + 6905717B170A44286FDCD3EE /* KeyPairTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyPairTest.swift; sourceTree = ""; }; + 690571C75DE69825A3F1538D /* RegisterNamespaceTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegisterNamespaceTransactionTest.swift; sourceTree = ""; }; + 690571D15DBE0C8FF2FC78B4 /* seed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = seed.c; path = src/seed.c; sourceTree = ""; }; + 690571D98FE593C2834416F4 /* AggregateTransactionCosignatureTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateTransactionCosignatureTest.swift; sourceTree = ""; }; + 690571F6206682024B1E40D7 /* verify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = verify.c; path = src/verify.c; sourceTree = ""; }; + 690571F6E4AB154FB49D7C5A /* ge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ge.h; path = src/ge.h; sourceTree = ""; }; + 6905721FCA75E181EFBA2499 /* TransactionInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionInfo.swift; sourceTree = ""; }; + 69057227F40DF62DB4A43BB1 /* MosaicName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicName.swift; sourceTree = ""; }; + 690572497C2D5276F8440113 /* MosaicDefinitionTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicDefinitionTransactionTest.swift; sourceTree = ""; }; + 69057259D73A7A69F8A1F322 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = ""; }; + 690572698536339D078FD1A7 /* MosaicProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicProperties.swift; sourceTree = ""; }; + 6905727D398B6D62B9C61123 /* PrivateKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateKey.swift; sourceTree = ""; }; + 69057285086811CF9DE548E1 /* MosaicTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicTest.swift; sourceTree = ""; }; + 690572A284FA3D462A443FAF /* MultisigCosignatoryModification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigCosignatoryModification.swift; sourceTree = ""; }; + 690572C25E25A10F98A7624A /* BlockchainStorageInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainStorageInfo.swift; sourceTree = ""; }; + 690572E901DB04148B68ABB7 /* ListenerSubscribeMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListenerSubscribeMessage.swift; sourceTree = ""; }; + 6905730495192AEB7E21D480 /* Nem2SdkSwiftError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Nem2SdkSwiftError.swift; sourceTree = ""; }; + 690573498990C169FB7B406B /* TransactionAnnounceResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionAnnounceResponse.swift; sourceTree = ""; }; + 6905735ED6414107AB39DF1F /* TransactionHttp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionHttp.swift; sourceTree = ""; }; + 6905736F848C7AA310EB90A2 /* ed25519.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ed25519.h; path = src/ed25519.h; sourceTree = ""; }; + 690573807F73618DE2D3F615 /* SignerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignerTest.swift; sourceTree = ""; }; + 690573CA21CEEA9AF55E845D /* ListenerMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListenerMessage.swift; sourceTree = ""; }; + 690573E3895B54138ED246C3 /* Listener.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Listener.swift; sourceTree = ""; }; + 69057403EDCE2B19C886B9AE /* AccountHttp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountHttp.swift; sourceTree = ""; }; + 6905740FE2D8F4E4B5A59A52 /* DeadlineTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeadlineTest.swift; sourceTree = ""; }; + 6905742B882BD62863EE1875 /* add_scalar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = add_scalar.c; path = src/add_scalar.c; sourceTree = ""; }; + 6905744D8E99947745BD90A1 /* MosaicNameTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicNameTest.swift; sourceTree = ""; }; + 69057453D469CD9EFF86885B /* IdGeneratorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdGeneratorTest.swift; sourceTree = ""; }; + 6905745561E223913D92A755 /* Deadline.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deadline.swift; sourceTree = ""; }; + 6905747BED623BABFD230DF2 /* byte_order.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = byte_order.c; path = librhash/byte_order.c; sourceTree = ""; }; + 6905747C5207ED71203E14EE /* Mosaic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mosaic.swift; sourceTree = ""; }; + 6905748467844716CF50795E /* ListenerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListenerTest.swift; sourceTree = ""; }; + 6905748F462A3F35A03CE18C /* AggregateTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateTransaction.swift; sourceTree = ""; }; + 69057491F8A75A07FF9D490A /* TransferTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTransaction.swift; sourceTree = ""; }; + 69057493B245CAB0C2306BBA /* NetworkHttpTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkHttpTest.swift; sourceTree = ""; }; + 690574CCC7C029E93E28ED20 /* SignedTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignedTransaction.swift; sourceTree = ""; }; + 690574D23B5D3EBBA29EBFD6 /* Base32Encoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base32Encoder.swift; sourceTree = ""; }; + 690574D86759166EEF643ACB /* BlockchainHttp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainHttp.swift; sourceTree = ""; }; + 690574F6552C03CC0EF5EAB9 /* AccountInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountInfo.swift; sourceTree = ""; }; + 690575268C12C3192954B56D /* ed25519_sha3_512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed25519_sha3_512.h; sourceTree = ""; }; + 690575369AEF5A6B15FC62BD /* Http.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Http.swift; sourceTree = ""; }; + 690575526BC6A27D1D607A09 /* NamespaceNameTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceNameTest.swift; sourceTree = ""; }; + 69057585A1423AC754379139 /* ge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ge.c; path = src/ge.c; sourceTree = ""; }; + 690575C4F456CE2B0DE840BB /* Account.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = ""; }; + 6905761A15DCC442C8F7F8D0 /* BlockInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockInfo.swift; sourceTree = ""; }; + 6905761CD4312FD3CA2C3BEB /* MosaicHttpTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicHttpTest.swift; sourceTree = ""; }; + 6905763C5412EC92747DF5FA /* RegisterNamespaceTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegisterNamespaceTransaction.swift; sourceTree = ""; }; + 6905765D80D5647D4973C02B /* Address.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Address.swift; sourceTree = ""; }; + 690576952CF286C600952C7A /* TransactionMappingTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionMappingTest.swift; sourceTree = ""; }; + 690576B9A11D8064952EBE39 /* ListenerChannel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListenerChannel.swift; sourceTree = ""; }; + 690576C66F7344706C982A81 /* sha512.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sha512.c; path = src/sha512.c; sourceTree = ""; }; + 690576C9F957129A821B12C7 /* TransactionStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionStatus.swift; sourceTree = ""; }; + 690576F415BDCEE642C47005 /* MosaicInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicInfo.swift; sourceTree = ""; }; + 69057704C467557E62EEB68E /* TransactionType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionType.swift; sourceTree = ""; }; + 69057769EED737D20D4A27CF /* AccountRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountRepository.swift; sourceTree = ""; }; + 6905776CAA0896B7DF34FF8E /* PublicKeyTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublicKeyTest.swift; sourceTree = ""; }; + 6905777C6724B5FC491A3509 /* FakeDeadline.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FakeDeadline.swift; sourceTree = ""; }; + 6905778161C4D97D4AA6479E /* Signer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Signer.swift; sourceTree = ""; }; + 6905778A1A7626B2A3649380 /* HexEncoderTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HexEncoderTest.swift; sourceTree = ""; }; + 690577986A36C1993CD747FC /* TransactionHttpTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionHttpTest.swift; sourceTree = ""; }; + 690577A6DC35F61659405DBC /* keypair.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = keypair.c; path = src/keypair.c; sourceTree = ""; }; + 690577C24D98A72C4CB7DF9C /* MosaicSupplyType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicSupplyType.swift; sourceTree = ""; }; + 690577DDD4A8A7D4C0C28BFF /* Decimal+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Decimal+Extension.swift"; sourceTree = ""; }; + 6905780314E5BC9EE018E3B9 /* key_exchange.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = key_exchange.c; path = src/key_exchange.c; sourceTree = ""; }; + 6905782C6047C805089D0E68 /* TestSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestSettings.swift; sourceTree = ""; }; + 690578507B66793FECBA2F0A /* sc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sc.c; path = src/sc.c; sourceTree = ""; }; + 690578533F76934BC08C3D36 /* SecretProofTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretProofTransaction.swift; sourceTree = ""; }; + 690578640B2CB08873F64D9A /* MosaicSupplyChangeTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicSupplyChangeTransactionTest.swift; sourceTree = ""; }; + 6905786C25DE553FF0602CFB /* KeyPair.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyPair.swift; sourceTree = ""; }; + 6905787D7DAE1DC68FD76A1A /* RawAPIExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawAPIExtensions.swift; sourceTree = ""; }; + 690578960B673554899B032C /* TransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionTest.swift; sourceTree = ""; }; + 690578CB485C1A31C05909AD /* BlockchainScore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainScore.swift; sourceTree = ""; }; + 690578FE17F7BDC391CB3BCA /* HashTypeTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HashTypeTest.swift; sourceTree = ""; }; + 69057903B1B768C4F7287E6B /* String+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; + 6905790DACEC769A1415FBB9 /* CosignatureSignedTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CosignatureSignedTransaction.swift; sourceTree = ""; }; + 6905791348D84FAB2D6DE216 /* NamespaceIdTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceIdTest.swift; sourceTree = ""; }; + 6905794CBDD98953113DB2C1 /* AddressTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddressTest.swift; sourceTree = ""; }; + 690579680D4BBA9D6D539EE3 /* MosaicSupplyChangeTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicSupplyChangeTransaction.swift; sourceTree = ""; }; + 6905798BCB6BF7D7B8EE5382 /* SecretLockTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretLockTransaction.swift; sourceTree = ""; }; + 690579AB7AB64C884EE5C970 /* NamespaceName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceName.swift; sourceTree = ""; }; + 690579BB951D521F5A6001BD /* MultisigAccountInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigAccountInfo.swift; sourceTree = ""; }; + 690579C22CC886582EC79684 /* MosaicPropertiesTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicPropertiesTest.swift; sourceTree = ""; }; + 690579EEAA7C75A89014C5D0 /* XEM.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XEM.swift; sourceTree = ""; }; + 690579FC955C1EB98FEE7A0F /* AggregateTransactionCosignature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateTransactionCosignature.swift; sourceTree = ""; }; + 69057A2E1649B46DDF789F10 /* NetworkRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkRepository.swift; sourceTree = ""; }; + 69057A33178694E1F4E98833 /* fe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fe.h; path = src/fe.h; sourceTree = ""; }; + 69057A3655CA2D8D6CA65BA2 /* sha3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sha3.h; path = librhash/sha3.h; sourceTree = ""; }; + 69057A5147947B6A7249E913 /* NamespaceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceType.swift; sourceTree = ""; }; + 69057A6AD12E2FD2FCE8745C /* ed25519_sha3_512.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ed25519_sha3_512.c; sourceTree = ""; }; + 69057A77D2C9D991A73D1E03 /* TransactionStatusError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionStatusError.swift; sourceTree = ""; }; + 69057AC723A3A906C6E86F67 /* ModifyMultisigAccountTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModifyMultisigAccountTransaction.swift; sourceTree = ""; }; + 69057AD954704059B2995E79 /* CosignatureSignedTransactionDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CosignatureSignedTransactionDTO.swift; sourceTree = ""; }; + 69057B143B9D53F13373DE2C /* MosaicInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicInfoTest.swift; sourceTree = ""; }; + 69057B18BD643365838E5B54 /* PrivateKeyTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateKeyTest.swift; sourceTree = ""; }; + 69057B1C2125E0514A3F641C /* NamespaceHttp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceHttp.swift; sourceTree = ""; }; + 69057B2553E3CC5D54EDF17F /* PublicAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublicAccount.swift; sourceTree = ""; }; + 69057B28935D68C52EB927D1 /* AccountHttpTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountHttpTest.swift; sourceTree = ""; }; + 69057B48849993D77A35D369 /* BlockchainStorageInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainStorageInfoTest.swift; sourceTree = ""; }; + 69057B6CAEBB676A1987E43B /* message_encryption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = message_encryption.h; sourceTree = ""; }; + 69057B8C64DB61FA9B7752CC /* NamespaceInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceInfo.swift; sourceTree = ""; }; + 69057B947479C8BD8B87D3DA /* Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Transaction.swift; sourceTree = ""; }; + 69057B986E9819C1F7A1D9EC /* Hashes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Hashes.swift; sourceTree = ""; }; + 69057BBF6248EC257FF89A81 /* NamespaceRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceRepository.swift; sourceTree = ""; }; + 69057BE9C70BB6B774C51628 /* sc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sc.h; path = src/sc.h; sourceTree = ""; }; + 69057BEC41BBD5E8AE12371B /* MosaicHttp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicHttp.swift; sourceTree = ""; }; + 69057C4294CA4B0D25F48620 /* ParameterizedTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParameterizedTest.swift; sourceTree = ""; }; + 69057C4E59A05C27DEF1B5BA /* HashType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HashType.swift; sourceTree = ""; }; + 69057C5C79CEBF378E572E36 /* TransactionTypeTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionTypeTest.swift; sourceTree = ""; }; + 69057C8FF4584C4E8042158C /* CosignatureTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CosignatureTransaction.swift; sourceTree = ""; }; + 69057C90F97EEFD8C3366587 /* SignedTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignedTransactionTest.swift; sourceTree = ""; }; + 69057C96B2D6864C931AA9E6 /* TransferTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTransactionTest.swift; sourceTree = ""; }; + 69057C98F142F0F5055E8D4D /* sha512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sha512.h; path = src/sha512.h; sourceTree = ""; }; + 69057C9CE30A9606239BF731 /* BlockchainHttpTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainHttpTest.swift; sourceTree = ""; }; + 69057CB170EBC57EF7ECB04F /* E2ETest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = E2ETest.swift; sourceTree = ""; }; + 69057CDC43DDAFC54C61784E /* PublicKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublicKey.swift; sourceTree = ""; }; + 69057CF0A24A83C01AE05275 /* PublicAccountTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublicAccountTest.swift; sourceTree = ""; }; + 69057CF21D8CF0CFCC131070 /* sha3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sha3.c; path = librhash/sha3.c; sourceTree = ""; }; + 69057D00C1636A7080E7ED3E /* FakeTransferTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FakeTransferTransaction.swift; sourceTree = ""; }; + 69057D18406125EAEACC1E04 /* MosaicRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicRepository.swift; sourceTree = ""; }; + 69057D275DF3FC53B0EA3CC3 /* TransactionInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionInfoTest.swift; sourceTree = ""; }; + 69057D3E95F1E0E5F4E1D0F7 /* NetworkHttp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkHttp.swift; sourceTree = ""; }; + 69057D6B6E8E7E6D4EB1F79D /* CosignatureSignedTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CosignatureSignedTransactionTest.swift; sourceTree = ""; }; + 69057D7B2B50EAB2582920B0 /* fe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fe.c; path = src/fe.c; sourceTree = ""; }; + 69057DAE7F3578E77AFFF37F /* TransactionRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionRepository.swift; sourceTree = ""; }; + 69057DB5799E9466FABD01E8 /* sign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sign.c; path = src/sign.c; sourceTree = ""; }; + 69057DF280E0A788B8276B58 /* precomp_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = precomp_data.h; path = src/precomp_data.h; sourceTree = ""; }; + 69057E01E3206A7FEDFC48CF /* AggregateTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateTransactionTest.swift; sourceTree = ""; }; + 69057E01EBBD0E4B04178344 /* Base32EncoderTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base32EncoderTest.swift; sourceTree = ""; }; + 69057E4993F65BFBE906F364 /* fixedint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fixedint.h; path = src/fixedint.h; sourceTree = ""; }; + 69057E5215C345873DA8F906 /* HashesTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HashesTest.swift; sourceTree = ""; }; + 69057E566AF82EEF8FE20DEB /* SecretLockTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecretLockTransactionTest.swift; sourceTree = ""; }; + 69057E5E41DAE47AC465CC80 /* BlockchainRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockchainRepository.swift; sourceTree = ""; }; + 69057E61A492377D5DDC3A89 /* MultisigAccountGraphInfoTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigAccountGraphInfoTest.swift; sourceTree = ""; }; + 69057E67BFC0E3B643B5E17C /* NamespaceHttpTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamespaceHttpTest.swift; sourceTree = ""; }; + 69057EABAF726B84BCAF3C0E /* MosaicIdTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicIdTest.swift; sourceTree = ""; }; + 69057EF4745A4EE9E9E48B4F /* NetworkType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkType.swift; sourceTree = ""; }; + 69057F2F9256F4874417EE94 /* MosaicDefinitionTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicDefinitionTransaction.swift; sourceTree = ""; }; + 69057F440B33EBC844939D1E /* ModifyMultisigAccountTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModifyMultisigAccountTransactionTest.swift; sourceTree = ""; }; + 69057F4F84D5F4ADF0C5B362 /* MultisigCosignatoryModificationType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigCosignatoryModificationType.swift; sourceTree = ""; }; + 69057F59588C03432487D5B4 /* MultisigAccountGraphInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultisigAccountGraphInfo.swift; sourceTree = ""; }; + 69057F67E09559BA07762CD8 /* byte_order.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = byte_order.h; path = librhash/byte_order.h; sourceTree = ""; }; + 69057F9BAB23A1951B73643D /* CosignatureTransactionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CosignatureTransactionTest.swift; sourceTree = ""; }; + 69057FABD7E8E143066FF306 /* MosaicId.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicId.swift; sourceTree = ""; }; + 69057FC60D58BD558D368732 /* HexEncoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HexEncoder.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5F61FE762159AC0500B8474A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5FB684E9216C9CAA003EE6C4 /* Starscream.framework in Frameworks */, + 5F8EA5ED2160A6EB00646E6E /* RxSwift.framework in Frameworks */, + 5F61FF07215C463800B8474A /* Alamofire.framework in Frameworks */, + 5F61FF06215C462C00B8474A /* CryptoSwift.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5F61FE7F2159AC0500B8474A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F8EA5F12160CE5300646E6E /* RxTest.framework in Frameworks */, + 5F8EA5EF2160CE4500646E6E /* RxBlocking.framework in Frameworks */, + 5F61FE832159AC0500B8474A /* Nem2SdkSwift.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5F61FE6F2159AC0500B8474A = { + isa = PBXGroup; + children = ( + 5F61FE7B2159AC0500B8474A /* Nem2SdkSwift */, + 5F61FE862159AC0500B8474A /* Nem2SdkSwiftTests */, + 5F61FE7A2159AC0500B8474A /* Products */, + 5F61FE932159AD3400B8474A /* Frameworks */, + ); + sourceTree = ""; + }; + 5F61FE7A2159AC0500B8474A /* Products */ = { + isa = PBXGroup; + children = ( + 5F61FE792159AC0500B8474A /* Nem2SdkSwift.framework */, + 5F61FE822159AC0500B8474A /* Nem2SdkSwiftTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 5F61FE7B2159AC0500B8474A /* Nem2SdkSwift */ = { + isa = PBXGroup; + children = ( + 5F61FE982159AD9E00B8474A /* sdk */, + 5F61FE972159AD9700B8474A /* core */, + 5F61FE7C2159AC0500B8474A /* Nem2SdkSwift.h */, + 5F61FE7D2159AC0500B8474A /* Info.plist */, + ); + path = Nem2SdkSwift; + sourceTree = ""; + }; + 5F61FE862159AC0500B8474A /* Nem2SdkSwiftTests */ = { + isa = PBXGroup; + children = ( + 5F61FE872159AC0500B8474A /* Nem2SdkSwiftTests.swift */, + 5F61FE892159AC0500B8474A /* Info.plist */, + 6905767A6C0A443EC865CD83 /* core */, + 69057AFFC0281CCFF9AF84E1 /* sdk */, + 5F61FF11215C55DC00B8474A /* TestUtils.swift */, + 69057C4294CA4B0D25F48620 /* ParameterizedTest.swift */, + 6905782C6047C805089D0E68 /* TestSettings.swift */, + ); + path = Nem2SdkSwiftTests; + sourceTree = ""; + }; + 5F61FE932159AD3400B8474A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5FB684E8216C9CAA003EE6C4 /* Starscream.framework */, + 5F8EA5F02160CE5300646E6E /* RxTest.framework */, + 5F8EA5EE2160CE4500646E6E /* RxBlocking.framework */, + 5F8EA5EC2160A6EB00646E6E /* RxSwift.framework */, + 5F61FF04215C41C000B8474A /* CryptoSwift.framework */, + 5F61FE942159AD3400B8474A /* Alamofire.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5F61FE972159AD9700B8474A /* core */ = { + isa = PBXGroup; + children = ( + 6905730495192AEB7E21D480 /* Nem2SdkSwiftError.swift */, + 6905730C2C368828D5970A36 /* crypto */, + 690574514698D0854C4E7862 /* utils */, + ); + path = core; + sourceTree = ""; + }; + 5F61FE982159AD9E00B8474A /* sdk */ = { + isa = PBXGroup; + children = ( + 5F61FE992159AD9E00B8474A /* model */, + 5F61FE9A2159AD9E00B8474A /* infrastructure */, + ); + path = sdk; + sourceTree = ""; + }; + 5F61FE992159AD9E00B8474A /* model */ = { + isa = PBXGroup; + children = ( + 69057955635505A442EAB3A7 /* account */, + 69057FB27C4F634790F42601 /* blockchain */, + 69057B36900FE45903EA3FB3 /* mosaic */, + 69057460F3AC1F6878F9FE8C /* namespace */, + 69057961C08CB429E53ECAC7 /* transaction */, + ); + path = model; + sourceTree = ""; + }; + 5F61FE9A2159AD9E00B8474A /* infrastructure */ = { + isa = PBXGroup; + children = ( + 5F61FE9B2159AD9E00B8474A /* raw */, + 69057D18406125EAEACC1E04 /* MosaicRepository.swift */, + 69057BEC41BBD5E8AE12371B /* MosaicHttp.swift */, + 6905787D7DAE1DC68FD76A1A /* RawAPIExtensions.swift */, + 690575369AEF5A6B15FC62BD /* Http.swift */, + 69057A2E1649B46DDF789F10 /* NetworkRepository.swift */, + 69057D3E95F1E0E5F4E1D0F7 /* NetworkHttp.swift */, + 69057BBF6248EC257FF89A81 /* NamespaceRepository.swift */, + 69057B1C2125E0514A3F641C /* NamespaceHttp.swift */, + 69057E5E41DAE47AC465CC80 /* BlockchainRepository.swift */, + 690574D86759166EEF643ACB /* BlockchainHttp.swift */, + 69057769EED737D20D4A27CF /* AccountRepository.swift */, + 69057403EDCE2B19C886B9AE /* AccountHttp.swift */, + 69057DAE7F3578E77AFFF37F /* TransactionRepository.swift */, + 6905735ED6414107AB39DF1F /* TransactionHttp.swift */, + 690576B9A11D8064952EBE39 /* ListenerChannel.swift */, + 690573CA21CEEA9AF55E845D /* ListenerMessage.swift */, + 690572E901DB04148B68ABB7 /* ListenerSubscribeMessage.swift */, + 690573E3895B54138ED246C3 /* Listener.swift */, + ); + path = infrastructure; + sourceTree = ""; + }; + 5F61FE9B2159AD9E00B8474A /* raw */ = { + isa = PBXGroup; + children = ( + 5F61FE9C2159AD9E00B8474A /* APIHelper.swift */, + 5F61FE9D2159AD9E00B8474A /* AlamofireImplementations.swift */, + 5F61FE9E2159AD9E00B8474A /* APIs */, + 5F61FEA62159AD9E00B8474A /* CodableHelper.swift */, + 5F61FEA72159AD9E00B8474A /* JSONEncodableEncoding.swift */, + 5F61FEA82159AD9E00B8474A /* APIs.swift */, + 5F61FEA92159AD9E00B8474A /* AnyObjectDictionary.swift */, + 5F61FEAA2159AD9E00B8474A /* Models */, + 5F61FECD2159AD9E00B8474A /* Extensions.swift */, + 5F61FECE2159AD9E00B8474A /* JSONEncodingHelper.swift */, + 5F61FECF2159AD9E00B8474A /* Models.swift */, + 5F61FED02159AD9E00B8474A /* Configuration.swift */, + ); + path = raw; + sourceTree = ""; + }; + 5F61FE9E2159AD9E00B8474A /* APIs */ = { + isa = PBXGroup; + children = ( + 5F61FE9F2159AD9E00B8474A /* NetworkRoutesAPI.swift */, + 5F61FEA02159AD9E00B8474A /* TransactionRoutesAPI.swift */, + 5F61FEA12159AD9E00B8474A /* AccountRoutesAPI.swift */, + 5F61FEA22159AD9E00B8474A /* BlockchainRoutesAPI.swift */, + 5F61FEA32159AD9E00B8474A /* MosaicRoutesAPI.swift */, + 5F61FEA42159AD9E00B8474A /* NamespaceRoutesAPI.swift */, + 5F61FEA52159AD9E00B8474A /* NodeRoutesAPI.swift */, + ); + path = APIs; + sourceTree = ""; + }; + 5F61FEAA2159AD9E00B8474A /* Models */ = { + isa = PBXGroup; + children = ( + 5F61FEAB2159AD9E00B8474A /* NodeTimeDTO.swift */, + 5F61FEAC2159AD9E00B8474A /* NamespaceNameDTO.swift */, + 5F61FEAD2159AD9E00B8474A /* AccountInfoDTO.swift */, + 5F61FEAE2159AD9E00B8474A /* NamespaceIds.swift */, + 5F61FEAF2159AD9E00B8474A /* TransactionStatusDTO.swift */, + 5F61FEB02159AD9E00B8474A /* MosaicInfoDTO.swift */, + 5F61FEB12159AD9E00B8474A /* TransactionPayload.swift */, + 5F61FEB22159AD9E00B8474A /* BlockMetaDTO.swift */, + 5F61FEB32159AD9E00B8474A /* CommunicationTimestamps.swift */, + 5F61FEB42159AD9E00B8474A /* MosaicDefinitionDTO.swift */, + 5F61FEB52159AD9E00B8474A /* TransactionIds.swift */, + 5F61FEB62159AD9E00B8474A /* MosaicPropertiesDTO.swift */, + 5F61FEB72159AD9E00B8474A /* UInt64DTO.swift */, + 5F61FEB82159AD9E00B8474A /* MosaicDTO.swift */, + 5F61FEB92159AD9E00B8474A /* Addresses.swift */, + 5F61FEBA2159AD9E00B8474A /* AnnounceTransactionInfoDTO.swift */, + 5F61FEBB2159AD9E00B8474A /* NamespaceInfoDTO.swift */, + 5F61FEBC2159AD9E00B8474A /* NodeInfoDTO.swift */, + 5F61FEBD2159AD9E00B8474A /* NetworkTypeDTO.swift */, + 5F61FEBE2159AD9E00B8474A /* MultisigAccountInfoDTO.swift */, + 5F61FEBF2159AD9E00B8474A /* BlockInfoDTO.swift */, + 5F61FEC02159AD9E00B8474A /* MosaicNameDTO.swift */, + 5F61FEC12159AD9E00B8474A /* MosaicIds.swift */, + 5F61FEC22159AD9E00B8474A /* Multisig.swift */, + 5F61FEC32159AD9E00B8474A /* BlockchainScoreDTO.swift */, + 5F61FEC42159AD9E00B8474A /* MultisigAccountGraphInfoDTO.swift */, + 5F61FEC52159AD9E00B8474A /* BlockchainStorageInfoDTO.swift */, + 5F61FEC62159AD9E00B8474A /* NamespaceDTO.swift */, + 5F61FEC72159AD9E00B8474A /* HeightDTO.swift */, + 5F61FEC82159AD9E00B8474A /* AccountDTO.swift */, + 5F61FEC92159AD9E00B8474A /* BlockDTO.swift */, + 5F61FECA2159AD9E00B8474A /* AccountMetaDTO.swift */, + 5F61FECB2159AD9E00B8474A /* TransactionHashes.swift */, + 5F61FECC2159AD9E00B8474A /* NamespaceMosaicMetaDTO.swift */, + 69057AD954704059B2995E79 /* CosignatureSignedTransactionDTO.swift */, + ); + path = Models; + sourceTree = ""; + }; + 690570C0D0AE8AAFE59513A5 /* infrastructure */ = { + isa = PBXGroup; + children = ( + 6905761CD4312FD3CA2C3BEB /* MosaicHttpTest.swift */, + 69057E67BFC0E3B643B5E17C /* NamespaceHttpTest.swift */, + 69057493B245CAB0C2306BBA /* NetworkHttpTest.swift */, + 69057C9CE30A9606239BF731 /* BlockchainHttpTest.swift */, + 69057B28935D68C52EB927D1 /* AccountHttpTest.swift */, + 690577986A36C1993CD747FC /* TransactionHttpTest.swift */, + 6905748467844716CF50795E /* ListenerTest.swift */, + 69057CB170EBC57EF7ECB04F /* E2ETest.swift */, + ); + path = infrastructure; + sourceTree = ""; + }; + 6905710E82DBACC6FBF89150 /* RHash */ = { + isa = PBXGroup; + children = ( + 6905747BED623BABFD230DF2 /* byte_order.c */, + 69057F67E09559BA07762CD8 /* byte_order.h */, + 69057CF21D8CF0CFCC131070 /* sha3.c */, + 69057A3655CA2D8D6CA65BA2 /* sha3.h */, + ); + path = RHash; + sourceTree = ""; + }; + 690571876FD8BE03EA6CC298 /* crypto */ = { + isa = PBXGroup; + children = ( + 69057E5215C345873DA8F906 /* HashesTest.swift */, + 69057B18BD643365838E5B54 /* PrivateKeyTest.swift */, + 6905776CAA0896B7DF34FF8E /* PublicKeyTest.swift */, + 6905717B170A44286FDCD3EE /* KeyPairTest.swift */, + 690573807F73618DE2D3F615 /* SignerTest.swift */, + ); + path = crypto; + sourceTree = ""; + }; + 6905730C2C368828D5970A36 /* crypto */ = { + isa = PBXGroup; + children = ( + 69057B986E9819C1F7A1D9EC /* Hashes.swift */, + 69057D541467ABFDD4B07B85 /* ed25519 */, + 6905710E82DBACC6FBF89150 /* RHash */, + 690575268C12C3192954B56D /* ed25519_sha3_512.h */, + 69057A6AD12E2FD2FCE8745C /* ed25519_sha3_512.c */, + 690570C6B1960AADEB006D26 /* message_encryption.c */, + 69057B6CAEBB676A1987E43B /* message_encryption.h */, + 6905727D398B6D62B9C61123 /* PrivateKey.swift */, + 69057CDC43DDAFC54C61784E /* PublicKey.swift */, + 6905786C25DE553FF0602CFB /* KeyPair.swift */, + 6905778161C4D97D4AA6479E /* Signer.swift */, + ); + path = crypto; + sourceTree = ""; + }; + 690574409E4E3702D7F38BFC /* model */ = { + isa = PBXGroup; + children = ( + 69057A24F2D96F79D25A0F8C /* mosaic */, + 6905768B7E92A3CD9834FF2D /* account */, + 690579032FEF930DB3FFBDAF /* namespace */, + 690579BCE16647C984E92A35 /* blockchain */, + 69057B0DE87D695713CCA97F /* transaction */, + ); + path = model; + sourceTree = ""; + }; + 690574514698D0854C4E7862 /* utils */ = { + isa = PBXGroup; + children = ( + 690574D23B5D3EBBA29EBFD6 /* Base32Encoder.swift */, + 69057FC60D58BD558D368732 /* HexEncoder.swift */, + 690570E4D59A5A2086AFAD50 /* Numeric+Extension.swift */, + 69057903B1B768C4F7287E6B /* String+Extension.swift */, + 690577DDD4A8A7D4C0C28BFF /* Decimal+Extension.swift */, + ); + path = utils; + sourceTree = ""; + }; + 69057460F3AC1F6878F9FE8C /* namespace */ = { + isa = PBXGroup; + children = ( + 690570DEB9A579F1B95846CB /* NamespaceId.swift */, + 69057B8C64DB61FA9B7752CC /* NamespaceInfo.swift */, + 690579AB7AB64C884EE5C970 /* NamespaceName.swift */, + 69057A5147947B6A7249E913 /* NamespaceType.swift */, + ); + path = namespace; + sourceTree = ""; + }; + 6905767A6C0A443EC865CD83 /* core */ = { + isa = PBXGroup; + children = ( + 69057865C7AD447EF0113CCC /* utils */, + 690571876FD8BE03EA6CC298 /* crypto */, + ); + path = core; + sourceTree = ""; + }; + 6905768B7E92A3CD9834FF2D /* account */ = { + isa = PBXGroup; + children = ( + 6905794CBDD98953113DB2C1 /* AddressTest.swift */, + 69057CF0A24A83C01AE05275 /* PublicAccountTest.swift */, + 690570E50B0F12E595A5FCEE /* AccountTest.swift */, + 69057E61A492377D5DDC3A89 /* MultisigAccountGraphInfoTest.swift */, + 69057059EB3F51166CDC85A9 /* MultisigAccountInfoTest.swift */, + ); + path = account; + sourceTree = ""; + }; + 69057865C7AD447EF0113CCC /* utils */ = { + isa = PBXGroup; + children = ( + 69057E01EBBD0E4B04178344 /* Base32EncoderTest.swift */, + 6905778A1A7626B2A3649380 /* HexEncoderTest.swift */, + ); + path = utils; + sourceTree = ""; + }; + 690579032FEF930DB3FFBDAF /* namespace */ = { + isa = PBXGroup; + children = ( + 6905791348D84FAB2D6DE216 /* NamespaceIdTest.swift */, + 69057075D94E899081F295A2 /* NamespaceInfoTest.swift */, + 690575526BC6A27D1D607A09 /* NamespaceNameTest.swift */, + ); + path = namespace; + sourceTree = ""; + }; + 69057955635505A442EAB3A7 /* account */ = { + isa = PBXGroup; + children = ( + 690575C4F456CE2B0DE840BB /* Account.swift */, + 690574F6552C03CC0EF5EAB9 /* AccountInfo.swift */, + 6905765D80D5647D4973C02B /* Address.swift */, + 69057F59588C03432487D5B4 /* MultisigAccountGraphInfo.swift */, + 690579BB951D521F5A6001BD /* MultisigAccountInfo.swift */, + 69057B2553E3CC5D54EDF17F /* PublicAccount.swift */, + ); + path = account; + sourceTree = ""; + }; + 69057961C08CB429E53ECAC7 /* transaction */ = { + isa = PBXGroup; + children = ( + 69057112997DDD3A4EF8EBC0 /* IdGenerator.swift */, + 69057B947479C8BD8B87D3DA /* Transaction.swift */, + 69057704C467557E62EEB68E /* TransactionType.swift */, + 6905745561E223913D92A755 /* Deadline.swift */, + 6905721FCA75E181EFBA2499 /* TransactionInfo.swift */, + 690574CCC7C029E93E28ED20 /* SignedTransaction.swift */, + 69057491F8A75A07FF9D490A /* TransferTransaction.swift */, + 69057259D73A7A69F8A1F322 /* Message.swift */, + 6905714A099BC3FEDBB0198E /* PlainMessage.swift */, + 6905748F462A3F35A03CE18C /* AggregateTransaction.swift */, + 690579FC955C1EB98FEE7A0F /* AggregateTransactionCosignature.swift */, + 69057C8FF4584C4E8042158C /* CosignatureTransaction.swift */, + 6905790DACEC769A1415FBB9 /* CosignatureSignedTransaction.swift */, + 6905705462C18AB04D3D8645 /* LockFundsTransaction.swift */, + 69057AC723A3A906C6E86F67 /* ModifyMultisigAccountTransaction.swift */, + 690572A284FA3D462A443FAF /* MultisigCosignatoryModification.swift */, + 69057F4F84D5F4ADF0C5B362 /* MultisigCosignatoryModificationType.swift */, + 69057F2F9256F4874417EE94 /* MosaicDefinitionTransaction.swift */, + 690579680D4BBA9D6D539EE3 /* MosaicSupplyChangeTransaction.swift */, + 6905763C5412EC92747DF5FA /* RegisterNamespaceTransaction.swift */, + 69057C4E59A05C27DEF1B5BA /* HashType.swift */, + 6905798BCB6BF7D7B8EE5382 /* SecretLockTransaction.swift */, + 690578533F76934BC08C3D36 /* SecretProofTransaction.swift */, + 690570EBF3B3FB7A421B31A6 /* TransactionMapping.swift */, + 690573498990C169FB7B406B /* TransactionAnnounceResponse.swift */, + 690576C9F957129A821B12C7 /* TransactionStatus.swift */, + 69057A77D2C9D991A73D1E03 /* TransactionStatusError.swift */, + ); + path = transaction; + sourceTree = ""; + }; + 690579BCE16647C984E92A35 /* blockchain */ = { + isa = PBXGroup; + children = ( + 69057B48849993D77A35D369 /* BlockchainStorageInfoTest.swift */, + 69057106C5D72C3CBE9B26E8 /* BlockInfoTest.swift */, + 690570F6F9476E445D8863F4 /* NetworkTypeTest.swift */, + 690578CB485C1A31C05909AD /* BlockchainScore.swift */, + ); + path = blockchain; + sourceTree = ""; + }; + 69057A24F2D96F79D25A0F8C /* mosaic */ = { + isa = PBXGroup; + children = ( + 69057285086811CF9DE548E1 /* MosaicTest.swift */, + 69057EABAF726B84BCAF3C0E /* MosaicIdTest.swift */, + 69057B143B9D53F13373DE2C /* MosaicInfoTest.swift */, + 6905744D8E99947745BD90A1 /* MosaicNameTest.swift */, + 690579C22CC886582EC79684 /* MosaicPropertiesTest.swift */, + ); + path = mosaic; + sourceTree = ""; + }; + 69057AFFC0281CCFF9AF84E1 /* sdk */ = { + isa = PBXGroup; + children = ( + 690570C0D0AE8AAFE59513A5 /* infrastructure */, + 690574409E4E3702D7F38BFC /* model */, + ); + path = sdk; + sourceTree = ""; + }; + 69057B0DE87D695713CCA97F /* transaction */ = { + isa = PBXGroup; + children = ( + 69057453D469CD9EFF86885B /* IdGeneratorTest.swift */, + 6905740FE2D8F4E4B5A59A52 /* DeadlineTest.swift */, + 69057C90F97EEFD8C3366587 /* SignedTransactionTest.swift */, + 690578960B673554899B032C /* TransactionTest.swift */, + 69057D275DF3FC53B0EA3CC3 /* TransactionInfoTest.swift */, + 69057C5C79CEBF378E572E36 /* TransactionTypeTest.swift */, + 69057D00C1636A7080E7ED3E /* FakeTransferTransaction.swift */, + 6905777C6724B5FC491A3509 /* FakeDeadline.swift */, + 69057C96B2D6864C931AA9E6 /* TransferTransactionTest.swift */, + 69057E01E3206A7FEDFC48CF /* AggregateTransactionTest.swift */, + 690571D98FE593C2834416F4 /* AggregateTransactionCosignatureTest.swift */, + 69057D6B6E8E7E6D4EB1F79D /* CosignatureSignedTransactionTest.swift */, + 69057F9BAB23A1951B73643D /* CosignatureTransactionTest.swift */, + 690578FE17F7BDC391CB3BCA /* HashTypeTest.swift */, + 69057169DC67318531BEB86F /* LockFundsTransactionTest.swift */, + 69057F440B33EBC844939D1E /* ModifyMultisigAccountTransactionTest.swift */, + 690572497C2D5276F8440113 /* MosaicDefinitionTransactionTest.swift */, + 690578640B2CB08873F64D9A /* MosaicSupplyChangeTransactionTest.swift */, + 690571C75DE69825A3F1538D /* RegisterNamespaceTransactionTest.swift */, + 69057E566AF82EEF8FE20DEB /* SecretLockTransactionTest.swift */, + 69057174468FF2DD571A303C /* SecretProofTransactionTest.swift */, + 690576952CF286C600952C7A /* TransactionMappingTest.swift */, + ); + path = transaction; + sourceTree = ""; + }; + 69057B36900FE45903EA3FB3 /* mosaic */ = { + isa = PBXGroup; + children = ( + 6905747C5207ED71203E14EE /* Mosaic.swift */, + 69057FABD7E8E143066FF306 /* MosaicId.swift */, + 690576F415BDCEE642C47005 /* MosaicInfo.swift */, + 690572698536339D078FD1A7 /* MosaicProperties.swift */, + 690577C24D98A72C4CB7DF9C /* MosaicSupplyType.swift */, + 69057227F40DF62DB4A43BB1 /* MosaicName.swift */, + 690579EEAA7C75A89014C5D0 /* XEM.swift */, + ); + path = mosaic; + sourceTree = ""; + }; + 69057D541467ABFDD4B07B85 /* ed25519 */ = { + isa = PBXGroup; + children = ( + 6905742B882BD62863EE1875 /* add_scalar.c */, + 6905736F848C7AA310EB90A2 /* ed25519.h */, + 69057D7B2B50EAB2582920B0 /* fe.c */, + 69057A33178694E1F4E98833 /* fe.h */, + 69057E4993F65BFBE906F364 /* fixedint.h */, + 69057585A1423AC754379139 /* ge.c */, + 690571F6E4AB154FB49D7C5A /* ge.h */, + 6905780314E5BC9EE018E3B9 /* key_exchange.c */, + 690577A6DC35F61659405DBC /* keypair.c */, + 69057DF280E0A788B8276B58 /* precomp_data.h */, + 690578507B66793FECBA2F0A /* sc.c */, + 69057BE9C70BB6B774C51628 /* sc.h */, + 690571D15DBE0C8FF2FC78B4 /* seed.c */, + 690576C66F7344706C982A81 /* sha512.c */, + 69057C98F142F0F5055E8D4D /* sha512.h */, + 69057DB5799E9466FABD01E8 /* sign.c */, + 690571F6206682024B1E40D7 /* verify.c */, + ); + path = ed25519; + sourceTree = ""; + }; + 69057FB27C4F634790F42601 /* blockchain */ = { + isa = PBXGroup; + children = ( + 69057EF4745A4EE9E9E48B4F /* NetworkType.swift */, + 690572C25E25A10F98A7624A /* BlockchainStorageInfo.swift */, + 6905761A15DCC442C8F7F8D0 /* BlockInfo.swift */, + ); + path = blockchain; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 5F61FE742159AC0500B8474A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F61FE8A2159AC0500B8474A /* Nem2SdkSwift.h in Headers */, + 69057D0F2E49B31CC09595B0 /* ed25519.h in Headers */, + 69057A1C7440FF0B548E8471 /* ed25519_sha3_512.h in Headers */, + 690579B6D160A101638B413F /* message_encryption.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 5F61FE782159AC0500B8474A /* Nem2SdkSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5F61FE8D2159AC0500B8474A /* Build configuration list for PBXNativeTarget "Nem2SdkSwift" */; + buildPhases = ( + 5F61FE742159AC0500B8474A /* Headers */, + 5F61FE752159AC0500B8474A /* Sources */, + 5F61FE762159AC0500B8474A /* Frameworks */, + 5F61FE772159AC0500B8474A /* Resources */, + 5F61FE962159AD3E00B8474A /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Nem2SdkSwift; + productName = Nem2SdkSwift; + productReference = 5F61FE792159AC0500B8474A /* Nem2SdkSwift.framework */; + productType = "com.apple.product-type.framework"; + }; + 5F61FE812159AC0500B8474A /* Nem2SdkSwiftTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5F61FE902159AC0500B8474A /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftTests" */; + buildPhases = ( + 5F61FE7E2159AC0500B8474A /* Sources */, + 5F61FE7F2159AC0500B8474A /* Frameworks */, + 5F61FE802159AC0500B8474A /* Resources */, + 5F8EA5EB2160A6A900646E6E /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 5F61FE852159AC0500B8474A /* PBXTargetDependency */, + ); + name = Nem2SdkSwiftTests; + productName = Nem2SdkSwiftTests; + productReference = 5F61FE822159AC0500B8474A /* Nem2SdkSwiftTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5F61FE702159AC0500B8474A /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1000; + LastUpgradeCheck = 1000; + ORGANIZATIONNAME = "ProximaX Limited"; + TargetAttributes = { + 5F61FE782159AC0500B8474A = { + CreatedOnToolsVersion = 10.0; + }; + 5F61FE812159AC0500B8474A = { + CreatedOnToolsVersion = 10.0; + }; + }; + }; + buildConfigurationList = 5F61FE732159AC0500B8474A /* Build configuration list for PBXProject "Nem2SdkSwift" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 5F61FE6F2159AC0500B8474A; + productRefGroup = 5F61FE7A2159AC0500B8474A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5F61FE782159AC0500B8474A /* Nem2SdkSwift */, + 5F61FE812159AC0500B8474A /* Nem2SdkSwiftTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 5F61FE772159AC0500B8474A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5F61FE802159AC0500B8474A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 5F61FE962159AD3E00B8474A /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework", + "$(SRCROOT)/Carthage/Build/iOS/CryptoSwift.framework", + "$(SRCROOT)/Carthage/Build/iOS/RxSwift.framework", + "$(SRCROOT)/Carthage/Build/iOS/Starscream.framework", + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; + }; + 5F8EA5EB2160A6A900646E6E /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/RxBlocking.framework", + "$(SRCROOT)/Carthage/Build/iOS/RxTest.framework", + "$(SRCROOT)/Carthage/Build/iOS/RxSwift.framework", + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 5F61FE752159AC0500B8474A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F61FED62159AD9E00B8474A /* BlockchainRoutesAPI.swift in Sources */, + 5F61FEF22159AD9E00B8474A /* BlockInfoDTO.swift in Sources */, + 5F61FED22159AD9E00B8474A /* AlamofireImplementations.swift in Sources */, + 5F61FEFC2159AD9E00B8474A /* BlockDTO.swift in Sources */, + 5F61FEF02159AD9E00B8474A /* NetworkTypeDTO.swift in Sources */, + 5F61FEF62159AD9E00B8474A /* BlockchainScoreDTO.swift in Sources */, + 5F61FEED2159AD9E00B8474A /* AnnounceTransactionInfoDTO.swift in Sources */, + 5F61FEDB2159AD9E00B8474A /* JSONEncodableEncoding.swift in Sources */, + 5F61FEE72159AD9E00B8474A /* MosaicDefinitionDTO.swift in Sources */, + 5F61FEE42159AD9E00B8474A /* TransactionPayload.swift in Sources */, + 5F61FED52159AD9E00B8474A /* AccountRoutesAPI.swift in Sources */, + 5F61FEDE2159AD9E00B8474A /* NodeTimeDTO.swift in Sources */, + 5F61FEDD2159AD9E00B8474A /* AnyObjectDictionary.swift in Sources */, + 5F61FEFA2159AD9E00B8474A /* HeightDTO.swift in Sources */, + 5F61FEF72159AD9E00B8474A /* MultisigAccountGraphInfoDTO.swift in Sources */, + 5F61FF012159AD9E00B8474A /* JSONEncodingHelper.swift in Sources */, + 5F61FEE62159AD9E00B8474A /* CommunicationTimestamps.swift in Sources */, + 5F61FEE92159AD9E00B8474A /* MosaicPropertiesDTO.swift in Sources */, + 5F61FEFB2159AD9E00B8474A /* AccountDTO.swift in Sources */, + 5F61FED12159AD9E00B8474A /* APIHelper.swift in Sources */, + 5F61FEE12159AD9E00B8474A /* NamespaceIds.swift in Sources */, + 5F61FEFE2159AD9E00B8474A /* TransactionHashes.swift in Sources */, + 5F61FEFD2159AD9E00B8474A /* AccountMetaDTO.swift in Sources */, + 5F61FEDF2159AD9E00B8474A /* NamespaceNameDTO.swift in Sources */, + 5F61FEEA2159AD9E00B8474A /* UInt64DTO.swift in Sources */, + 5F61FED82159AD9E00B8474A /* NamespaceRoutesAPI.swift in Sources */, + 5F61FEEF2159AD9E00B8474A /* NodeInfoDTO.swift in Sources */, + 5F61FF032159AD9E00B8474A /* Configuration.swift in Sources */, + 5F61FED32159AD9E00B8474A /* NetworkRoutesAPI.swift in Sources */, + 5F61FED92159AD9E00B8474A /* NodeRoutesAPI.swift in Sources */, + 5F61FEFF2159AD9E00B8474A /* NamespaceMosaicMetaDTO.swift in Sources */, + 5F61FEE22159AD9E00B8474A /* TransactionStatusDTO.swift in Sources */, + 5F61FEE32159AD9E00B8474A /* MosaicInfoDTO.swift in Sources */, + 5F61FED42159AD9E00B8474A /* TransactionRoutesAPI.swift in Sources */, + 5F61FEEC2159AD9E00B8474A /* Addresses.swift in Sources */, + 5F61FEF92159AD9E00B8474A /* NamespaceDTO.swift in Sources */, + 5F61FEF12159AD9E00B8474A /* MultisigAccountInfoDTO.swift in Sources */, + 5F61FEF42159AD9E00B8474A /* MosaicIds.swift in Sources */, + 5F61FEDA2159AD9E00B8474A /* CodableHelper.swift in Sources */, + 5F61FEEE2159AD9E00B8474A /* NamespaceInfoDTO.swift in Sources */, + 5F61FEF82159AD9E00B8474A /* BlockchainStorageInfoDTO.swift in Sources */, + 5F61FEDC2159AD9E00B8474A /* APIs.swift in Sources */, + 5F61FEEB2159AD9E00B8474A /* MosaicDTO.swift in Sources */, + 5F61FED72159AD9E00B8474A /* MosaicRoutesAPI.swift in Sources */, + 5F61FEE82159AD9E00B8474A /* TransactionIds.swift in Sources */, + 5F61FF002159AD9E00B8474A /* Extensions.swift in Sources */, + 5F61FEE52159AD9E00B8474A /* BlockMetaDTO.swift in Sources */, + 5F61FEF52159AD9E00B8474A /* Multisig.swift in Sources */, + 5F61FEE02159AD9E00B8474A /* AccountInfoDTO.swift in Sources */, + 5F61FEF32159AD9E00B8474A /* MosaicNameDTO.swift in Sources */, + 5F61FF022159AD9E00B8474A /* Models.swift in Sources */, + 69057A2E7F3D991F58E95D23 /* Account.swift in Sources */, + 69057169165CE2A41BCFF2E9 /* AccountInfo.swift in Sources */, + 69057D3BE1557B1F1E38914C /* Address.swift in Sources */, + 6905765B3730216B7035EE78 /* MultisigAccountGraphInfo.swift in Sources */, + 69057BF4D0ECEF89260E673F /* MultisigAccountInfo.swift in Sources */, + 690579C173A1DBEE6D650C7F /* PublicAccount.swift in Sources */, + 6905707DFE4005C3F155E9A8 /* NetworkType.swift in Sources */, + 69057A144EE166DAE2A8DE5D /* Nem2SdkSwiftError.swift in Sources */, + 6905760FA2663ACD2C428267 /* Base32Encoder.swift in Sources */, + 6905744C5E59424E1B8E30C5 /* Hashes.swift in Sources */, + 690577369B0D00F3C8885071 /* HexEncoder.swift in Sources */, + 690576ED0B81AB07E6B8C935 /* add_scalar.c in Sources */, + 69057B67B08B2462FFEFEFA2 /* fe.c in Sources */, + 690575796DD68942C15AF494 /* ge.c in Sources */, + 69057C19F9EEA2513D5CAC0F /* key_exchange.c in Sources */, + 69057CA6BB9D31967EC30EE3 /* keypair.c in Sources */, + 69057895794CBA66D7EE0AB9 /* sc.c in Sources */, + 69057D404705F2E8FF1790C7 /* seed.c in Sources */, + 69057FA7EC3B64EDB33652C5 /* sha512.c in Sources */, + 69057B85703781CD0AF796B3 /* sign.c in Sources */, + 690577C701CCC94FFAF9C92E /* verify.c in Sources */, + 6905752B85432CD893B0D8B3 /* byte_order.c in Sources */, + 690577CF6F8C4E087A23297F /* sha3.c in Sources */, + 690576F420062D3140689D3C /* ed25519_sha3_512.c in Sources */, + 69057FA6DCF028E773F08792 /* message_encryption.c in Sources */, + 690574BC29D8CE86112D79CC /* PrivateKey.swift in Sources */, + 69057A1FE9C98DE61F472095 /* PublicKey.swift in Sources */, + 69057ACB1B528C924DDAD14E /* KeyPair.swift in Sources */, + 6905731A7A6BC6972598E8C2 /* MosaicId.swift in Sources */, + 69057F7DAFEDDA4F609E9783 /* Mosaic.swift in Sources */, + 690574500C2D312CE09E7D11 /* IdGenerator.swift in Sources */, + 69057D1CFD6F2D5D44DFE8AF /* Numeric+Extension.swift in Sources */, + 69057955EB51C8A7E7CDE39F /* String+Extension.swift in Sources */, + 690578A61795D61A9DB9F71E /* BlockchainStorageInfo.swift in Sources */, + 690579DFCC752F4D1AF2BB48 /* BlockInfo.swift in Sources */, + 6905716CDCE4B3592D7A1EE8 /* MosaicInfo.swift in Sources */, + 690576D77B2D9A4A6B0040BB /* MosaicProperties.swift in Sources */, + 6905751D70865C6A49F707F7 /* MosaicSupplyType.swift in Sources */, + 69057CCCF623E80286DB26D9 /* MosaicName.swift in Sources */, + 69057881F0609A832C74C18D /* XEM.swift in Sources */, + 6905736C1D5AD18B8443461F /* Decimal+Extension.swift in Sources */, + 69057E8DB2FE49313966D99C /* NamespaceId.swift in Sources */, + 690571F613861BE679D2F026 /* NamespaceInfo.swift in Sources */, + 6905786C788E2DCAA0F0F8BF /* NamespaceName.swift in Sources */, + 6905776915E1DA81B48FFD9E /* NamespaceType.swift in Sources */, + 6905758CEDF305960798CF80 /* MosaicRepository.swift in Sources */, + 6905712ED91755C61C3ACDE1 /* MosaicHttp.swift in Sources */, + 690570A45B9E1DCDC2351EA4 /* RawAPIExtensions.swift in Sources */, + 69057911FA4937B511DEC16F /* Http.swift in Sources */, + 6905777F73EC126E473FE6D0 /* NetworkRepository.swift in Sources */, + 69057EDADC61DA7FD86F9C6F /* NetworkHttp.swift in Sources */, + 69057344AE8173DE1D4AB319 /* NamespaceRepository.swift in Sources */, + 690570AD49E092E74FCD352C /* NamespaceHttp.swift in Sources */, + 69057EA6D18D682EF81DAC6D /* Transaction.swift in Sources */, + 69057DC28F2E9D5E5C60AA8F /* TransactionType.swift in Sources */, + 69057C5A5902BB81585F803F /* Deadline.swift in Sources */, + 69057E98E47E071C0FE45AC0 /* TransactionInfo.swift in Sources */, + 690576921440AA6891AC0C14 /* SignedTransaction.swift in Sources */, + 69057F1BA311F9003BEC12A5 /* Signer.swift in Sources */, + 690576E5ACDB3BED7B4968F3 /* TransferTransaction.swift in Sources */, + 69057119B0E777FF9ED0584A /* Message.swift in Sources */, + 690570C1362F8435E2C917A6 /* PlainMessage.swift in Sources */, + 69057EEFB64914C1EF95AE57 /* AggregateTransaction.swift in Sources */, + 6905796228E78B3FAFF0E471 /* AggregateTransactionCosignature.swift in Sources */, + 69057501D968DE546B20BCFC /* CosignatureTransaction.swift in Sources */, + 69057B4AED0A7AE37E8B96E8 /* CosignatureSignedTransaction.swift in Sources */, + 690578F7868235C726FCC5E5 /* LockFundsTransaction.swift in Sources */, + 69057F7D8CF4426BBBCF3DF1 /* ModifyMultisigAccountTransaction.swift in Sources */, + 690578175F9E3E02D84D1256 /* MultisigCosignatoryModification.swift in Sources */, + 6905711BFC742B753C83B64C /* MultisigCosignatoryModificationType.swift in Sources */, + 69057DE51AB6D5E3214C501C /* MosaicDefinitionTransaction.swift in Sources */, + 69057B4A534509165833518E /* MosaicSupplyChangeTransaction.swift in Sources */, + 69057CDF383F3B7847470D13 /* RegisterNamespaceTransaction.swift in Sources */, + 690579C41DE2FBEBE4877A34 /* HashType.swift in Sources */, + 690576B7783EE70CCD6E601A /* SecretLockTransaction.swift in Sources */, + 690578A7AA0CBA81E10537C0 /* SecretProofTransaction.swift in Sources */, + 690577C03BF283D9B8DBA2BE /* BlockchainRepository.swift in Sources */, + 690574853CB166EF4A274535 /* BlockchainHttp.swift in Sources */, + 690572088D906FDE88F78551 /* TransactionMapping.swift in Sources */, + 690575625593C7101D45D0CD /* BlockchainScore.swift in Sources */, + 69057CF0A56ECAFB37A4D3AE /* AccountRepository.swift in Sources */, + 6905746FE8393463A2CC1401 /* AccountHttp.swift in Sources */, + 69057CA71B5AE801F35D7813 /* TransactionRepository.swift in Sources */, + 69057B4D39C7C192615AFAD3 /* TransactionAnnounceResponse.swift in Sources */, + 69057A0E1B4ADA22B045E3ED /* TransactionStatus.swift in Sources */, + 6905763DA5F52364EB1F9954 /* TransactionHttp.swift in Sources */, + 69057DE9A6BAD91AC56E9CC6 /* CosignatureSignedTransactionDTO.swift in Sources */, + 69057D9E0777B1B15E032836 /* ListenerChannel.swift in Sources */, + 690578DC1FFC70B977280598 /* ListenerMessage.swift in Sources */, + 690579BAE0072106A6F98357 /* ListenerSubscribeMessage.swift in Sources */, + 6905725E13CC6B0645DF993F /* Listener.swift in Sources */, + 6905743441495CA4AA95419B /* TransactionStatusError.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5F61FE7E2159AC0500B8474A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F61FE882159AC0500B8474A /* Nem2SdkSwiftTests.swift in Sources */, + 690578656C085ED0408065AB /* Base32EncoderTest.swift in Sources */, + 69057A04191653530E655848 /* HashesTest.swift in Sources */, + 5F61FF12215C55DC00B8474A /* TestUtils.swift in Sources */, + 69057D3069176BD1444289EA /* HexEncoderTest.swift in Sources */, + 69057F8BD40A9F0FFE782005 /* AddressTest.swift in Sources */, + 690579F68338840EB8877801 /* ParameterizedTest.swift in Sources */, + 6905764928DE197A9ABFEB22 /* PrivateKeyTest.swift in Sources */, + 690575C5CC6A71EB4D7CB440 /* PublicKeyTest.swift in Sources */, + 6905763E13F92E7E44871AEA /* KeyPairTest.swift in Sources */, + 690571CC6E2EB69D74777661 /* PublicAccountTest.swift in Sources */, + 69057DADB6E41E6CBB3DA896 /* AccountTest.swift in Sources */, + 690579B343735F615A048C0A /* IdGeneratorTest.swift in Sources */, + 690578097FDE3E9D88C73B5A /* MosaicTest.swift in Sources */, + 69057A1FEC9163D276D20F2F /* MosaicIdTest.swift in Sources */, + 69057A0725F52E7C440AB07A /* MultisigAccountGraphInfoTest.swift in Sources */, + 69057A527FC48129AB210E31 /* MultisigAccountInfoTest.swift in Sources */, + 69057574D65C44B3466A1CCE /* BlockchainStorageInfoTest.swift in Sources */, + 690577AF1346838F42290579 /* BlockInfoTest.swift in Sources */, + 690579294EE5BF590E3403D3 /* NetworkTypeTest.swift in Sources */, + 6905723DCFF220EE4753B17A /* MosaicInfoTest.swift in Sources */, + 69057F1BAC45C87BFCC098D4 /* MosaicNameTest.swift in Sources */, + 690575DA99588DFB0859B21F /* MosaicPropertiesTest.swift in Sources */, + 69057A38B9CF581D1A14FB10 /* NamespaceIdTest.swift in Sources */, + 69057AFFAD182ECCE918C383 /* NamespaceInfoTest.swift in Sources */, + 69057CB77D0053A4FD639A7F /* NamespaceNameTest.swift in Sources */, + 69057142A9B5FD77BE8C7498 /* MosaicHttpTest.swift in Sources */, + 69057A0C557391ED4AA0735F /* TestSettings.swift in Sources */, + 69057B6789E7B5D59CD8C3CE /* NamespaceHttpTest.swift in Sources */, + 69057E801BCC4D03090A7357 /* NetworkHttpTest.swift in Sources */, + 690572D82DDFC6C150ECD1E6 /* SignerTest.swift in Sources */, + 6905768012569566BD4B413E /* DeadlineTest.swift in Sources */, + 6905741E1CDBEF0B9E6111B4 /* SignedTransactionTest.swift in Sources */, + 690572E36477A0B1AE1A365B /* TransactionTest.swift in Sources */, + 6905707ACA9A77378D1A47D9 /* TransactionInfoTest.swift in Sources */, + 69057A55CB73538238ACD2EB /* TransactionTypeTest.swift in Sources */, + 6905728A6826D6513BB2F206 /* FakeTransferTransaction.swift in Sources */, + 69057B07426B57FF6B08D44C /* FakeDeadline.swift in Sources */, + 69057E7ACCD2B4301FD105C4 /* TransferTransactionTest.swift in Sources */, + 69057E4E2B2D43A649020ED7 /* AggregateTransactionTest.swift in Sources */, + 69057AD1AF6C6CB6D9BE4343 /* AggregateTransactionCosignatureTest.swift in Sources */, + 69057E14922B35EB7F984CB4 /* CosignatureSignedTransactionTest.swift in Sources */, + 690572AA0C8BAFFF13D257FA /* CosignatureTransactionTest.swift in Sources */, + 690577144A706221CF8EFA11 /* HashTypeTest.swift in Sources */, + 690572CE2E26CB412508D639 /* LockFundsTransactionTest.swift in Sources */, + 69057ED783CDF83A7E8A5F25 /* ModifyMultisigAccountTransactionTest.swift in Sources */, + 6905791F0E8D111544ED527F /* MosaicDefinitionTransactionTest.swift in Sources */, + 69057AB849308CAA4E7DD2CA /* MosaicSupplyChangeTransactionTest.swift in Sources */, + 69057EA042EF6830A7A82E22 /* RegisterNamespaceTransactionTest.swift in Sources */, + 690570C6893D95C6AD8C1750 /* SecretLockTransactionTest.swift in Sources */, + 69057CAB8FFE1053A2288C22 /* SecretProofTransactionTest.swift in Sources */, + 69057117FE6F184A63D7CC32 /* TransactionMappingTest.swift in Sources */, + 6905770438D8C8BD7BBD8C5D /* BlockchainHttpTest.swift in Sources */, + 69057742D05FD7E4D5847E36 /* AccountHttpTest.swift in Sources */, + 69057EC66807922AE0512EEC /* TransactionHttpTest.swift in Sources */, + 6905727C1C4672097466B0E7 /* ListenerTest.swift in Sources */, + 690575368C10C935E11C43E3 /* E2ETest.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 5F61FE852159AC0500B8474A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5F61FE782159AC0500B8474A /* Nem2SdkSwift */; + targetProxy = 5F61FE842159AC0500B8474A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 5F61FE8B2159AC0500B8474A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 5F61FE8C2159AC0500B8474A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 5F61FE8E2159AC0500B8474A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Nem2SdkSwift/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwift; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Nem2SdkSwift/core/crypto"; + }; + name = Debug; + }; + 5F61FE8F2159AC0500B8474A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Nem2SdkSwift/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwift; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Nem2SdkSwift/core/crypto"; + }; + name = Release; + }; + 5F61FE912159AC0500B8474A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Nem2SdkSwiftTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 5F61FE922159AC0500B8474A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Nem2SdkSwiftTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5F61FE732159AC0500B8474A /* Build configuration list for PBXProject "Nem2SdkSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5F61FE8B2159AC0500B8474A /* Debug */, + 5F61FE8C2159AC0500B8474A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5F61FE8D2159AC0500B8474A /* Build configuration list for PBXNativeTarget "Nem2SdkSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5F61FE8E2159AC0500B8474A /* Debug */, + 5F61FE8F2159AC0500B8474A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5F61FE902159AC0500B8474A /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5F61FE912159AC0500B8474A /* Debug */, + 5F61FE922159AC0500B8474A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5F61FE702159AC0500B8474A /* Project object */; +} diff --git a/Nem2SdkSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Nem2SdkSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..b7c2d29 --- /dev/null +++ b/Nem2SdkSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Nem2SdkSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Nem2SdkSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Nem2SdkSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Nem2SdkSwift.xcodeproj/xcshareddata/xcschemes/Nem2SdkSwift.xcscheme b/Nem2SdkSwift.xcodeproj/xcshareddata/xcschemes/Nem2SdkSwift.xcscheme new file mode 100644 index 0000000..716363c --- /dev/null +++ b/Nem2SdkSwift.xcodeproj/xcshareddata/xcschemes/Nem2SdkSwift.xcscheme @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nem2SdkSwift/Info.plist b/Nem2SdkSwift/Info.plist new file mode 100644 index 0000000..e1fe4cf --- /dev/null +++ b/Nem2SdkSwift/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/Nem2SdkSwift/Nem2SdkSwift.h b/Nem2SdkSwift/Nem2SdkSwift.h new file mode 100644 index 0000000..135ba43 --- /dev/null +++ b/Nem2SdkSwift/Nem2SdkSwift.h @@ -0,0 +1,18 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +#import + +//! Project version number for Nem2SdkSwift. +FOUNDATION_EXPORT double Nem2SdkSwiftVersionNumber; + +//! Project version string for Nem2SdkSwift. +FOUNDATION_EXPORT const unsigned char Nem2SdkSwiftVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + +#import "ed25519_sha3_512.h" +#import "ed25519.h" +#import "message_encryption.h" diff --git a/Nem2SdkSwift/core/Nem2SdkSwiftError.swift b/Nem2SdkSwift/core/Nem2SdkSwiftError.swift new file mode 100644 index 0000000..5701c13 --- /dev/null +++ b/Nem2SdkSwift/core/Nem2SdkSwiftError.swift @@ -0,0 +1,20 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +/// Errors from Nem2SdkSwift +public enum Nem2SdkSwiftError: Error { + /// An argument of the API is invalid. + case illegalArgument(String) + /// A network error + case networkError + /// A response error + case responseError(Int, String?) + /// A parse error + case parseError(String) + /// A serialize error + case serializeError(String) +} \ No newline at end of file diff --git a/Nem2SdkSwift/core/crypto/Hashes.swift b/Nem2SdkSwift/core/crypto/Hashes.swift new file mode 100644 index 0000000..673262e --- /dev/null +++ b/Nem2SdkSwift/core/crypto/Hashes.swift @@ -0,0 +1,404 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import CryptoSwift +import CommonCrypto + +/// Static class that exposes hash functions. +public class Hashes { + // MARK: Methods + /** + * Performs a SHA3-256 hash of the inputs. + * + * - parameter inputs: The byte arrays to hash. + * - returns: The hash of the inputs. + */ + public static func sha3_256(_ inputs: [UInt8]) -> [UInt8] { + return Data(bytes: inputs).sha3(.sha256).bytes + } + + /** + * Performs a SHA3-512 hash of the inputs. + * + * - parameter inputs: The byte arrays to hash. + * - returns: The hash of the inputs. + */ + public static func sha3_512(_ inputs: [UInt8]) -> [UInt8] { + return Data(bytes: inputs).sha3(.sha512).bytes + } + + /** + * Performs a RIPEMD160 hash of the inputs. + * + * - parameter inputs: The byte arrays to hash. + * - returns: The hash of the inputs. + */ + public static func ripemd160(_ inputs: [UInt8]) -> [UInt8] { + var hash = RIPEMD160() + hash.update(data: Data(bytes: inputs)) + return hash.finalize().bytes + } +} + +private struct RIPEMD160 { + + private var MDbuf: (UInt32, UInt32, UInt32, UInt32, UInt32) + private var buffer: Data + private var count: Int64 // Total # of bytes processed. + + public init() { + MDbuf = (0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0) + buffer = Data() + count = 0 + } + + private mutating func compress(_ X: UnsafePointer) { + + // *** Helper functions (originally macros in rmd160.h) *** + + /* ROL(x, n) cyclically rotates x over n bits to the left */ + /* x must be of an unsigned 32 bits type and 0 <= n < 32. */ + func ROL(_ x: UInt32, _ n: UInt32) -> UInt32 { + return (x << n) | ( x >> (32 - n)) + } + + /* the five basic functions F(), G() and H() */ + + func F(_ x: UInt32, _ y: UInt32, _ z: UInt32) -> UInt32 { + return x ^ y ^ z + } + + func G(_ x: UInt32, _ y: UInt32, _ z: UInt32) -> UInt32 { + return (x & y) | (~x & z) + } + + func H(_ x: UInt32, _ y: UInt32, _ z: UInt32) -> UInt32 { + return (x | ~y) ^ z + } + + func I(_ x: UInt32, _ y: UInt32, _ z: UInt32) -> UInt32 { + return (x & z) | (y & ~z) + } + + func J(_ x: UInt32, _ y: UInt32, _ z: UInt32) -> UInt32 { + return x ^ (y | ~z) + } + + /* the ten basic operations FF() through III() */ + + func FF(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ F(b, c, d) &+ x + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func GG(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ G(b, c, d) &+ x &+ 0x5a827999 + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func HH(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ H(b, c, d) &+ x &+ 0x6ed9eba1 + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func II(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ I(b, c, d) &+ x &+ 0x8f1bbcdc + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func JJ(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ J(b, c, d) &+ x &+ 0xa953fd4e + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func FFF(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ F(b, c, d) &+ x + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func GGG(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ G(b, c, d) &+ x &+ 0x7a6d76e9 + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func HHH(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ H(b, c, d) &+ x &+ 0x6d703ef3 + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func III(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ I(b, c, d) &+ x &+ 0x5c4dd124 + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + func JJJ(_ a: inout UInt32, _ b: UInt32, _ c: inout UInt32, _ d: UInt32, _ e: UInt32, _ x: UInt32, _ s: UInt32) { + a = a &+ J(b, c, d) &+ x &+ 0x50a28be6 + a = ROL(a, s) &+ e + c = ROL(c, 10) + } + + // *** The function starts here *** + + var (aa, bb, cc, dd, ee) = MDbuf + var (aaa, bbb, ccc, ddd, eee) = MDbuf + + /* round 1 */ + FF(&aa, bb, &cc, dd, ee, X[ 0], 11) + FF(&ee, aa, &bb, cc, dd, X[ 1], 14) + FF(&dd, ee, &aa, bb, cc, X[ 2], 15) + FF(&cc, dd, &ee, aa, bb, X[ 3], 12) + FF(&bb, cc, &dd, ee, aa, X[ 4], 5) + FF(&aa, bb, &cc, dd, ee, X[ 5], 8) + FF(&ee, aa, &bb, cc, dd, X[ 6], 7) + FF(&dd, ee, &aa, bb, cc, X[ 7], 9) + FF(&cc, dd, &ee, aa, bb, X[ 8], 11) + FF(&bb, cc, &dd, ee, aa, X[ 9], 13) + FF(&aa, bb, &cc, dd, ee, X[10], 14) + FF(&ee, aa, &bb, cc, dd, X[11], 15) + FF(&dd, ee, &aa, bb, cc, X[12], 6) + FF(&cc, dd, &ee, aa, bb, X[13], 7) + FF(&bb, cc, &dd, ee, aa, X[14], 9) + FF(&aa, bb, &cc, dd, ee, X[15], 8) + + /* round 2 */ + GG(&ee, aa, &bb, cc, dd, X[ 7], 7) + GG(&dd, ee, &aa, bb, cc, X[ 4], 6) + GG(&cc, dd, &ee, aa, bb, X[13], 8) + GG(&bb, cc, &dd, ee, aa, X[ 1], 13) + GG(&aa, bb, &cc, dd, ee, X[10], 11) + GG(&ee, aa, &bb, cc, dd, X[ 6], 9) + GG(&dd, ee, &aa, bb, cc, X[15], 7) + GG(&cc, dd, &ee, aa, bb, X[ 3], 15) + GG(&bb, cc, &dd, ee, aa, X[12], 7) + GG(&aa, bb, &cc, dd, ee, X[ 0], 12) + GG(&ee, aa, &bb, cc, dd, X[ 9], 15) + GG(&dd, ee, &aa, bb, cc, X[ 5], 9) + GG(&cc, dd, &ee, aa, bb, X[ 2], 11) + GG(&bb, cc, &dd, ee, aa, X[14], 7) + GG(&aa, bb, &cc, dd, ee, X[11], 13) + GG(&ee, aa, &bb, cc, dd, X[ 8], 12) + + /* round 3 */ + HH(&dd, ee, &aa, bb, cc, X[ 3], 11) + HH(&cc, dd, &ee, aa, bb, X[10], 13) + HH(&bb, cc, &dd, ee, aa, X[14], 6) + HH(&aa, bb, &cc, dd, ee, X[ 4], 7) + HH(&ee, aa, &bb, cc, dd, X[ 9], 14) + HH(&dd, ee, &aa, bb, cc, X[15], 9) + HH(&cc, dd, &ee, aa, bb, X[ 8], 13) + HH(&bb, cc, &dd, ee, aa, X[ 1], 15) + HH(&aa, bb, &cc, dd, ee, X[ 2], 14) + HH(&ee, aa, &bb, cc, dd, X[ 7], 8) + HH(&dd, ee, &aa, bb, cc, X[ 0], 13) + HH(&cc, dd, &ee, aa, bb, X[ 6], 6) + HH(&bb, cc, &dd, ee, aa, X[13], 5) + HH(&aa, bb, &cc, dd, ee, X[11], 12) + HH(&ee, aa, &bb, cc, dd, X[ 5], 7) + HH(&dd, ee, &aa, bb, cc, X[12], 5) + + /* round 4 */ + II(&cc, dd, &ee, aa, bb, X[ 1], 11) + II(&bb, cc, &dd, ee, aa, X[ 9], 12) + II(&aa, bb, &cc, dd, ee, X[11], 14) + II(&ee, aa, &bb, cc, dd, X[10], 15) + II(&dd, ee, &aa, bb, cc, X[ 0], 14) + II(&cc, dd, &ee, aa, bb, X[ 8], 15) + II(&bb, cc, &dd, ee, aa, X[12], 9) + II(&aa, bb, &cc, dd, ee, X[ 4], 8) + II(&ee, aa, &bb, cc, dd, X[13], 9) + II(&dd, ee, &aa, bb, cc, X[ 3], 14) + II(&cc, dd, &ee, aa, bb, X[ 7], 5) + II(&bb, cc, &dd, ee, aa, X[15], 6) + II(&aa, bb, &cc, dd, ee, X[14], 8) + II(&ee, aa, &bb, cc, dd, X[ 5], 6) + II(&dd, ee, &aa, bb, cc, X[ 6], 5) + II(&cc, dd, &ee, aa, bb, X[ 2], 12) + + /* round 5 */ + JJ(&bb, cc, &dd, ee, aa, X[ 4], 9) + JJ(&aa, bb, &cc, dd, ee, X[ 0], 15) + JJ(&ee, aa, &bb, cc, dd, X[ 5], 5) + JJ(&dd, ee, &aa, bb, cc, X[ 9], 11) + JJ(&cc, dd, &ee, aa, bb, X[ 7], 6) + JJ(&bb, cc, &dd, ee, aa, X[12], 8) + JJ(&aa, bb, &cc, dd, ee, X[ 2], 13) + JJ(&ee, aa, &bb, cc, dd, X[10], 12) + JJ(&dd, ee, &aa, bb, cc, X[14], 5) + JJ(&cc, dd, &ee, aa, bb, X[ 1], 12) + JJ(&bb, cc, &dd, ee, aa, X[ 3], 13) + JJ(&aa, bb, &cc, dd, ee, X[ 8], 14) + JJ(&ee, aa, &bb, cc, dd, X[11], 11) + JJ(&dd, ee, &aa, bb, cc, X[ 6], 8) + JJ(&cc, dd, &ee, aa, bb, X[15], 5) + JJ(&bb, cc, &dd, ee, aa, X[13], 6) + + /* parallel round 1 */ + JJJ(&aaa, bbb, &ccc, ddd, eee, X[ 5], 8) + JJJ(&eee, aaa, &bbb, ccc, ddd, X[14], 9) + JJJ(&ddd, eee, &aaa, bbb, ccc, X[ 7], 9) + JJJ(&ccc, ddd, &eee, aaa, bbb, X[ 0], 11) + JJJ(&bbb, ccc, &ddd, eee, aaa, X[ 9], 13) + JJJ(&aaa, bbb, &ccc, ddd, eee, X[ 2], 15) + JJJ(&eee, aaa, &bbb, ccc, ddd, X[11], 15) + JJJ(&ddd, eee, &aaa, bbb, ccc, X[ 4], 5) + JJJ(&ccc, ddd, &eee, aaa, bbb, X[13], 7) + JJJ(&bbb, ccc, &ddd, eee, aaa, X[ 6], 7) + JJJ(&aaa, bbb, &ccc, ddd, eee, X[15], 8) + JJJ(&eee, aaa, &bbb, ccc, ddd, X[ 8], 11) + JJJ(&ddd, eee, &aaa, bbb, ccc, X[ 1], 14) + JJJ(&ccc, ddd, &eee, aaa, bbb, X[10], 14) + JJJ(&bbb, ccc, &ddd, eee, aaa, X[ 3], 12) + JJJ(&aaa, bbb, &ccc, ddd, eee, X[12], 6) + + /* parallel round 2 */ + III(&eee, aaa, &bbb, ccc, ddd, X[ 6], 9) + III(&ddd, eee, &aaa, bbb, ccc, X[11], 13) + III(&ccc, ddd, &eee, aaa, bbb, X[ 3], 15) + III(&bbb, ccc, &ddd, eee, aaa, X[ 7], 7) + III(&aaa, bbb, &ccc, ddd, eee, X[ 0], 12) + III(&eee, aaa, &bbb, ccc, ddd, X[13], 8) + III(&ddd, eee, &aaa, bbb, ccc, X[ 5], 9) + III(&ccc, ddd, &eee, aaa, bbb, X[10], 11) + III(&bbb, ccc, &ddd, eee, aaa, X[14], 7) + III(&aaa, bbb, &ccc, ddd, eee, X[15], 7) + III(&eee, aaa, &bbb, ccc, ddd, X[ 8], 12) + III(&ddd, eee, &aaa, bbb, ccc, X[12], 7) + III(&ccc, ddd, &eee, aaa, bbb, X[ 4], 6) + III(&bbb, ccc, &ddd, eee, aaa, X[ 9], 15) + III(&aaa, bbb, &ccc, ddd, eee, X[ 1], 13) + III(&eee, aaa, &bbb, ccc, ddd, X[ 2], 11) + + /* parallel round 3 */ + HHH(&ddd, eee, &aaa, bbb, ccc, X[15], 9) + HHH(&ccc, ddd, &eee, aaa, bbb, X[ 5], 7) + HHH(&bbb, ccc, &ddd, eee, aaa, X[ 1], 15) + HHH(&aaa, bbb, &ccc, ddd, eee, X[ 3], 11) + HHH(&eee, aaa, &bbb, ccc, ddd, X[ 7], 8) + HHH(&ddd, eee, &aaa, bbb, ccc, X[14], 6) + HHH(&ccc, ddd, &eee, aaa, bbb, X[ 6], 6) + HHH(&bbb, ccc, &ddd, eee, aaa, X[ 9], 14) + HHH(&aaa, bbb, &ccc, ddd, eee, X[11], 12) + HHH(&eee, aaa, &bbb, ccc, ddd, X[ 8], 13) + HHH(&ddd, eee, &aaa, bbb, ccc, X[12], 5) + HHH(&ccc, ddd, &eee, aaa, bbb, X[ 2], 14) + HHH(&bbb, ccc, &ddd, eee, aaa, X[10], 13) + HHH(&aaa, bbb, &ccc, ddd, eee, X[ 0], 13) + HHH(&eee, aaa, &bbb, ccc, ddd, X[ 4], 7) + HHH(&ddd, eee, &aaa, bbb, ccc, X[13], 5) + + /* parallel round 4 */ + GGG(&ccc, ddd, &eee, aaa, bbb, X[ 8], 15) + GGG(&bbb, ccc, &ddd, eee, aaa, X[ 6], 5) + GGG(&aaa, bbb, &ccc, ddd, eee, X[ 4], 8) + GGG(&eee, aaa, &bbb, ccc, ddd, X[ 1], 11) + GGG(&ddd, eee, &aaa, bbb, ccc, X[ 3], 14) + GGG(&ccc, ddd, &eee, aaa, bbb, X[11], 14) + GGG(&bbb, ccc, &ddd, eee, aaa, X[15], 6) + GGG(&aaa, bbb, &ccc, ddd, eee, X[ 0], 14) + GGG(&eee, aaa, &bbb, ccc, ddd, X[ 5], 6) + GGG(&ddd, eee, &aaa, bbb, ccc, X[12], 9) + GGG(&ccc, ddd, &eee, aaa, bbb, X[ 2], 12) + GGG(&bbb, ccc, &ddd, eee, aaa, X[13], 9) + GGG(&aaa, bbb, &ccc, ddd, eee, X[ 9], 12) + GGG(&eee, aaa, &bbb, ccc, ddd, X[ 7], 5) + GGG(&ddd, eee, &aaa, bbb, ccc, X[10], 15) + GGG(&ccc, ddd, &eee, aaa, bbb, X[14], 8) + + /* parallel round 5 */ + FFF(&bbb, ccc, &ddd, eee, aaa, X[12] , 8) + FFF(&aaa, bbb, &ccc, ddd, eee, X[15] , 5) + FFF(&eee, aaa, &bbb, ccc, ddd, X[10] , 12) + FFF(&ddd, eee, &aaa, bbb, ccc, X[ 4] , 9) + FFF(&ccc, ddd, &eee, aaa, bbb, X[ 1] , 12) + FFF(&bbb, ccc, &ddd, eee, aaa, X[ 5] , 5) + FFF(&aaa, bbb, &ccc, ddd, eee, X[ 8] , 14) + FFF(&eee, aaa, &bbb, ccc, ddd, X[ 7] , 6) + FFF(&ddd, eee, &aaa, bbb, ccc, X[ 6] , 8) + FFF(&ccc, ddd, &eee, aaa, bbb, X[ 2] , 13) + FFF(&bbb, ccc, &ddd, eee, aaa, X[13] , 6) + FFF(&aaa, bbb, &ccc, ddd, eee, X[14] , 5) + FFF(&eee, aaa, &bbb, ccc, ddd, X[ 0] , 15) + FFF(&ddd, eee, &aaa, bbb, ccc, X[ 3] , 13) + FFF(&ccc, ddd, &eee, aaa, bbb, X[ 9] , 11) + FFF(&bbb, ccc, &ddd, eee, aaa, X[11] , 11) + + /* combine results */ + MDbuf = (MDbuf.1 &+ cc &+ ddd, + MDbuf.2 &+ dd &+ eee, + MDbuf.3 &+ ee &+ aaa, + MDbuf.4 &+ aa &+ bbb, + MDbuf.0 &+ bb &+ ccc) + } + + public mutating func update(data: Data) { + data.withUnsafeBytes { (ptr: UnsafePointer) in + var ptr = ptr + var length = data.count + var X = [UInt32](repeating: 0, count: 16) + + // Process remaining bytes from last call: + if buffer.count > 0 && buffer.count + length >= 64 { + let amount = 64 - buffer.count + buffer.append(ptr, count: amount) + buffer.withUnsafeBytes { _ = memcpy(&X, $0, 64) } + compress(X) + ptr += amount + length -= amount + } + // Process 64 byte chunks: + while length >= 64 { + memcpy(&X, ptr, 64) + compress(X) + ptr += 64 + length -= 64 + } + // Save remaining unprocessed bytes: + buffer = Data(bytes: ptr, count: length) + } + count += Int64(data.count) + } + + public mutating func finalize() -> Data { + var X = [UInt32](repeating: 0, count: 16) + /* append the bit m_n == 1 */ + buffer.append(0x80) + buffer.withUnsafeBytes { _ = memcpy(&X, $0, buffer.count) } + + if (count & 63) > 55 { + /* length goes to next block */ + compress(X) + X = [UInt32](repeating: 0, count: 16) + } + + /* append length in bits */ + let lswlen = UInt32(truncatingIfNeeded: count) + let mswlen = UInt32(UInt64(count) >> 32) + X[14] = lswlen << 3 + X[15] = (lswlen >> 29) | (mswlen << 3) + compress(X) + + var data = Data(count: 20) + data.withUnsafeMutableBytes { (ptr: UnsafeMutablePointer) in + ptr[0] = MDbuf.0 + ptr[1] = MDbuf.1 + ptr[2] = MDbuf.2 + ptr[3] = MDbuf.3 + ptr[4] = MDbuf.4 + } + + buffer = Data() + + return data + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/core/crypto/KeyPair.swift b/Nem2SdkSwift/core/crypto/KeyPair.swift new file mode 100644 index 0000000..4696e47 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/KeyPair.swift @@ -0,0 +1,49 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Key pair of a private key and the public key +public class KeyPair { + static let PUBLIC_KEY_SIZE = 32 + static let PRIVATE_KEY_SIZE = 64 + static let PRIVATE_KEY_SEED_SIZE = 32 + static let SIGNATURE_SIZE = 64 + + // MARK: Properties + /// Private key. + public let privateKey: PrivateKey + /// Public key. + public let publicKey: PublicKey + + // :nodoc: + let nativePrivateKey: [UInt8] + + // MARK: Methods + /// Creates a random key pair. + public convenience init() { + var privateKeySeed = [UInt8](repeating: 0, count: KeyPair.PRIVATE_KEY_SEED_SIZE) + ed25519_create_seed(&privateKeySeed) + + self.init(privateKey: try! PrivateKey(bytes: privateKeySeed)) + } + + /** + * Creates a key pair around a private key. + * The public key is calculated from the private key. + * + * - parameter privateKey: The private key. + */ + public init(privateKey: PrivateKey) { + var calculatedPrivateKey = [UInt8](repeating: 0, count: KeyPair.PRIVATE_KEY_SIZE) + var publicKey = [UInt8](repeating: 0, count: KeyPair.PUBLIC_KEY_SIZE) + var privateKeySeed = privateKey.bytes + + ed25519_sha3_create_keypair(&publicKey, &calculatedPrivateKey, &privateKeySeed) + + self.privateKey = privateKey + self.publicKey = try! PublicKey(bytes: publicKey) + self.nativePrivateKey = calculatedPrivateKey + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/core/crypto/PrivateKey.swift b/Nem2SdkSwift/core/crypto/PrivateKey.swift new file mode 100644 index 0000000..a3b0351 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/PrivateKey.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +/// Represents a private key. +public struct PrivateKey: Equatable, CustomStringConvertible { + // MARK: Properties + /// The raw private key value. + public let bytes: [UInt8] + + /// Private key hex string description. + public var description: String { + return bytes.hexString.uppercased() + } + + // MARK: Methods + /** + * Creates a new private key. + * + * - parameter bytes: The raw private key value. + * - throws: Nem2SDkSwiftError.illegalArgument if the byte length is invalid. + */ + public init(bytes: [UInt8]) throws{ + guard bytes.count == KeyPair.PRIVATE_KEY_SEED_SIZE else { + throw Nem2SdkSwiftError.illegalArgument("Invalid private key byte length.") + } + self.bytes = bytes + } + + /** + * Creates a private key from a hex string. + * + * - parameter hexString: The private key hex string. + * - throws: Nem2SDkSwiftError.illegalArgument if the byte length is invalid or the hex string is malformed. + */ + public init(hexString: String) throws { + try self.init(bytes: try HexEncoder.toBytes(hexString)) + } + + public static func ==(lhs: PrivateKey, rhs: PrivateKey) -> Bool { + return lhs.bytes == rhs.bytes + } + +} diff --git a/Nem2SdkSwift/core/crypto/PublicKey.swift b/Nem2SdkSwift/core/crypto/PublicKey.swift new file mode 100644 index 0000000..e765b2f --- /dev/null +++ b/Nem2SdkSwift/core/crypto/PublicKey.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Represents a public key. +public struct PublicKey: Equatable, CustomStringConvertible { + // MARK: Properties + /// The raw public key value. + public let bytes: [UInt8] + + /// Public key hex string description. + public var description: String { + return bytes.hexString.uppercased() + } + + // MARK: Methods + /** + * Creates a new public key. + * + * - parameter bytes: The raw public key value. + * - throws: Nem2SDkSwiftError.illegalArgument if the byte length is invalid. + */ + public init(bytes: [UInt8]) throws { + guard bytes.count == KeyPair.PUBLIC_KEY_SIZE else { + throw Nem2SdkSwiftError.illegalArgument("Invalid public key byte length.") + } + + self.bytes = bytes + } + + /** + * Creates a public key from a hex string. + * + * - parameter hexString: The public key hex string. + * - throws: Nem2SDkSwiftError.illegalArgument if the byte length is invalid or the hex string is malformed. + */ + public init(hexString: String) throws { + try self.init(bytes: try HexEncoder.toBytes(hexString)) + } + + public static func ==(lhs: PublicKey, rhs: PublicKey) -> Bool { + return lhs.bytes == rhs.bytes + } + +} diff --git a/Nem2SdkSwift/core/crypto/RHash b/Nem2SdkSwift/core/crypto/RHash new file mode 160000 index 0000000..c7bf200 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/RHash @@ -0,0 +1 @@ +Subproject commit c7bf200e31c3e5baae60e028097d47802c7e127a diff --git a/Nem2SdkSwift/core/crypto/Signer.swift b/Nem2SdkSwift/core/crypto/Signer.swift new file mode 100644 index 0000000..bec8ec5 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/Signer.swift @@ -0,0 +1,32 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +class Signer { + + private let keyPair: KeyPair + private static let signatureSize = 64 + + init(keyPair: KeyPair) { + self.keyPair = keyPair + } + + func sign(message: [UInt8]) -> [UInt8] { + var signature = [UInt8](repeating: 0, count: Signer.signatureSize) + var messageVar = message + var publicVar = keyPair.publicKey.bytes + var privateVar = keyPair.nativePrivateKey + + ed25519_sha3_sign(&signature, + &messageVar, + message.count, + &publicVar, + &privateVar) + + return signature + } + +} \ No newline at end of file diff --git a/Nem2SdkSwift/core/crypto/ed25519 b/Nem2SdkSwift/core/crypto/ed25519 new file mode 160000 index 0000000..7fa6712 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/ed25519 @@ -0,0 +1 @@ +Subproject commit 7fa6712ef5d581a6981ec2b08ee623314cd1d1c4 diff --git a/Nem2SdkSwift/core/crypto/ed25519_sha3_512.c b/Nem2SdkSwift/core/crypto/ed25519_sha3_512.c new file mode 100644 index 0000000..ec6bc8a --- /dev/null +++ b/Nem2SdkSwift/core/crypto/ed25519_sha3_512.c @@ -0,0 +1,123 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +#include "ed25519_sha3_512.h" + +#include "RHash/librhash/sha3.h" +#include "ed25519/src/ge.h" +#include "ed25519/src/sc.h" + +void ed25519_sha3_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed) { + ge_p3 A; + + sha3_ctx ctx; + rhash_sha3_512_init(&ctx); + rhash_sha3_update(&ctx, seed, 32); + rhash_sha3_final(&ctx, private_key); + + private_key[0] &= 248; + private_key[31] &= 63; + private_key[31] |= 64; + + ge_scalarmult_base(&A, private_key); + ge_p3_tobytes(public_key, &A); +} + +void ed25519_sha3_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key) { + sha3_ctx hash; + unsigned char hram[64]; + unsigned char r[64]; + ge_p3 R; + + rhash_sha3_512_init(&hash); + rhash_sha3_update(&hash, private_key + 32, 32); + rhash_sha3_update(&hash, message, message_len); + rhash_sha3_final(&hash, r); + + sc_reduce(r); + ge_scalarmult_base(&R, r); + ge_p3_tobytes(signature, &R); + + rhash_sha3_512_init(&hash); + rhash_sha3_update(&hash, signature, 32); + rhash_sha3_update(&hash, public_key, 32); + rhash_sha3_update(&hash, message, message_len); + rhash_sha3_final(&hash, hram); + + sc_reduce(hram); + sc_muladd(signature + 32, hram, private_key, r); +} + +static int consttime_equal(const unsigned char *x, const unsigned char *y) { + unsigned char r = 0; + + r = x[0] ^ y[0]; +#define F(i) r |= x[i] ^ y[i] + F(1); + F(2); + F(3); + F(4); + F(5); + F(6); + F(7); + F(8); + F(9); + F(10); + F(11); + F(12); + F(13); + F(14); + F(15); + F(16); + F(17); + F(18); + F(19); + F(20); + F(21); + F(22); + F(23); + F(24); + F(25); + F(26); + F(27); + F(28); + F(29); + F(30); + F(31); +#undef F + + return !r; +} + +int ed25519_sha3_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key) { + unsigned char h[64]; + unsigned char checker[32]; + sha3_ctx hash; + ge_p3 A; + ge_p2 R; + + if (signature[63] & 224) { + return 0; + } + + if (ge_frombytes_negate_vartime(&A, public_key) != 0) { + return 0; + } + + rhash_sha3_512_init(&hash); + rhash_sha3_update(&hash, signature, 32); + rhash_sha3_update(&hash, public_key, 32); + rhash_sha3_update(&hash, message, message_len); + rhash_sha3_final(&hash, h); + + sc_reduce(h); + ge_double_scalarmult_vartime(&R, h, &A, signature + 32); + ge_tobytes(checker, &R); + + if (!consttime_equal(checker, signature)) { + return 0; + } + + return 1; +} diff --git a/Nem2SdkSwift/core/crypto/ed25519_sha3_512.h b/Nem2SdkSwift/core/crypto/ed25519_sha3_512.h new file mode 100644 index 0000000..92e4e58 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/ed25519_sha3_512.h @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +#ifndef ed25519_sha3_512_h +#define ed25519_sha3_512_h + +#include + +void ed25519_sha3_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed); +void ed25519_sha3_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key); +int ed25519_sha3_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key); + +#endif /* ed25519_sha3_512_h */ \ No newline at end of file diff --git a/Nem2SdkSwift/core/crypto/message_encryption.c b/Nem2SdkSwift/core/crypto/message_encryption.c new file mode 100644 index 0000000..8effd60 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/message_encryption.c @@ -0,0 +1,44 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +#include + +#include "message_encryption.h" +#include "ed25519.h" +#include "RHash/librhash/sha3.h" +#include "ed25519/src/ge.h" + +static const size_t kSharedKeySize = 32; +static const size_t kSaltBytes = kSharedKeySize; + +static void create_shared_key_raw(unsigned char* shared_key, const unsigned char* public_key, const unsigned char* private_key) { + static const unsigned char zero[kSharedKeySize] = {0}; + + ge_p3 A; + ge_p2 r; + ge_frombytes_negate_vartime(&A, public_key); + + // negate + fe_neg(A.X, A.X); + fe_neg(A.T, A.T); + + // calculate a * A + 0 * B = a * A + ge_double_scalarmult_vartime(&r, private_key, &A, zero); + + ge_tobytes(shared_key, &r); +} + +void create_shared_key(unsigned char* shared_key, const unsigned char* public_key, const unsigned char* private_key, const unsigned char* salt) { + sha3_ctx ctx; + + create_shared_key_raw(shared_key, public_key, private_key); + + for(int i = 0 ; i< kSaltBytes; ++i) { + shared_key[i] = shared_key[i] ^ salt[i]; + } + + rhash_sha3_256_init(&ctx); + rhash_sha3_update(&ctx, shared_key, kSharedKeySize); + rhash_sha3_final(&ctx, shared_key); +} diff --git a/Nem2SdkSwift/core/crypto/message_encryption.h b/Nem2SdkSwift/core/crypto/message_encryption.h new file mode 100644 index 0000000..6d59754 --- /dev/null +++ b/Nem2SdkSwift/core/crypto/message_encryption.h @@ -0,0 +1,11 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +#ifndef message_encryption_h +#define message_encryption_h + +int create_random_bytes(unsigned char* buff, size_t size); +void create_shared_key(unsigned char* shared_key, const unsigned char* public_key, const unsigned char* private_key, const unsigned char* salt); + +#endif /* message_encryption_h */ \ No newline at end of file diff --git a/Nem2SdkSwift/core/utils/Base32Encoder.swift b/Nem2SdkSwift/core/utils/Base32Encoder.swift new file mode 100644 index 0000000..1073cce --- /dev/null +++ b/Nem2SdkSwift/core/utils/Base32Encoder.swift @@ -0,0 +1,194 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +fileprivate extension String { + var ascii: [UInt8] { + return [UInt8](self.data(using: .ascii)!) + } +} + +/// Static class that contains utility functions for converting Base32 strings to and from bytes. +class Base32Encoder { + // MARK: Methods + private static let decodingTable :[UInt8] = { + var table = [UInt8](repeating: 0xFF, count: 256) + for code:UInt8 in 0..<26 { + let lowerPosition = "a".ascii.first! + code + let upperPosition = "A".ascii.first! + code + table[Int(lowerPosition)] = code + table[Int(upperPosition)] = code + } + for code:UInt8 in 0..<6 { + let position = "2".ascii.first! + code + table[Int(position)] = code + 26 + } + + table[Int("=".ascii.first!)] = 0 + return table + }() + + /** + * Converts a base32 string to a byte array. + * + * - parameter base32String: The input Base32 string. + * - returns: The output byte array. + * - throws: Nem2SdkSwiftError.illegalArgument if the string is malformed. + */ + public static func bytes(from base32String: String) throws -> [UInt8] { + let paddingAdjustment: [Int] = [0, 1, 1, 1, 2, 3, 3, 4]; + let encoded = base32String + .replacingOccurrences(of: "=", with: "") + .replacingOccurrences(of: " ", with: "") + + let encodedBytes = encoded.ascii + let encodedLength = encodedBytes.count + + let encodedBlocks = (encodedLength + 7) >> 3; + let expectedDataLength = encodedBlocks * 5; + + var decodedBytes = [UInt8](repeating: 0, count: expectedDataLength) + var encodedBytesToProcess = encodedLength + var encodedBaseIndex = 0 + var decodedBaseIndex = 0 + var encodedBlock = [UInt8](repeating: 0, count: 8) + + var encodedBlockIndex = 0 + while encodedBytesToProcess >= 1 { + encodedBytesToProcess -= 1 + + var c = encodedBytes[encodedBaseIndex] + encodedBaseIndex += 1 + + c = decodingTable[Int(c)] + if c == 0xFF { + throw Nem2SdkSwiftError.illegalArgument("\(encodedBytes[encodedBaseIndex-1]) cannot be decoded.") + } + + encodedBlock[encodedBlockIndex] = c + encodedBlockIndex += 1 + if encodedBlockIndex == 8 { + let encodedByte1 = encodedBlock[0] + let encodedByte2 = encodedBlock[1] + let encodedByte3 = encodedBlock[2] + let encodedByte4 = encodedBlock[3] + let encodedByte5 = encodedBlock[4] + let encodedByte6 = encodedBlock[5] + let encodedByte7 = encodedBlock[6] + let encodedByte8 = encodedBlock[7] + decodedBytes[decodedBaseIndex] = ((encodedByte1 << 3) & 0xF8) | ((encodedByte2 >> 2) & 0x07) + decodedBytes[decodedBaseIndex+1] = ((encodedByte2 << 6) & 0xC0) | ((encodedByte3 << 1) & 0x3E) | ((encodedByte4 >> 4) & 0x01) + decodedBytes[decodedBaseIndex+2] = ((encodedByte4 << 4) & 0xF0) | ((encodedByte5 >> 1) & 0x0F) + decodedBytes[decodedBaseIndex+3] = ((encodedByte5 << 7) & 0x80) | ((encodedByte6 << 2) & 0x7C) | ((encodedByte7 >> 3) & 0x03) + decodedBytes[decodedBaseIndex+4] = ((encodedByte7 << 5) & 0xE0) | (encodedByte8 & 0x1F) + decodedBaseIndex += 5 + encodedBlockIndex = 0 + } + } + + if encodedBlockIndex > 0 { + let encodedByte7 = encodedBlockIndex >= 7 ? encodedBlock[6] : 0 + let encodedByte6 = encodedBlockIndex >= 6 ? encodedBlock[5] : 0 + let encodedByte5 = encodedBlockIndex >= 5 ? encodedBlock[4] : 0 + let encodedByte4 = encodedBlockIndex >= 4 ? encodedBlock[3] : 0 + let encodedByte3 = encodedBlockIndex >= 3 ? encodedBlock[2] : 0 + let encodedByte2 = encodedBlockIndex >= 2 ? encodedBlock[1] : 0 + let encodedByte1 = encodedBlock[0] + + decodedBytes[decodedBaseIndex] = ((encodedByte1 << 3) & 0xF8) | ((encodedByte2 >> 2) & 0x07) + decodedBytes[decodedBaseIndex+1] = ((encodedByte2 << 6) & 0xC0) | ((encodedByte3 << 1) & 0x3E) | ((encodedByte4 >> 4) & 0x01) + decodedBytes[decodedBaseIndex+2] = ((encodedByte4 << 4) & 0xF0) | ((encodedByte5 >> 1) & 0x0F) + decodedBytes[decodedBaseIndex+3] = ((encodedByte5 << 7) & 0x80) | ((encodedByte6 << 2) & 0x7C) | ((encodedByte7 >> 3) & 0x03) + decodedBytes[decodedBaseIndex+4] = ((encodedByte7 << 5) & 0xE0) + } + decodedBaseIndex += paddingAdjustment[encodedBlockIndex]; + return Array(decodedBytes[0.. String { + let encodingTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".ascii + let paddingTable = [0,6,4,3,1] + + // Table 3: The Base 32 Alphabet + // + // Value Encoding Value Encoding Value Encoding Value Encoding + // 0 A 9 J 18 S 27 3 + // 1 B 10 K 19 T 28 4 + // 2 C 11 L 20 U 29 5 + // 3 D 12 M 21 V 30 6 + // 4 E 13 N 22 W 31 7 + // 5 F 14 O 23 X + // 6 G 15 P 24 Y (pad) = + // 7 H 16 Q 25 Z + // 8 I 17 R 26 2 + + let dataLength = bytes.count + var encodedBlocks = dataLength / 5 + //if (encodedBlocks + 1) >= (UInt.max / 8) { return nil }// NSUInteger overflow check + let padding = paddingTable[dataLength % 5] + if padding > 0 { + encodedBlocks += 1 + } + + let encodedLength = encodedBlocks * 8 + + var encodingBytes = [UInt8](repeating: 0, count: encodedLength) + + var rawBytesToProcess = dataLength + var rawBaseIndex = 0 + var encodingBaseIndex = 0 + + while( rawBytesToProcess >= 5 ) { + let rawByte1 = bytes[rawBaseIndex] + let rawByte2 = bytes[rawBaseIndex+1] + let rawByte3 = bytes[rawBaseIndex+2] + let rawByte4 = bytes[rawBaseIndex+3] + let rawByte5 = bytes[rawBaseIndex+4] + + encodingBytes[encodingBaseIndex] = encodingTable[Int((rawByte1 >> 3) & 0x1F)] + encodingBytes[encodingBaseIndex+1] = encodingTable[Int(((rawByte1 << 2) & 0x1C) | ((rawByte2 >> 6) & 0x03)) ] + encodingBytes[encodingBaseIndex+2] = encodingTable[Int((rawByte2 >> 1) & 0x1F)] + encodingBytes[encodingBaseIndex+3] = encodingTable[Int(((rawByte2 << 4) & 0x10) | ((rawByte3 >> 4) & 0x0F))] + encodingBytes[encodingBaseIndex+4] = encodingTable[Int(((rawByte3 << 1) & 0x1E) | ((rawByte4 >> 7) & 0x01))] + encodingBytes[encodingBaseIndex+5] = encodingTable[Int((rawByte4 >> 2) & 0x1F)] + encodingBytes[encodingBaseIndex+6] = encodingTable[Int(((rawByte4 << 3) & 0x18) | ((rawByte5 >> 5) & 0x07))] + encodingBytes[encodingBaseIndex+7] = encodingTable[Int(rawByte5 & 0x1F)] + + rawBaseIndex += 5 + encodingBaseIndex += 8 + rawBytesToProcess -= 5 + } + + let rest = dataLength-rawBaseIndex + if rest < 5 && rest > 0 { + let rawByte4 = rest >= 4 ? bytes[rawBaseIndex+3] : 0 + let rawByte3 = rest >= 3 ? bytes[rawBaseIndex+2] : 0 + let rawByte2 = rest >= 2 ? bytes[rawBaseIndex+1] : 0 + let rawByte1 = bytes[rawBaseIndex] + + encodingBytes[encodingBaseIndex] = encodingTable[Int((rawByte1 >> 3) & 0x1F)] + encodingBytes[encodingBaseIndex+1] = encodingTable[Int(((rawByte1 << 2) & 0x1C) | ((rawByte2 >> 6) & 0x03)) ] + encodingBytes[encodingBaseIndex+2] = encodingTable[Int((rawByte2 >> 1) & 0x1F)] + encodingBytes[encodingBaseIndex+3] = encodingTable[Int(((rawByte2 << 4) & 0x10) | ((rawByte3 >> 4) & 0x0F))] + encodingBytes[encodingBaseIndex+4] = encodingTable[Int(((rawByte3 << 1) & 0x1E) | ((rawByte4 >> 7) & 0x01))] + encodingBytes[encodingBaseIndex+5] = encodingTable[Int((rawByte4 >> 2) & 0x1F)] + encodingBytes[encodingBaseIndex+6] = encodingTable[Int((rawByte4 << 3) & 0x18)] + } + // compute location from where to begin inserting padding, it may overwrite some bytes from the partial block encoding + // if their value was 0 (cases 1-3). + encodingBaseIndex = encodedLength - padding + for i in 0.. Decimal { + return Decimal(value).round() + } + + var uint64Value: UInt64 { + return (self as NSDecimalNumber).uint64Value + } + + func floor(_ position: Int16 = 0) -> Decimal { + return round(position, .down) + } + + func ceil(_ position: Int16 = 0) -> Decimal { + return round(position, .up) + } + + func round(_ position: Int16 = 0, _ roundingMode: RoundingMode = .plain) -> Decimal { + let behavior = NSDecimalNumberHandler(roundingMode: roundingMode, scale: position, raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: false) + return (self as NSDecimalNumber).rounding(accordingToBehavior: behavior) as Decimal + } + + func scale10(_ scale: Int) -> Decimal { + if scale > 0 { + return self * pow(Decimal(10), scale) + } else { + return self / pow(Decimal(10), -scale) + } + } +} diff --git a/Nem2SdkSwift/core/utils/HexEncoder.swift b/Nem2SdkSwift/core/utils/HexEncoder.swift new file mode 100644 index 0000000..5b00d5e --- /dev/null +++ b/Nem2SdkSwift/core/utils/HexEncoder.swift @@ -0,0 +1,70 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Static class that contains utility functions for converting hex strings to and from bytes. +public class HexEncoder { + // MARK: Methods + /** + * Converts bytes to hex string. + * + * - parameter bytes: Bytes + * - returns: Hex string + */ + public static func toHexString(_ bytes : [UInt8]) -> String { + var result = "" + bytes.forEach { (element) in + result = result + String(format:"%02x", element) + } + return result + } + + /** + * Converts bytes to hex string + * + * - parameter input: Hex string + * - returns: Bytes + * - throws: Nem2SdkSwiftError.illegalArgument if the input is malformed. + */ + public static func toBytes(_ input: String) throws -> [UInt8] { + var s = input + if input.count % 2 == 1 { + s = "0" + s + } + let len = s.lengthOfBytes(using: .ascii) + var data: [UInt8] = [] + for i in stride(from:0, to:len, by: 2) { + let startIndex = s.index(s.startIndex, offsetBy: i) + let endIndex = s.index(startIndex, offsetBy: 2) + if let val = UInt8(s[startIndex.. [UInt8]? { + return try? HexEncoder.toBytes(self) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/core/utils/Numeric+Extension.swift b/Nem2SdkSwift/core/utils/Numeric+Extension.swift new file mode 100644 index 0000000..95c32e7 --- /dev/null +++ b/Nem2SdkSwift/core/utils/Numeric+Extension.swift @@ -0,0 +1,31 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +extension Numeric{ + var bytes: [UInt8] { + var mutableValue = self + let bytes = Array(withUnsafeBytes(of: &mutableValue) { + $0 + }) + return bytes + } + + static func createFrom(bytes: [UInt8]) -> Self?{ + if bytes.count < MemoryLayout.size { + return nil + } + let value = UnsafePointer(bytes).withMemoryRebound(to: Self.self, capacity: 1) { + $0.pointee + } + return value + } +} + +extension Numeric where Self : BinaryInteger { + var hexString: String { + return String(self, radix: 16) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/core/utils/String+Extension.swift b/Nem2SdkSwift/core/utils/String+Extension.swift new file mode 100644 index 0000000..d21a60f --- /dev/null +++ b/Nem2SdkSwift/core/utils/String+Extension.swift @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +extension String { + func matches(_ regularExpression: String) -> Bool { + let regularExpression = try! NSRegularExpression(pattern: regularExpression) + let match = regularExpression.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) + + return match != nil + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/AccountHttp.swift b/Nem2SdkSwift/sdk/infrastructure/AccountHttp.swift new file mode 100644 index 0000000..7b7610d --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/AccountHttp.swift @@ -0,0 +1,141 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxSwift + +/// Account http repository +public class AccountHttp: Http, AccountRepository { + /** + * Constructs with host. + * + * - parameter url: Host url. + */ + public override init(url: URL) { + super.init(url: url) + } + + /// :nodoc: + public func getAccountInfo(address: Address) -> Single { + let builder = AccountRoutesAPI.getAccountInfoWithRequestBuilder(accountId: address.plain).with(url: url) + return builder.rxSend().map { try $0.toModel() } + } + + /// :nodoc: + public func getAccountsInfo(addresses: [Address]) -> Single<[AccountInfo]> { + let builder = AccountRoutesAPI.getAccountsInfoWithRequestBuilder( + addresses: Addresses(addresses: addresses.map { $0.plain })).with(url: url) + return builder.rxSend().map { try $0.map { try $0.toModel() } } + } + + /// :nodoc: + public func getMultisigAccountInfo(address: Address) -> Single { + let builder = AccountRoutesAPI.getAccountMultisigWithRequestBuilder(accountId: address.plain).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.toModel(in: networkType) } + } + + /// :nodoc: + public func getMultisigAccountGraphInfo(address: Address) -> Single { + let builder = AccountRoutesAPI.getAccountMultisigGraphWithRequestBuilder(accountId: address.plain).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.toModel(in: networkType) } + } + + /// :nodoc: + public func transactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> { + let builder = AccountRoutesAPI.transactionsWithRequestBuilder(publicKey: publicAccount.publicKey.description, pageSize: pageSize, id: id).with(url: url) + return builder.rxSend().map { dto in + return try dto.map { transaction in + try TransactionMapping.apply(transaction) + } + } + } + + /// :nodoc: + public func incomingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> { + let builder = AccountRoutesAPI.incomingTransactionsWithRequestBuilder(publicKey: publicAccount.publicKey.description, pageSize: pageSize, id: id).with(url: url) + return builder.rxSend().map { dto in + return try dto.map { transaction in + try TransactionMapping.apply(transaction) + } + } + } + + /// :nodoc: + public func outgoingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> { + let builder = AccountRoutesAPI.outgoingTransactionsWithRequestBuilder(publicKey: publicAccount.publicKey.description, pageSize: pageSize, id: id).with(url: url) + return builder.rxSend().map { dto in + return try dto.map { transaction in + try TransactionMapping.apply(transaction) + } + } + } + + /// :nodoc: + public func aggregateBondedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[AggregateTransaction]> { + let builder = AccountRoutesAPI.partialTransactionsWithRequestBuilder(publicKey: publicAccount.publicKey.description, pageSize: pageSize, id: id).with(url: url) + return builder.rxSend().map { dto in + return try dto.map { transaction in + guard let aggregateTransaction = try TransactionMapping.apply(transaction) as? AggregateTransaction else { + throw Nem2SdkSwiftError.parseError("Other type of transactions are returned though aggregate bonded transactions are required.") + } + return aggregateTransaction + } + } + } + + /// :nodoc: + public func unconfirmedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> { + let builder = AccountRoutesAPI.unconfirmedTransactionsWithRequestBuilder(publicKey: publicAccount.publicKey.description, pageSize: pageSize, id: id).with(url: url) + return builder.rxSend().map { dto in + return try dto.map { transaction in + try TransactionMapping.apply(transaction) + } + } + } +} + + +extension AccountInfoDTO { + func toModel() throws -> AccountInfo { + return AccountInfo( + address: try Address(encodedAddress: account.address), + addressHeight: account.addressHeight.uint64Value, + publicKey: account.publicKey, + publicKeyHeight: account.publicKeyHeight.uint64Value, + importance: account.importance.uint64Value, + importanceHeight: account.importanceHeight.uint64Value, + mosaics: account.mosaics.map { $0.toModel() }) + } +} + +extension MosaicDTO { + func toModel() -> Mosaic { + return Mosaic(id: MosaicId(id: id.uint64Value), amount: amount.uint64Value) + } +} + +extension MultisigAccountInfoDTO { + func toModel(in networkType: NetworkType) throws -> MultisigAccountInfo { + return MultisigAccountInfo( + account: try PublicAccount(publicKeyHexString: self.multisig.account, networkType: networkType), + minApproval: multisig.minApproval, + minRemoval: multisig.minRemoval, + cosignatories: try multisig.cosignatories.map { try PublicAccount(publicKeyHexString: $0, networkType: networkType)}, + multisigAccounts: try multisig.multisigAccounts.map { try PublicAccount(publicKeyHexString: $0, networkType: networkType)} ) + } +} + +extension Array where Element == MultisigAccountGraphInfoDTO { + func toModel(in networkType: NetworkType) throws -> MultisigAccountGraphInfo { + return MultisigAccountGraphInfo( + multisigAccounts: Dictionary( + uniqueKeysWithValues: try map { graphEntry in + return (graphEntry.level, + try graphEntry.multisigEntries.map { + try $0.toModel(in: networkType) + }) + })) + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/AccountRepository.swift b/Nem2SdkSwift/sdk/infrastructure/AccountRepository.swift new file mode 100644 index 0000000..38cf225 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/AccountRepository.swift @@ -0,0 +1,118 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxSwift + +/// Account interface repository. +public protocol AccountRepository { + /** + * Gets an AccountInfo for an account. + * + * - parameter address Address + * - returns: Observable of AccountInfo + */ + func getAccountInfo(address: Address) -> Single + + /** + * Gets AccountsInfo for different accounts. + * + * - parameter addresses List of Address + * - returns: Observable of [AccountInfo] + */ + func getAccountsInfo(addresses: [Address]) -> Single<[AccountInfo]> + + /** + * Gets a MultisigAccountInfo for an account. + * + * - parameter address Address + * - returns: Observable of MultisigAccountInfo + */ + func getMultisigAccountInfo(address: Address) -> Single + + /** + * Gets a MultisigAccountGraphInfo for an account. + * + * - parameter address Address + * - returns: Observable of MultisigAccountGraphInfo + */ + func getMultisigAccountGraphInfo(address: Address) -> Single + + /** + * Gets an list of confirmed transactions for which an account is signer or receiver. + * + * - parameter publicAccount: PublicAccount + * - parameter pageSize: The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + * - parameter id: The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + * - returns: Observable of [Transaction] + */ + func transactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> + + /** + * Gets an list of transactions for which an account is the recipient of a transaction. + * A transaction is said to be incoming with respect to an account if the account is the recipient of a transaction. + * + * - parameter publicAccount: PublicAccount + * - parameter pageSize: The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + * - parameter id: The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + * - returns: Observable of [Transaction] + */ + func incomingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> + + /** + * Gets an list of transactions for which an account is the sender a transaction. + * A transaction is said to be outgoing with respect to an account if the account is the sender of a transaction. + * + * - parameter publicAccount: PublicAccount + * - parameter pageSize: The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + * - parameter id: The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + * - returns: Observable of [Transaction] + */ + func outgoingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> + + /** + * Gets an list of transactions for which an account is the sender or has sign the transaction. + * A transaction is said to be aggregate bonded with respect to an account if there are missing signatures. + * + * - parameter publicAccount: PublicAccount + * - parameter pageSize: The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + * - parameter id: The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + * - returns: Observable of [AggregateTransaction] + */ + func aggregateBondedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[AggregateTransaction]> + + /** + * Gets the list of transactions for which an account is the sender or receiver and which have not yet been included in a block. + * Unconfirmed transactions are those transactions that have not yet been included in a block. + * Unconfirmed transactions are not guaranteed to be included in any block. + * + * - parameter publicAccount: PublicAccount + * - parameter pageSize: The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + * - parameter id: The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + * - returns: Observable of [Transaction] + */ + func unconfirmedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]> +} + +public extension AccountRepository { + func transactions(publicAccount: PublicAccount, pageSize: Int? = nil, id: String? = nil) -> Single<[Transaction]> { + return transactions(publicAccount: publicAccount, pageSize: pageSize, id: id) + } + + func incomingTransactions(publicAccount: PublicAccount, pageSize: Int? = nil, id: String? = nil) -> Single<[Transaction]> { + return incomingTransactions(publicAccount: publicAccount, pageSize: pageSize, id: id) + } + + func outgoingTransactions(publicAccount: PublicAccount, pageSize: Int? = nil, id: String? = nil) -> Single<[Transaction]> { + return outgoingTransactions(publicAccount: publicAccount, pageSize: pageSize, id: id) + } + + func aggregateBondedTransactions(publicAccount: PublicAccount, pageSize: Int? = nil, id: String? = nil) -> Single<[AggregateTransaction]> { + return aggregateBondedTransactions(publicAccount: publicAccount, pageSize: pageSize, id: id) + } + + func unconfirmedTransactions(publicAccount: PublicAccount, pageSize: Int? = nil, id: String? = nil) -> Single<[Transaction]> { + return unconfirmedTransactions(publicAccount: publicAccount, pageSize: pageSize, id: id) + } +} diff --git a/Nem2SdkSwift/sdk/infrastructure/BlockchainHttp.swift b/Nem2SdkSwift/sdk/infrastructure/BlockchainHttp.swift new file mode 100644 index 0000000..ed9bfd7 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/BlockchainHttp.swift @@ -0,0 +1,86 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxSwift + +/// Blockchain http repository +public class BlockchainHttp: Http, BlockchainRepository { + /** + * Constructs with host. + * + * - parameter url: Host url. + */ + public override init(url: URL) { + super.init(url: url) + } + + /// :nodoc: + public func getBlock(height: UInt64) -> Single { + let builder = BlockchainRoutesAPI.getBlockByHeightWithRequestBuilder(height: Int64(height)).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.toModel(in: networkType) } + } + + /// :nodoc: + public func getBlockTransactions(height: UInt64, pageSize: Int?, id: String?) -> Single<[Transaction]> { + let builder = BlockchainRoutesAPI.getBlockTransactionsWithRequestBuilder(height: Int64(height), pageSize: pageSize, id: id).with(url: url) + return builder.rxSend().map { dto in + return try dto.map { transaction in + try TransactionMapping.apply(transaction) + } + } + } + + /// :nodoc: + public func getBlockchainHeight() -> Single { + let builder = BlockchainRoutesAPI.getBlockchainHeightWithRequestBuilder().with(url: url) + return builder.rxSend().map { $0.height.uint64Value } + } + + /// :nodoc: + public func getBlockchainScore() -> Single { + let builder = BlockchainRoutesAPI.getBlockchainScoreWithRequestBuilder().with(url: url) + return builder.rxSend().map { $0.toModel() } + } + + /// :nodoc: + public func getBlockchainStorage() -> Single { + let builder = BlockchainRoutesAPI.getDiagnosticStorageWithRequestBuilder().with(url: url) + return builder.rxSend().map { $0.toModel() } + } +} + +extension BlockInfoDTO { + func toModel(in networkType: NetworkType) throws -> BlockInfo { + let signer = try PublicAccount(publicKeyHexString: block.signer, networkType: networkType) + let version = Int(block.version) & 0xFF + return BlockInfo( + hash: meta.hash, + generationHash: meta.generationHash, + totalFee: meta.totalFee.uint64Value, + numTransactions: Int(meta.numTransactions), + signature: block.signature, + signer: signer, + networkType: networkType, + version: version, + type: Int(block.type), + height: block.height.uint64Value, + timestamp: block.timestamp.uint64Value, + difficulty: block.difficulty.uint64Value, + previousBlockHash: block.previousBlockHash, + blockTransactionHash: block.blockTransactionsHash) + } +} + +extension BlockchainScoreDTO { + func toModel() -> BlockchainScore { + return BlockchainScore(scoreLow: scoreLow.uint64Value, scoreHigh: scoreHigh.uint64Value) + } +} + +extension BlockchainStorageInfoDTO { + func toModel() -> BlockchainStorageInfo { + return BlockchainStorageInfo(numAccounts: numAccounts, numBlocks: numBlocks, numTransactions: numTransactions) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/BlockchainRepository.swift b/Nem2SdkSwift/sdk/infrastructure/BlockchainRepository.swift new file mode 100644 index 0000000..c50513f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/BlockchainRepository.swift @@ -0,0 +1,56 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// Blockchain interface repository +public protocol BlockchainRepository { + /** + * Gets a BlockInfo for a given block height. + * + * - parameter height: Block height + * - returns: Observable of BlockInfo + */ + func getBlock(height: UInt64) -> Single + + /** + * Gets list of transactions included in a block for a block height. + * + * - parameter height: Block height + * - parameter pageSize: The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + * - parameter id: The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + * - returns: Observable of [Transaction] + */ + func getBlockTransactions(height: UInt64, pageSize: Int?, id: String?) -> Single<[Transaction]> + + /** + * Gets current blockchain height. + * + * - returns: Observable of UInt64 + */ + func getBlockchainHeight() -> Single + + /** + * Gets current blockchain score. + * + * - returns: Observable of BlockchainScore + */ + func getBlockchainScore() -> Single + + /** + * Gets blockchain storage info. + * + * - returns: Observable of BlockchainStorageInfo + */ + func getBlockchainStorage() -> Single +} + + +extension BlockchainRepository { + func getBlockTransactions(height: UInt64, pageSize: Int? = nil, id: String? = nil) -> Single<[Transaction]> { + return getBlockTransactions(height: height, pageSize: pageSize, id: id) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/Http.swift b/Nem2SdkSwift/sdk/infrastructure/Http.swift new file mode 100644 index 0000000..85f3905 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/Http.swift @@ -0,0 +1,37 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// :nodoc: +public class Http { + let url: URL + var networkType: NetworkType? + + init(url: URL) { + self.url = url + SwaggerClientAPI.basePath = "" + } + + func getNetworkType() -> Single { + if let networkType = self.networkType { + return Single.create { observer in + observer(.success(networkType)) + return Disposables.create() + } + } + let builder = NetworkRoutesAPI.getNetworkTypeWithRequestBuilder() + builder.URLString = url.appendingPathComponent(builder.URLString).description + return builder.rxSend().map { dto in + if dto.name.lowercased() == "mijinTest".lowercased() { + self.networkType = NetworkType.mijinTest + return NetworkType.mijinTest + } else { + throw Nem2SdkSwiftError.illegalArgument("network " + dto.name + " is not supported yet by the sdk") + } + } + } +} diff --git a/Nem2SdkSwift/sdk/infrastructure/Listener.swift b/Nem2SdkSwift/sdk/infrastructure/Listener.swift new file mode 100644 index 0000000..ba635ae --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/Listener.swift @@ -0,0 +1,474 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import Starscream +import RxSwift + + +/// WebSocket Listener +public class Listener { + private let webSocket: WebSocket + private let webSocketDelegate: WebSocketDelegateImpl + private let messageSubject: PublishSubject + private let connectionSubject: PublishSubject + private let errorSubject: PublishSubject + private var openCompletable: Completable? + private let disposeBag = DisposeBag() + + var uid: String? + + // MARK: Methods + /** + * Creates WebSocket Listener. + * - parameter url: Host url. + */ + public init(url: URL) { + self.webSocket = WebSocket(url: url.appendingPathComponent("ws")) + self.connectionSubject = PublishSubject() + self.messageSubject = PublishSubject() + self.errorSubject = PublishSubject() + self.webSocketDelegate = WebSocketDelegateImpl( + connectionSubject: self.connectionSubject, + messageSubject: self.messageSubject, + errorSubject: self.errorSubject) + + self.webSocket.delegate = self.webSocketDelegate + self.uid = nil + } + + /** + * Opens WebSocket connection. + * + * - returns: Completable that resolves when the WebSocket connection is opened + */ + public func open() -> Completable { + if self.uid != nil { + return Completable.create { observer in + observer(.completed) + return Disposables.create() + } + } + + + webSocket.connect() + return Completable.create { observer in + self.connectionSubject.subscribe(onNext: { uid in + self.uid = uid + observer(.completed) + }).disposed(by: self.disposeBag) + + return Disposables.create() + } + } + + + /// Close webSocket connection + public func close() { + self.uid = nil + self.webSocket.disconnect() + } + + private func subscribeTo(channel: ListenerChannel, additionalPath: String? = nil) { + guard let uid = self.uid else { + return + } + let subscribeMessage = ListenerSubscribeMessage( + uid: uid, + subscribe: channel.rawValue + (additionalPath != nil ? "/" + additionalPath! : "")) + + let jsonEncoder = JSONEncoder() + + guard let encoded = try? jsonEncoder.encode(subscribeMessage), + let encodedString = String(data: encoded, encoding: .utf8) else { + return + } + + self.webSocket.write(string: encodedString) + } + + + /** + * Returns an observable stream of BlockInfo. + * Each time a new Block is added into the blockchain, + * it emits a new BlockInfo in the event stream. + * + * - returns: Observable stream of BlockInfo + */ + public func newBlock() -> Observable { + self.subscribeTo(channel: .block) + return self.messageSubject.flatMap { message -> Observable in + if case .block(let blockInfo) = message { + return Observable.just(blockInfo) + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of Transaction for a specific address. + * Each time a transaction is in confirmed state an it involves the address, + * it emits a new Transaction in the event stream. + * + * - parameter address: Address we listen when a transaction is in confirmed state + * - returns: Observable stream of Transaction with state confirmed + */ + public func confirmed(address: Address) -> Observable { + self.subscribeTo(channel: .confirmedAdded, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable in + if case .confirmedAdded(let transaction) = message { + if transaction.isRelatedWith(address: address) { + return Observable.just(transaction) + } + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of Transaction for a specific address. + * Each time a transaction is in unconfirmed state an it involves the address, + * it emits a new Transaction in the event stream. + * + * - parameter address: Address we listen when a transaction is in unconfirmed state + * - returns: Observable stream of Transaction with state unconfirmed + */ + public func unconfirmedAdded(address: Address) -> Observable { + self.subscribeTo(channel: .unconfirmedAdded, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable in + if case .unconfirmedAdded(let transaction) = message { + if transaction.isRelatedWith(address: address) { + return Observable.just(transaction) + } + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of Transaction Hashes for specific address. + * Each time a transaction with state unconfirmed changes its state, + * it emits a new message with the transaction hash in the event stream. + * + * - parameter address: Address we listen when a transaction is removed from unconfirmed state + * - returns: Observable stream of Strings with the transaction hash + */ + public func unconfirmedRemoved(address: Address) -> Observable<[UInt8]> { + self.subscribeTo(channel: .unconfirmedRemoved, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable<[UInt8]> in + if case .unconfirmedRemoved(let hash) = message { + return Observable.just(hash) + } + return Observable.empty() + } + } + + /** + * Return an observable of AggregateTransaction for specific address. + * Each time an aggregate bonded transaction is announced, + * it emits a new AggregateTransaction in the event stream. + * + * - parameter address: address we listen when a transaction with missing signatures state + * - returns: Observable stream of AggregateTransaction with missing signatures state + */ + public func aggregateBondedAdded(address: Address) -> Observable { + self.subscribeTo(channel: .partialAdded, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable in + if case .partialAdded(let transaction) = message { + if transaction.isRelatedWith(address: address) { + return Observable.just(transaction) + } + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of Transaction Hashes for specific address. + * Each time an aggregate bonded transaction is announced, + * it emits a new message with the transaction hash in the event stream. + * + * - parameter address: Address we listen when a transaction is confirmed or rejected + * - returns: Observable stream of Strings with the transaction hash + */ + public func aggregateBondedRemoved(address: Address) -> Observable<[UInt8]> { + self.subscribeTo(channel: .partialRemoved, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable<[UInt8]> in + if case .partialRemoved(let hash) = message { + return Observable.just(hash) + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of {@link TransactionStatusError} for specific address. + * Each time a transaction contains an error, + * it emits a new message with the transaction status error in the event stream. + * + * - parameter address: Address we listen to be notified when some error happened + * - returns: Observable stream of TransactionStatusError + */ + public func status(address: Address) -> Observable { + self.subscribeTo(channel: .status, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable in + if case .status(let transactionStatusError) = message { + return Observable.just(transactionStatusError) + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of CosignatureSignedTransaction for specific address. + * Each time a cosigner signs a transaction the address initialized, + * it emits a new message with the cosignatory signed transaction in the even stream. + * + * - parameter address: Address we listen when a cosignatory is added to some transaction address sent + * - returns: Observable stream of CosignatureSignedTransaction + */ + public func cosignatureAdded(address: Address) -> Observable { + self.subscribeTo(channel: .cosignature, additionalPath: address.plain) + return self.messageSubject.flatMap { message -> Observable in + if case .cosignature(let cosignature) = message { + return Observable.just(cosignature) + } + return Observable.empty() + } + } + + /** + * Returns an observable stream of Error. + * - returns: Observable stream of Error. + */ + public func error() -> Observable { + return self.errorSubject + } + + + class WebSocketDelegateImpl: WebSocketDelegate { + let connectionSubject: PublishSubject + let messageSubject: PublishSubject + let errorSubject: PublishSubject + + init(connectionSubject: PublishSubject, messageSubject: PublishSubject, errorSubject: PublishSubject) { + self.connectionSubject = connectionSubject + self.messageSubject = messageSubject + self.errorSubject = errorSubject + } + + public func websocketDidConnect(socket: WebSocketClient) { + } + + public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) { + } + + public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) { + do { + try parseTextMessage(text: text) + } catch let error { + self.errorSubject.onNext(error) + } + } + + private func parseTextMessage(text: String) throws { + let jsonDecoder = JSONDecoder() + guard let rawData = text.data(using: .utf8) else { + throw Nem2SdkSwiftError.parseError("Failed to encode text message as utf.") + } + + if let uidDTO = try? jsonDecoder.decode(ListenerUIDDTO.self, from: rawData) { + self.connectionSubject.onNext(uidDTO.uid) + } else if let transactionDTO = try? jsonDecoder.decode(ListenerTransactionDTO.self, from: rawData) { + self.messageSubject.onNext(try transactionDTO.toMessage(rawData: rawData)) + } else if let blockDTO = try? jsonDecoder.decode(ListenerBlockDTO.self, from: rawData) { + self.messageSubject.onNext(try blockDTO.toMessage()) + } else if let statusDTO = try? jsonDecoder.decode(ListenerStatusDTO.self, from: rawData) { + self.messageSubject.onNext(try statusDTO.toMessage()) + } else if let hashDTO = try? jsonDecoder.decode(ListenerHashDTO.self, from: rawData) { + self.messageSubject.onNext(try hashDTO.toMessage()) + } else if let cosignatureDTO = try? jsonDecoder.decode(ListenerCosignatureDTO.self, from: rawData) { + self.messageSubject.onNext(try cosignatureDTO.toMessage()) + } else { + throw Nem2SdkSwiftError.parseError("Unknown text message: \(text)") + } + } + + public func websocketDidReceiveData(socket: WebSocketClient, data: Data) { + } + } + + + private struct ListenerUIDDTO: Codable { + let uid: String + } + + private struct ListenerTransactionDTO: Codable { + let transaction: AnyObjectDictionary + let meta: MetaData + + struct MetaData: Codable { + let channelName: String + } + + + func toMessage(rawData: Data) throws -> ListenerMessage { + guard let channel = ListenerChannel(rawValue: self.meta.channelName) else { + throw Nem2SdkSwiftError.parseError("Failed to parse channel name of transaction.") + } + + let jsonDecoder = JSONDecoder() + let rawTransaction = try jsonDecoder.decode(AnyObjectDictionary.self, from: rawData) + + let transaction = try TransactionMapping.apply(rawTransaction) + switch channel { + case .unconfirmedAdded: return .unconfirmedAdded(transaction) + case .confirmedAdded: return .confirmedAdded(transaction) + case .partialAdded: + if let aggregateTransaction = transaction as? AggregateTransaction { + return .partialAdded(aggregateTransaction) + } else { + throw Nem2SdkSwiftError.parseError("Message channel \(self.meta.channelName) is for AggregateTransaction but the transaction is not AggregateTransaction.") + + } + default: + throw Nem2SdkSwiftError.parseError("Message channel \(self.meta.channelName) is not for transaction channel.") + } + } + } + + private struct ListenerBlockDTO: Codable { + let meta: MetaData + let block: Inner + + struct MetaData: Codable { + let hash: String + let generationHash: String + } + struct Inner: Codable { + let signature: String + let signer: String + let version: Int + let type: Int + let height: UInt64DTO + let timestamp: UInt64DTO + let difficulty: UInt64DTO + let previousBlockHash: String + let blockTransactionsHash: String + } + + func toMessage() throws -> ListenerMessage { + let versionAndNetwork = self.block.version + let version = Int(versionAndNetwork & 0xFF) + let networkValue = UInt8((versionAndNetwork >> 8) & 0xFF) + guard let networkType = NetworkType(rawValue: networkValue) else { + throw Nem2SdkSwiftError.parseError("Failed to parse network type of block") + } + + let block = self.block + + return .block( + BlockInfo( + hash: self.meta.hash, + generationHash: self.meta.generationHash, + totalFee: nil, + numTransactions: nil, + signature: block.signature, + signer: try PublicAccount(publicKeyHexString: block.signer, networkType: networkType), + networkType: networkType, + version: version, + type: block.type, + height: block.height.uint64Value, + timestamp: block.timestamp.uint64Value, + difficulty: block.difficulty.uint64Value, + previousBlockHash: block.previousBlockHash, + blockTransactionHash: block.blockTransactionsHash) + ) + } + } + + private struct ListenerStatusDTO: Codable { + let status: String + let hash: String + let deadline: UInt64DTO + + func toMessage() throws -> ListenerMessage { + return .status(TransactionStatusError( + hash: try HexEncoder.toBytes(self.hash), + status: self.status, + deadline: Deadline(fromNemesis: TimeInterval(self.deadline.uint64Value) / 1000.0) + )) + } + } + + private struct ListenerHashDTO: Codable { + let meta: MetaData + + struct MetaData: Codable { + let channelName: String + let hash: String + } + + func toMessage() throws -> ListenerMessage { + guard let channel = ListenerChannel(rawValue: self.meta.channelName) else { + throw Nem2SdkSwiftError.parseError("Failed to parse channel name of hash.") + } + switch channel { + case .unconfirmedRemoved: return .unconfirmedRemoved(try HexEncoder.toBytes(self.meta.hash)) + case .partialRemoved: return .partialRemoved(try HexEncoder.toBytes(self.meta.hash)) + default: + throw Nem2SdkSwiftError.parseError("Message channel \(self.meta.channelName) is not for hash channel.") + } + } + } + + private struct ListenerCosignatureDTO: Codable { + let parentHash: String + let signature: String + let signer: String + + func toMessage() throws -> ListenerMessage { + return .cosignature(CosignatureSignedTransaction( + parentHash: try HexEncoder.toBytes(self.parentHash), + signature: try HexEncoder.toBytes(self.signature), + signer: try HexEncoder.toBytes(self.signer) + )) + } + } + +} + + + +private extension Transaction { + func isRelatedWith(address: Address) -> Bool { + if isSignedByOrSentTo(address: address) { + return true + } + + if let aggregateTransaction = self as? AggregateTransaction { + for cosignature in aggregateTransaction.cosignatures { + if cosignature.signer.address == address { + return true + } + } + for innerTransaction in aggregateTransaction.innerTransactions { + if innerTransaction.isSignedByOrSentTo(address: address) { + return true + } + } + } + return false + } + + func isSignedByOrSentTo(address: Address) -> Bool{ + if let transferTransaction = self as? TransferTransaction { + if transferTransaction.recipient == address { + return true + } + } + return signer?.address == address + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/ListenerChannel.swift b/Nem2SdkSwift/sdk/infrastructure/ListenerChannel.swift new file mode 100644 index 0000000..a3d69e0 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/ListenerChannel.swift @@ -0,0 +1,17 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +enum ListenerChannel: String { + case block = "block" + case confirmedAdded = "confirmedAdded" + case unconfirmedAdded = "unconfirmedAdded" + case unconfirmedRemoved = "unconfirmedRemoved" + case partialAdded = "partialAdded" + case partialRemoved = "partialRemoved" + case cosignature = "cosignature" + case status = "status" +} diff --git a/Nem2SdkSwift/sdk/infrastructure/ListenerMessage.swift b/Nem2SdkSwift/sdk/infrastructure/ListenerMessage.swift new file mode 100644 index 0000000..d2026c1 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/ListenerMessage.swift @@ -0,0 +1,18 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + + +enum ListenerMessage { + case block(BlockInfo) + case confirmedAdded(Transaction) + case unconfirmedAdded(Transaction) + case unconfirmedRemoved([UInt8]) + case partialAdded(AggregateTransaction) + case partialRemoved([UInt8]) + case cosignature(CosignatureSignedTransaction) + case status(TransactionStatusError) +} diff --git a/Nem2SdkSwift/sdk/infrastructure/ListenerSubscribeMessage.swift b/Nem2SdkSwift/sdk/infrastructure/ListenerSubscribeMessage.swift new file mode 100644 index 0000000..4067df2 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/ListenerSubscribeMessage.swift @@ -0,0 +1,11 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +public struct ListenerSubscribeMessage: Codable { + let uid: String + let subscribe: String +} diff --git a/Nem2SdkSwift/sdk/infrastructure/MosaicHttp.swift b/Nem2SdkSwift/sdk/infrastructure/MosaicHttp.swift new file mode 100644 index 0000000..5b14372 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/MosaicHttp.swift @@ -0,0 +1,81 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// Mosaic http repository. +public class MosaicHttp: Http, MosaicRepository { + /** + * Constructs with host. + * + * - parameter url: Host url. + */ + public override init(url: URL) { + super.init(url: url) + } + + /// :nodoc: + public func getMosaic(mosaicId: MosaicId) -> Single { + let builder = MosaicRoutesAPI.getMosaicWithRequestBuilder(mosaicId: mosaicId.id.hexString).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.toModel(in: networkType) } + } + + /// :nodoc: + public func getMosaics(mosaicIds: [MosaicId]) -> Single<[MosaicInfo]> { + let builder = MosaicRoutesAPI.getMosaicsWithRequestBuilder( + mosaicIds: MosaicIds(mosaicIds: mosaicIds.map { $0.id.hexString } )).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.map { try $0.toModel(in: networkType) } } + } + + /// :nodoc: + public func getMosaicsFromNamespace(namespaceId: NamespaceId, pageSize: Int?, id: String?) -> Single<[MosaicInfo]> { + let builder = MosaicRoutesAPI.getMosaicsFromNamespaceWithRequestBuilder(namespaceId: namespaceId.id.hexString, pageSize: pageSize, id: id).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.map { try $0.toModel(in: networkType) } } + } + + /// :nodoc: + public func getMosaicNames(mosaicIds: [MosaicId]) -> Single<[MosaicName]> { + let builder = MosaicRoutesAPI.getMosaicsNameWithRequestBuilder(mosaicIds: MosaicIds(mosaicIds: mosaicIds.map { $0.id.hexString })).with(url: url) + return builder.rxSend().map { dto in dto.map { $0.toModel() } } + } + +} + +private func extractMosaicProperties(properties: MosaicPropertiesDTO) -> MosaicProperties { + let flags = properties[0][0] + return MosaicProperties( + isSupplyMutable: (( flags >> 0 ) & 0x01) != 0, + isTransferable: (( flags >> 1 ) & 0x01) != 0, + isLevyMutable: (( flags >> 2 ) & 0x01) != 0, + divisibility: Int(properties[1].uint64Value), + duration: properties[2].uint64Value) +} + +extension MosaicInfoDTO { + func toModel(in networkType: NetworkType) throws -> MosaicInfo { + let owner = try PublicAccount(publicKeyHexString: self.mosaic.owner, networkType: networkType) + return MosaicInfo( + isActive: meta.active, + index: meta.index, + metaId: meta.id, + namespaceId: NamespaceId(id: mosaic.namespaceId.uint64Value), + mosaicId: MosaicId(id: mosaic.mosaicId.uint64Value), + supply: mosaic.supply.uint64Value, + height: mosaic.height.uint64Value, + owner: owner, + properties: extractMosaicProperties(properties: mosaic.properties)) + } +} + +extension MosaicNameDTO { + func toModel() -> MosaicName { + return MosaicName( + mosaicId: MosaicId(id: mosaicId.uint64Value), + name: name, + parentId: NamespaceId(id: parentId.uint64Value)) + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/MosaicRepository.swift b/Nem2SdkSwift/sdk/infrastructure/MosaicRepository.swift new file mode 100644 index 0000000..6d021f7 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/MosaicRepository.swift @@ -0,0 +1,50 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// Mosaic interface repository. +public protocol MosaicRepository { + /** + * Gets a MosaicInfo for a given mosaicId + * + * - parameter mosaicId: Mosaic id + * - returns: Observable of MosaicInfo + */ + func getMosaic(mosaicId: MosaicId) -> Single + + /** + * Gets MosaicInfo for different mosaicIds. + * + * - parameter mosaicIds: List of mosaic id + * - returns: Observable of [MosaicInfo] + */ + func getMosaics(mosaicIds: [MosaicId]) -> Single<[MosaicInfo]> + + /** + * Gets list of MosaicInfo from mosaics created with provided namespace. + * + * - parameter namespaceId: Namespace id. + * - parameter pageSize: The number of mosaics to return. (optional) + * - parameter id: The mosaic id up to which mosaic definitions are returned. (optional) + * - returns: Observable of [MosaicInfo] + */ + func getMosaicsFromNamespace(namespaceId: NamespaceId, pageSize: Int?, id: String?) -> Single<[MosaicInfo]> + + /** + * Gets list of MosaicName for different mosaicIds. + * + * - parameter mosaicIds: List of mosaic id. + * - returns: Observable of [MosaicName] + */ + func getMosaicNames(mosaicIds: [MosaicId]) -> Single<[MosaicName]> +} + +public extension MosaicRepository { + func getMosaicsFromNamespace(namespaceId: NamespaceId, pageSize: Int? = nil, id: String? = nil) -> Single<[MosaicInfo]> { + return getMosaicsFromNamespace(namespaceId: namespaceId, pageSize: pageSize, id: id) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/NamespaceHttp.swift b/Nem2SdkSwift/sdk/infrastructure/NamespaceHttp.swift new file mode 100644 index 0000000..be02705 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/NamespaceHttp.swift @@ -0,0 +1,78 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxSwift +/// Namespace http repository +public class NamespaceHttp: Http, NamespaceRepository { + /** + * Constructs with host. + * + * - parameter url: Host url. + */ + public override init(url: URL) { + super.init(url: url) + } + + /// :nodoc: + public func getNamespace(namespaceId: NamespaceId) -> Single { + let builder = NamespaceRoutesAPI.getNamespaceWithRequestBuilder(namespaceId: namespaceId.id.hexString).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.toModel(in: networkType) } + + } + + /// :nodoc: + public func getNamespacesFromAccount(address: Address, pageSize: Int?, id: String?) -> Single<[NamespaceInfo]> { + let builder = NamespaceRoutesAPI.getNamespacesFromAccountWithRequestBuilder(accountId: address.plain, pageSize: pageSize, id: id).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.map { try $0.toModel(in: networkType)} } + + } + + /// :nodoc: + public func getNamespacesFromAccounts(addresses: [Address], pageSize: Int?, id: String?) -> Single<[NamespaceInfo]> { + let builder = NamespaceRoutesAPI.getNamespacesFromAccountsWithRequestBuilder(addresses: Addresses(addresses: addresses.map { $0.plain}), pageSize: pageSize, id: id).with(url: url) + return Single.zip( getNetworkType(), builder.rxSend()).map { (networkType, dto) in try dto.map { try $0.toModel(in: networkType)} } + } + + /// :nodoc: + public func getNamespaceNames(namespaceIds: [NamespaceId]) -> Single<[NamespaceName]> { + let builder = NamespaceRoutesAPI.getNamespacesNamesWithRequestBuilder(namespaceIds: NamespaceIds(namespaceIds: namespaceIds.map {$0.id.hexString})).with(url: url) + return builder.rxSend().map { dto in dto.map { $0.toModel()}} + } +} + + + +extension NamespaceInfoDTO { + func toModel(in networkType: NetworkType) throws -> NamespaceInfo { + guard let namespaceType = NamespaceType(rawValue: UInt8(namespace.type)) else { + throw Nem2SdkSwiftError.parseError("Failed to parse \(namespace.type) as namespace type.") + } + let owner = try PublicAccount(publicKeyHexString: namespace.owner, networkType: networkType) + return NamespaceInfo( + isActive: meta.active, + index: meta.index, + metaId: meta.id, + type: namespaceType, + depth: namespace.depth, + levels: [namespace.level0, namespace.level1, namespace.level2].compactMap { $0?.uint64Value }.map { NamespaceId(id: $0) }, + parentId: NamespaceId(id: namespace.parentId.uint64Value), + owner: owner, + startHeight: namespace.startHeight.uint64Value, + endHeight: namespace.endHeight.uint64Value) + } +} + +extension NamespaceNameDTO { + func toModel() -> NamespaceName { + let parentIdStruct = parentId != nil ? NamespaceId(id: parentId!.uint64Value) : nil + return NamespaceName( + namespaceId: NamespaceId(id: namespaceId.uint64Value), + name: name, + parentId: parentIdStruct) + } +} + + + diff --git a/Nem2SdkSwift/sdk/infrastructure/NamespaceRepository.swift b/Nem2SdkSwift/sdk/infrastructure/NamespaceRepository.swift new file mode 100644 index 0000000..3ec6205 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/NamespaceRepository.swift @@ -0,0 +1,57 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxSwift + +/// Namespace interface repository. +public protocol NamespaceRepository { + + /** + * Gets the NamespaceInfo for a given namespaceId. + * + * - parameter namespaceId: NamespaceId + * - returns: Observable of NamespaceInfo + */ + func getNamespace(namespaceId: NamespaceId) -> Single + + /** + * Gets list of NamespaceInfo for an account. + * + * - parameter address: Address + * - parameter pageSize: The number of namespaces to return. (optional) + * - parameter id: The namespace id up to which namespace definitions are returned. (optional) + * - returns: Observable of [NamespaceInfo] + */ + func getNamespacesFromAccount(address: Address, pageSize: Int?, id: String?) -> Single<[NamespaceInfo]> + + /** + * Gets list of NamespaceInfo for different account. + * + * - parameter addresses: List of Address + * - parameter pageSize: The number of namespaces to return. (optional) + * - parameter id: The namespace id up to which namespace definitions are returned. (optional) + * - returns: Observable of [NamespaceInfo] + */ + func getNamespacesFromAccounts(addresses: [Address], pageSize: Int?, id: String?) -> Single<[NamespaceInfo]> + + /** + * Gets list of NamespaceName for different namespaceIds. + * + * - parameter namespaceIds: List of NamespaceId + * - returns: Observable of [NamespaceName] + */ + func getNamespaceNames(namespaceIds: [NamespaceId]) -> Single<[NamespaceName]> +} + +public extension NamespaceRepository { + func getNamespacesFromAccount(address: Address, pageSize: Int? = nil, id: String? = nil) -> Single<[NamespaceInfo]> { + return getNamespacesFromAccount(address: address, pageSize: pageSize, id: id) + } + + func getNamespacesFromAccounts(addresses: [Address], pageSize: Int? = nil, id: String? = nil) -> Single<[NamespaceInfo]> { + return getNamespacesFromAccounts(addresses: addresses, pageSize: pageSize, id: id) + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/NetworkHttp.swift b/Nem2SdkSwift/sdk/infrastructure/NetworkHttp.swift new file mode 100644 index 0000000..4e24840 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/NetworkHttp.swift @@ -0,0 +1,23 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxSwift + +/// Network http repository. +public class NetworkHttp: Http, NetworkRepository { + /** + * Constructs with host. + * + * - parameter url: Host url. + */ + public override init(url: URL) { + super.init(url: url) + } + + /// :nodoc: + override public func getNetworkType() -> Single { + return super.getNetworkType() + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/NetworkRepository.swift b/Nem2SdkSwift/sdk/infrastructure/NetworkRepository.swift new file mode 100644 index 0000000..44efe7c --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/NetworkRepository.swift @@ -0,0 +1,13 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// Network interface repository. +public protocol NetworkRepository { + /// Get current network type. + func getNetworkType() -> Single +} diff --git a/Nem2SdkSwift/sdk/infrastructure/RawAPIExtensions.swift b/Nem2SdkSwift/sdk/infrastructure/RawAPIExtensions.swift new file mode 100644 index 0000000..866fe69 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/RawAPIExtensions.swift @@ -0,0 +1,44 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +extension RequestBuilder { + func with(url: URL) -> RequestBuilder { + URLString = url.description + URLString + return self + } + func rxSend() -> Single { + return Single.create { observer in + self.execute { (response: Response?, error: Error?) in + if let response = response?.body { + observer(.success(response)) + } else { + if let error = error { + if case ErrorResponse.error(let code, let data, _ ) = error { + let message = data != nil ? String(data: data!, encoding: .utf8) : nil + observer(.error(Nem2SdkSwiftError.responseError(code, message))) + } else { + observer(.error(Nem2SdkSwiftError.networkError)) + } + } + else { + observer(.error(Nem2SdkSwiftError.networkError)) + } + } + } + + return Disposables.create() + } + } +} + +extension Array where Element == Int { + var uint64Value: UInt64 { + return UInt64(self[0]) | (UInt64(self[1]) << 32) + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/TransactionHttp.swift b/Nem2SdkSwift/sdk/infrastructure/TransactionHttp.swift new file mode 100644 index 0000000..bf74896 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/TransactionHttp.swift @@ -0,0 +1,95 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// Transaction http repository. +public class TransactionHttp: Http, TransactionRepository { + /** + * Constructs with host. + * + * - parameter url: Host url. + */ + public override init(url: URL) { + super.init(url: url) + } + + /// :nodoc: + public func getTransaction(hash: [UInt8]) -> Single { + let builder = TransactionRoutesAPI.getTransactionWithRequestBuilder(transactionId: hash.hexString).with(url: url) + return builder.rxSend().map { dto in try TransactionMapping.apply(dto)} + } + + /// :nodoc: + public func getTransactions(hashes: [[UInt8]]) -> Single<[Transaction]> { + let builder = TransactionRoutesAPI.getTransactionsWithRequestBuilder( + transactionIds: TransactionIds(transactionIds: hashes.map{ $0.hexString})).with(url: url) + return builder.rxSend().map { dto in try dto.map { try TransactionMapping.apply($0)}} + } + + /// :nodoc: + public func getTransactionStatus(hash: [UInt8]) -> Single { + let builder = TransactionRoutesAPI.getTransactionStatusWithRequestBuilder(hash: hash.hexString).with(url: url) + return builder.rxSend().map { dto in try dto.toModel() } + } + + /// :nodoc: + public func getTransactionStatuses(hashes: [[UInt8]]) -> Single<[TransactionStatus]> { + let builder = TransactionRoutesAPI.getTransactionsStatusesWithRequestBuilder( + transactionHashes: TransactionHashes(hashes: hashes.map{ $0.hexString })).with(url: url) + return builder.rxSend().map { dto in try dto.map { try $0.toModel() }} + } + + /// :nodoc: + public func announce(signedTransaction: SignedTransaction) -> Single { + let builder = TransactionRoutesAPI.announceTransactionWithRequestBuilder( + payload: TransactionPayload(payload: signedTransaction.payload.hexString)).with(url: url) + + return builder.rxSend().map { dto in try TransactionAnnounceResponseMapping.apply(dto: dto)} + } + + /// :nodoc: + public func announceAggregateBonded(signedTransaction: SignedTransaction) -> Single { + let builder = TransactionRoutesAPI.announcePartialTransactionWithRequestBuilder( + payload: TransactionPayload(payload: signedTransaction.payload.hexString)).with(url: url) + + return builder.rxSend().map { dto in try TransactionAnnounceResponseMapping.apply(dto: dto)} + + } + + /// :nodoc: + public func announceAggregateBondedCosignature(cosignatureSignedTransaction: CosignatureSignedTransaction) -> Single { + + let builder = TransactionRoutesAPI.announceCosignatureTransactionWithRequestBuilder( + payload: CosignatureSignedTransactionDTO( + parentHash: cosignatureSignedTransaction.parentHash.hexString, + signature: cosignatureSignedTransaction.signature.hexString, + signer: cosignatureSignedTransaction.signer.hexString)).with(url: url) + + return builder.rxSend().map { dto in try TransactionAnnounceResponseMapping.apply(dto: dto)} + } +} + + +extension TransactionStatusDTO { + func toModel() throws -> TransactionStatus { + return TransactionStatus( + group: group, + status: status, + hash: hash == nil ? nil: try HexEncoder.toBytes(hash!), + deadline: deadline == nil ? nil : Deadline(fromNemesis: TimeInterval(deadline!.uint64Value)), + height: height?.uint64Value) + } +} + +class TransactionAnnounceResponseMapping { + static func apply(dto: AnyObjectDictionary) throws -> TransactionAnnounceResponse { + guard case .object(let object) = dto else { + throw Nem2SdkSwiftError.parseError("Failed to parse transaction announce response.") + } + return TransactionAnnounceResponse(message: try object.getString("message")) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/TransactionRepository.swift b/Nem2SdkSwift/sdk/infrastructure/TransactionRepository.swift new file mode 100644 index 0000000..0e9a9ad --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/TransactionRepository.swift @@ -0,0 +1,65 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation +import RxSwift + +/// Transaction interface repository. +public protocol TransactionRepository { + /** + * Gets a transaction for a given hash. + * + * - parameter hash: Transaction hash. + * - returns: Observable of Transaction + */ + func getTransaction(hash: [UInt8]) -> Single + /** + * Gets an list of transactions for different transaction hashes. + * + * - parameter hashes: List of transaction hash string. + * - returns: Observable of [Transaction] + */ + func getTransactions(hashes: [[UInt8]] ) -> Single<[Transaction]> + + /** + * Gets a transaction status for a transaction hash. + * + * - parameter hash: Transaction hash string + * - returns: Observable of TransactionStatus + */ + func getTransactionStatus(hash: [UInt8]) -> Single + + /** + * Gets an list of transaction status for different transaction hashes. + * + * - parameter hashes: List of transaction hash string + * - returns: Observable of [TransactionStatus] + */ + func getTransactionStatuses(hashes: [[UInt8]] ) -> Single<[TransactionStatus]> + + /** + * Send a signed transaction. + * + * - parameter signedTransaction: SignedTransaction + * - returns: Observable of TransactionAnnounceResponse + */ + func announce(signedTransaction: SignedTransaction) -> Single + + /** + * Send a signed transaction with missing signatures. + * + * - parameter signedTransaction: SignedTransaction + * - returns: Observable of TransactionAnnounceResponse + */ + func announceAggregateBonded(signedTransaction: SignedTransaction) -> Single + + /** + * Send a cosignature signed transaction of an already announced transaction. + * + * - parameter cosignatureSignedTransaction: CosignatureSignedTransaction + * - returns: Observable of TransactionAnnounceResponse + */ + func announceAggregateBondedCosignature(cosignatureSignedTransaction: CosignatureSignedTransaction) -> Single +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIHelper.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIHelper.swift new file mode 100644 index 0000000..14d3609 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIHelper.swift @@ -0,0 +1,68 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// APIHelper.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + +class APIHelper { + static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + var destination = [String:Any]() + for (key, nillableValue) in source { + if let value: Any = nillableValue { + destination[key] = value + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + var destination = [String:String]() + for (key, nillableValue) in source { + if let value: Any = nillableValue { + destination[key] = "\(value)" + } + } + return destination + } + + static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + guard let source = source else { + return nil + } + var destination = [String:Any]() + let theTrue = NSNumber(value: true as Bool) + let theFalse = NSNumber(value: false as Bool) + for (key, value) in source { + switch value { + case let x where x as? NSNumber === theTrue || x as? NSNumber === theFalse: + destination[key] = "\(value as! Bool)" as Any? + default: + destination[key] = value + } + } + return destination + } + + + static func mapValuesToQueryItems(values: [String:Any?]) -> [URLQueryItem]? { + let returnValues = values + .filter { $0.1 != nil } + .map { (item: (_key: String, _value: Any?)) -> URLQueryItem in + URLQueryItem(name: item._key, value:"\(item._value!)") + } + if returnValues.count == 0 { + return nil + } + return returnValues + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs.swift new file mode 100644 index 0000000..24cb78a --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs.swift @@ -0,0 +1,67 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// APIs.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + +class SwaggerClientAPI { + static var basePath = "http://localhost:3000" + static var credential: URLCredential? + static var customHeaders: [String:String] = [:] + static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() +} + +class RequestBuilder { + var credential: URLCredential? + var headers: [String:String] + let parameters: [String:Any]? + let isBody: Bool + let method: String + //let URLString: String + + // Changed by Nem2SdkSwift to change base path by client + var URLString: String + + /// Optional block to obtain a reference to the request's progress instance when available. + var onProgressReady: ((Progress) -> ())? + + required init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + self.method = method + self.URLString = URLString + self.parameters = parameters + self.isBody = isBody + self.headers = headers + + addHeaders(SwaggerClientAPI.customHeaders) + } + + func addHeaders(_ aHeaders:[String:String]) { + for (header, value) in aHeaders { + headers[header] = value + } + } + + func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { } + + func addHeader(name: String, value: String) -> Self { + if !value.isEmpty { + headers[name] = value + } + return self + } + + func addCredential() -> Self { + self.credential = SwaggerClientAPI.credential + return self + } +} + +protocol RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type + func getBuilder() -> RequestBuilder.Type +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/AccountRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/AccountRoutesAPI.swift new file mode 100644 index 0000000..5399142 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/AccountRoutesAPI.swift @@ -0,0 +1,491 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// AccountRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class AccountRoutesAPI { + /** + Get account information + + - parameter accountId: (path) The key or address of the account. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getAccountInfo(accountId: String, completion: @escaping ((_ data: AccountInfoDTO?,_ error: Error?) -> Void)) { + getAccountInfoWithRequestBuilder(accountId: accountId).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get account information + - GET /account/{accountId} + - Returns the account information. + - examples: [{contentType=application/json, example={ + "meta" : { }, + "account" : { + "publicKeyHeight" : "", + "address" : "address", + "importance" : "", + "mosaics" : [ { + "amount" : "", + "id" : "" + }, { + "amount" : "", + "id" : "" + } ], + "publicKey" : "publicKey", + "importanceHeight" : "", + "addressHeight" : "" + } +}}] + + - parameter accountId: (path) The key or address of the account. + + - returns: RequestBuilder + */ + class func getAccountInfoWithRequestBuilder(accountId: String) -> RequestBuilder { + var path = "/account/{accountId}" + path = path.replacingOccurrences(of: "{accountId}", with: "\(accountId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get multisig account information + + - parameter accountId: (path) The key or address of the account. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getAccountMultisig(accountId: String, completion: @escaping ((_ data: MultisigAccountInfoDTO?,_ error: Error?) -> Void)) { + getAccountMultisigWithRequestBuilder(accountId: accountId).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get multisig account information + - GET /account/{accountId}/multisig + - Returns [multisig account](https://nemtech.github.io/concepts/multisig-account.html) information. + - examples: [{contentType=application/json, example={ + "multisig" : { + "cosignatories" : [ "cosignatories", "cosignatories" ], + "multisigAccounts" : [ "multisigAccounts", "multisigAccounts" ], + "minApproval" : 0, + "accountAddress" : "accountAddress", + "account" : "account", + "minRemoval" : 6 + } +}}] + + - parameter accountId: (path) The key or address of the account. + + - returns: RequestBuilder + */ + class func getAccountMultisigWithRequestBuilder(accountId: String) -> RequestBuilder { + var path = "/account/{accountId}/multisig" + path = path.replacingOccurrences(of: "{accountId}", with: "\(accountId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get multisig account graph information + + - parameter accountId: (path) The key or address of the account. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getAccountMultisigGraph(accountId: String, completion: @escaping ((_ data: [MultisigAccountGraphInfoDTO]?,_ error: Error?) -> Void)) { + getAccountMultisigGraphWithRequestBuilder(accountId: accountId).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get multisig account graph information + - GET /account/{accountId}/multisig/graph + - Returns [multisig account](https://nemtech.github.io/concepts/multisig-account.html) graph. + - examples: [{contentType=application/json, example=[ { + "level" : 0, + "multisigEntries" : [ { + "multisig" : { + "cosignatories" : [ "cosignatories", "cosignatories" ], + "multisigAccounts" : [ "multisigAccounts", "multisigAccounts" ], + "minApproval" : 0, + "accountAddress" : "accountAddress", + "account" : "account", + "minRemoval" : 6 + } + }, { + "multisig" : { + "cosignatories" : [ "cosignatories", "cosignatories" ], + "multisigAccounts" : [ "multisigAccounts", "multisigAccounts" ], + "minApproval" : 0, + "accountAddress" : "accountAddress", + "account" : "account", + "minRemoval" : 6 + } + } ] +}, { + "level" : 0, + "multisigEntries" : [ { + "multisig" : { + "cosignatories" : [ "cosignatories", "cosignatories" ], + "multisigAccounts" : [ "multisigAccounts", "multisigAccounts" ], + "minApproval" : 0, + "accountAddress" : "accountAddress", + "account" : "account", + "minRemoval" : 6 + } + }, { + "multisig" : { + "cosignatories" : [ "cosignatories", "cosignatories" ], + "multisigAccounts" : [ "multisigAccounts", "multisigAccounts" ], + "minApproval" : 0, + "accountAddress" : "accountAddress", + "account" : "account", + "minRemoval" : 6 + } + } ] +} ]}] + + - parameter accountId: (path) The key or address of the account. + + - returns: RequestBuilder<[MultisigAccountGraphInfoDTO]> + */ + class func getAccountMultisigGraphWithRequestBuilder(accountId: String) -> RequestBuilder<[MultisigAccountGraphInfoDTO]> { + var path = "/account/{accountId}/multisig/graph" + path = path.replacingOccurrences(of: "{accountId}", with: "\(accountId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[MultisigAccountGraphInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get accounts information + + - parameter addresses: (body) An array of addresses. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getAccountsInfo(addresses: Addresses, completion: @escaping ((_ data: [AccountInfoDTO]?,_ error: Error?) -> Void)) { + getAccountsInfoWithRequestBuilder(addresses: addresses).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get accounts information + - POST /account + - Returns the account information for an array of accounts. + - examples: [{contentType=application/json, example=[ { + "meta" : { }, + "account" : { + "publicKeyHeight" : "", + "address" : "address", + "importance" : "", + "mosaics" : [ { + "amount" : "", + "id" : "" + }, { + "amount" : "", + "id" : "" + } ], + "publicKey" : "publicKey", + "importanceHeight" : "", + "addressHeight" : "" + } +}, { + "meta" : { }, + "account" : { + "publicKeyHeight" : "", + "address" : "address", + "importance" : "", + "mosaics" : [ { + "amount" : "", + "id" : "" + }, { + "amount" : "", + "id" : "" + } ], + "publicKey" : "publicKey", + "importanceHeight" : "", + "addressHeight" : "" + } +} ]}] + + - parameter addresses: (body) An array of addresses. + + - returns: RequestBuilder<[AccountInfoDTO]> + */ + class func getAccountsInfoWithRequestBuilder(addresses: Addresses) -> RequestBuilder<[AccountInfoDTO]> { + let path = "/account" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: addresses) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[AccountInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Get incoming transactions + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func incomingTransactions(publicKey: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + incomingTransactionsWithRequestBuilder(publicKey: publicKey, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get incoming transactions + - GET /account/{publicKey}/transactions/incoming + - Gets an array of incoming transactions. A transaction is said to be incoming with respect to an account if the account is the recipient of the transaction. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + + - returns: RequestBuilder<[Any]> + */ + class func incomingTransactionsWithRequestBuilder(publicKey: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[AnyObjectDictionary]> { + var path = "/account/{publicKey}/transactions/incoming" + path = path.replacingOccurrences(of: "{publicKey}", with: "\(publicKey)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get outgoing transactions + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func outgoingTransactions(publicKey: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + outgoingTransactionsWithRequestBuilder(publicKey: publicKey, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get outgoing transactions + - GET /account/{publicKey}/transactions/outgoing + - Gets an array of outgoing transactions. A transaction is said to be outgoing with respect to an account if the account is the sender of the transaction. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + + - returns: RequestBuilder<[Any]> + */ + class func outgoingTransactionsWithRequestBuilder(publicKey: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[AnyObjectDictionary]> { + var path = "/account/{publicKey}/transactions/outgoing" + path = path.replacingOccurrences(of: "{publicKey}", with: "\(publicKey)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get aggregate bonded transactions information + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func partialTransactions(publicKey: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + partialTransactionsWithRequestBuilder(publicKey: publicKey, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get aggregate bonded transactions information + - GET /account/{publicKey}/transactions/partial + - Gets an array of [aggregate bonded transactions](https://nemtech.github.io/concepts/aggregate-transaction.html#aggregate-bonded) where the account is the sender or requires to cosign the transaction. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + + - returns: RequestBuilder<[Any]> + */ + class func partialTransactionsWithRequestBuilder(publicKey: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[AnyObjectDictionary]> { + var path = "/account/{publicKey}/transactions/partial" + path = path.replacingOccurrences(of: "{publicKey}", with: "\(publicKey)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get confirmed transactions + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func transactions(publicKey: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + transactionsWithRequestBuilder(publicKey: publicKey, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get confirmed transactions + - GET /account/{publicKey}/transactions + - Gets an array of transactions for which an account is the sender or receiver. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + + - returns: RequestBuilder<[Any]> + */ + class func transactionsWithRequestBuilder(publicKey: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[AnyObjectDictionary]> { + var path = "/account/{publicKey}/transactions" + path = path.replacingOccurrences(of: "{publicKey}", with: "\(publicKey)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get unconfirmed transactions + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func unconfirmedTransactions(publicKey: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + unconfirmedTransactionsWithRequestBuilder(publicKey: publicKey, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get unconfirmed transactions + - GET /account/{publicKey}/transactions/unconfirmed + - Gets the array of transactions for which an account is the sender or receiver and which have not yet been included in a block. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter publicKey: (path) The key of the account. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + + - returns: RequestBuilder<[Any]> + */ + class func unconfirmedTransactionsWithRequestBuilder(publicKey: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[AnyObjectDictionary]> { + var path = "/account/{publicKey}/transactions/unconfirmed" + path = path.replacingOccurrences(of: "{publicKey}", with: "\(publicKey)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/BlockchainRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/BlockchainRoutesAPI.swift new file mode 100644 index 0000000..81c2256 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/BlockchainRoutesAPI.swift @@ -0,0 +1,301 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// BlockchainRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class BlockchainRoutesAPI { + /** + Get block information + + - parameter height: (path) The block's height. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getBlockByHeight(height: Int64, completion: @escaping ((_ data: BlockInfoDTO?,_ error: Error?) -> Void)) { + getBlockByHeightWithRequestBuilder(height: height).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get block information + - GET /block/{height} + - Gets a block from the chain that has the given height. + - examples: [{contentType=application/json, example={ + "meta" : { + "totalFee" : "", + "generationHash" : "generationHash", + "numTransactions" : 0.80082819046101150206595775671303272247314453125, + "hash" : "hash" + }, + "block" : { + "difficulty" : "", + "blockTransactionsHash" : "blockTransactionsHash", + "previousBlockHash" : "previousBlockHash", + "signature" : "signature", + "type" : 1.46581298050294517310021547018550336360931396484375, + "version" : 6.02745618307040320615897144307382404804229736328125, + "signer" : "signer", + "height" : "", + "timestamp" : "" + } +}}] + + - parameter height: (path) The block's height. + + - returns: RequestBuilder + */ + class func getBlockByHeightWithRequestBuilder(height: Int64) -> RequestBuilder { + var path = "/block/{height}" + path = path.replacingOccurrences(of: "{height}", with: "\(height)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get transactions from a block + + - parameter height: (path) The block's height. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func getBlockTransactions(height: Int64, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + getBlockTransactionsWithRequestBuilder(height: height, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get transactions from a block + - GET /block/{height}/transactions + - Returns an array of transactions included in a block for a given block height. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter height: (path) The block's height. + - parameter pageSize: (query) The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional) + - parameter id: (query) The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional) + + - returns: RequestBuilder<[Any]> + */ + class func getBlockTransactionsWithRequestBuilder(height: Int64, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[AnyObjectDictionary]> { + var path = "/block/{height}/transactions" + path = path.replacingOccurrences(of: "{height}", with: "\(height)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get the current height of the chain + + - parameter completion: completion handler to receive the data and the error objects + */ + class func getBlockchainHeight(completion: @escaping ((_ data: HeightDTO?,_ error: Error?) -> Void)) { + getBlockchainHeightWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get the current height of the chain + - GET /chain/height + - Returns the current height of the block chain. + - examples: [{contentType=application/json, example={ + "height" : "" +}}] + + - returns: RequestBuilder + */ + class func getBlockchainHeightWithRequestBuilder() -> RequestBuilder { + let path = "/chain/height" + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get the current score of the chain + + - parameter completion: completion handler to receive the data and the error objects + */ + class func getBlockchainScore(completion: @escaping ((_ data: BlockchainScoreDTO?,_ error: Error?) -> Void)) { + getBlockchainScoreWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get the current score of the chain + - GET /chain/score + - Gets the current score of the block chain. The higher the score, the better the chain. During synchronization, nodes try to get the best block chain in the network. + - examples: [{contentType=application/json, example={ + "scoreHigh" : "", + "scoreLow" : "" +}}] + + - returns: RequestBuilder + */ + class func getBlockchainScoreWithRequestBuilder() -> RequestBuilder { + let path = "/chain/score" + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get blocks information + + - parameter height: (path) The block's height. + - parameter limit: (path) The number of following blocks to be returned. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getBlocksByHeightWithLimit(height: Int64, limit: Int, completion: @escaping ((_ data: [BlockInfoDTO]?,_ error: Error?) -> Void)) { + getBlocksByHeightWithLimitWithRequestBuilder(height: height, limit: limit).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get blocks information + - GET /blocks/{height}/limit/{limit} + - Gets up to limit number of blocks after given block height from the chain. + - examples: [{contentType=application/json, example=[ { + "meta" : { + "totalFee" : "", + "generationHash" : "generationHash", + "numTransactions" : 0.80082819046101150206595775671303272247314453125, + "hash" : "hash" + }, + "block" : { + "difficulty" : "", + "blockTransactionsHash" : "blockTransactionsHash", + "previousBlockHash" : "previousBlockHash", + "signature" : "signature", + "type" : 1.46581298050294517310021547018550336360931396484375, + "version" : 6.02745618307040320615897144307382404804229736328125, + "signer" : "signer", + "height" : "", + "timestamp" : "" + } +}, { + "meta" : { + "totalFee" : "", + "generationHash" : "generationHash", + "numTransactions" : 0.80082819046101150206595775671303272247314453125, + "hash" : "hash" + }, + "block" : { + "difficulty" : "", + "blockTransactionsHash" : "blockTransactionsHash", + "previousBlockHash" : "previousBlockHash", + "signature" : "signature", + "type" : 1.46581298050294517310021547018550336360931396484375, + "version" : 6.02745618307040320615897144307382404804229736328125, + "signer" : "signer", + "height" : "", + "timestamp" : "" + } +} ]}] + + - parameter height: (path) The block's height. + - parameter limit: (path) The number of following blocks to be returned. + + - returns: RequestBuilder<[BlockInfoDTO]> + */ + class func getBlocksByHeightWithLimitWithRequestBuilder(height: Int64, limit: Int) -> RequestBuilder<[BlockInfoDTO]> { + var path = "/blocks/{height}/limit/{limit}" + path = path.replacingOccurrences(of: "{height}", with: "\(height)", options: .literal, range: nil) + path = path.replacingOccurrences(of: "{limit}", with: "\(limit)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[BlockInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get the storage information + + - parameter completion: completion handler to receive the data and the error objects + */ + class func getDiagnosticStorage(completion: @escaping ((_ data: BlockchainStorageInfoDTO?,_ error: Error?) -> Void)) { + getDiagnosticStorageWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get the storage information + - GET /diagnostic/storage + - Returns statistical information about the blockchain. + - examples: [{contentType=application/json, example={ + "numBlocks" : 0, + "numTransactions" : 6, + "numAccounts" : 1 +}}] + + - returns: RequestBuilder + */ + class func getDiagnosticStorageWithRequestBuilder() -> RequestBuilder { + let path = "/diagnostic/storage" + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/MosaicRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/MosaicRoutesAPI.swift new file mode 100644 index 0000000..467c260 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/MosaicRoutesAPI.swift @@ -0,0 +1,254 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class MosaicRoutesAPI { + /** + Get mosaic information + + - parameter mosaicId: (path) The mosaic identifier. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getMosaic(mosaicId: String, completion: @escaping ((_ data: MosaicInfoDTO?,_ error: Error?) -> Void)) { + getMosaicWithRequestBuilder(mosaicId: mosaicId).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get mosaic information + - GET /mosaic/{mosaicId} + - Gets the mosaic definition for a given mosaicId. + - examples: [{contentType=application/json, example={ + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "mosaic" : { + "owner" : "owner", + "namespaceId" : "", + "mosaicId" : "", + "supply" : "", + "properties" : "", + "levy" : "{}", + "height" : "" + } +}}] + + - parameter mosaicId: (path) The mosaic identifier. + + - returns: RequestBuilder + */ + class func getMosaicWithRequestBuilder(mosaicId: String) -> RequestBuilder { + var path = "/mosaic/{mosaicId}" + path = path.replacingOccurrences(of: "{mosaicId}", with: "\(mosaicId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get mosaics information for an array of mosaics + + - parameter mosaicIds: (body) An array of mosaicIds. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getMosaics(mosaicIds: MosaicIds, completion: @escaping ((_ data: [MosaicInfoDTO]?,_ error: Error?) -> Void)) { + getMosaicsWithRequestBuilder(mosaicIds: mosaicIds).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get mosaics information for an array of mosaics + - POST /mosaic + - Gets an array of mosaic definition. + - examples: [{contentType=application/json, example=[ { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "mosaic" : { + "owner" : "owner", + "namespaceId" : "", + "mosaicId" : "", + "supply" : "", + "properties" : "", + "levy" : "{}", + "height" : "" + } +}, { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "mosaic" : { + "owner" : "owner", + "namespaceId" : "", + "mosaicId" : "", + "supply" : "", + "properties" : "", + "levy" : "{}", + "height" : "" + } +} ]}] + + - parameter mosaicIds: (body) An array of mosaicIds. + + - returns: RequestBuilder<[MosaicInfoDTO]> + */ + class func getMosaicsWithRequestBuilder(mosaicIds: MosaicIds) -> RequestBuilder<[MosaicInfoDTO]> { + let path = "/mosaic" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: mosaicIds) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[MosaicInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Get mosaics information for a given namespace. + + - parameter namespaceId: (path) The namespace identifier. + - parameter pageSize: (query) The number of mosaics to return. (optional) + - parameter id: (query) The mosaic id up to which mosaic definitions are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func getMosaicsFromNamespace(namespaceId: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [MosaicInfoDTO]?,_ error: Error?) -> Void)) { + getMosaicsFromNamespaceWithRequestBuilder(namespaceId: namespaceId, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get mosaics information for a given namespace. + - GET /namespace/{namespaceId}/mosaics + - Gets an array of mosaic definition from mosaics created under the provided namespace. + - examples: [{contentType=application/json, example=[ { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "mosaic" : { + "owner" : "owner", + "namespaceId" : "", + "mosaicId" : "", + "supply" : "", + "properties" : "", + "levy" : "{}", + "height" : "" + } +}, { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "mosaic" : { + "owner" : "owner", + "namespaceId" : "", + "mosaicId" : "", + "supply" : "", + "properties" : "", + "levy" : "{}", + "height" : "" + } +} ]}] + + - parameter namespaceId: (path) The namespace identifier. + - parameter pageSize: (query) The number of mosaics to return. (optional) + - parameter id: (query) The mosaic id up to which mosaic definitions are returned. (optional) + + - returns: RequestBuilder<[MosaicInfoDTO]> + */ + class func getMosaicsFromNamespaceWithRequestBuilder(namespaceId: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[MosaicInfoDTO]> { + var path = "/namespace/{namespaceId}/mosaics" + path = path.replacingOccurrences(of: "{namespaceId}", with: "\(namespaceId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[MosaicInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get readable names for a set of mosaics + + - parameter mosaicIds: (body) An array of mosaicIds. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getMosaicsName(mosaicIds: MosaicIds, completion: @escaping ((_ data: [MosaicNameDTO]?,_ error: Error?) -> Void)) { + getMosaicsNameWithRequestBuilder(mosaicIds: mosaicIds).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get readable names for a set of mosaics + - POST /mosaic/names + - Returns friendly names for mosaics. + - examples: [{contentType=application/json, example=[ { + "name" : "name", + "mosaicId" : "", + "parentId" : "" +}, { + "name" : "name", + "mosaicId" : "", + "parentId" : "" +} ]}] + + - parameter mosaicIds: (body) An array of mosaicIds. + + - returns: RequestBuilder<[MosaicNameDTO]> + */ + class func getMosaicsNameWithRequestBuilder(mosaicIds: MosaicIds) -> RequestBuilder<[MosaicNameDTO]> { + let path = "/mosaic/names" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: mosaicIds) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[MosaicNameDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NamespaceRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NamespaceRoutesAPI.swift new file mode 100644 index 0000000..80eabb8 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NamespaceRoutesAPI.swift @@ -0,0 +1,277 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NamespaceRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class NamespaceRoutesAPI { + /** + Get namespace information + + - parameter namespaceId: (path) The namespace identifier. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNamespace(namespaceId: String, completion: @escaping ((_ data: NamespaceInfoDTO?,_ error: Error?) -> Void)) { + getNamespaceWithRequestBuilder(namespaceId: namespaceId).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get namespace information + - GET /namespace/{namespaceId} + - Gets the namespace for a given namespaceId. + - examples: [{contentType=application/json, example={ + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "namespace" : { + "owner" : "owner", + "depth" : 6, + "ownerAddress" : "ownerAddress", + "type" : 0, + "level1" : "", + "level0" : "", + "parentId" : "", + "startHeight" : "", + "level2" : "", + "endHeight" : "" + } +}}] + + - parameter namespaceId: (path) The namespace identifier. + + - returns: RequestBuilder + */ + class func getNamespaceWithRequestBuilder(namespaceId: String) -> RequestBuilder { + var path = "/namespace/{namespaceId}" + path = path.replacingOccurrences(of: "{namespaceId}", with: "\(namespaceId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get namespaces owned by an account + + - parameter accountId: (path) The address or key of the account. + - parameter pageSize: (query) The number of namespaces to return. (optional) + - parameter id: (query) The namespace id up to which namespace objects are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNamespacesFromAccount(accountId: String, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [NamespaceInfoDTO]?,_ error: Error?) -> Void)) { + getNamespacesFromAccountWithRequestBuilder(accountId: accountId, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get namespaces owned by an account + - GET /account/{accountId}/namespaces + - Gets an array of namespaces for a given account address. + - examples: [{contentType=application/json, example=[ { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "namespace" : { + "owner" : "owner", + "depth" : 6, + "ownerAddress" : "ownerAddress", + "type" : 0, + "level1" : "", + "level0" : "", + "parentId" : "", + "startHeight" : "", + "level2" : "", + "endHeight" : "" + } +}, { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "namespace" : { + "owner" : "owner", + "depth" : 6, + "ownerAddress" : "ownerAddress", + "type" : 0, + "level1" : "", + "level0" : "", + "parentId" : "", + "startHeight" : "", + "level2" : "", + "endHeight" : "" + } +} ]}] + + - parameter accountId: (path) The address or key of the account. + - parameter pageSize: (query) The number of namespaces to return. (optional) + - parameter id: (query) The namespace id up to which namespace objects are returned. (optional) + + - returns: RequestBuilder<[NamespaceInfoDTO]> + */ + class func getNamespacesFromAccountWithRequestBuilder(accountId: String, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[NamespaceInfoDTO]> { + var path = "/account/{accountId}/namespaces" + path = path.replacingOccurrences(of: "{accountId}", with: "\(accountId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[NamespaceInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get namespaces for given array of addresses + + - parameter addresses: (body) An array of addresses. + - parameter pageSize: (query) The number of namespaces to return. (optional) + - parameter id: (query) The namespace id up to which namespace objects are returned. (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNamespacesFromAccounts(addresses: Addresses, pageSize: Int? = nil, id: String? = nil, completion: @escaping ((_ data: [NamespaceInfoDTO]?,_ error: Error?) -> Void)) { + getNamespacesFromAccountsWithRequestBuilder(addresses: addresses, pageSize: pageSize, id: id).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get namespaces for given array of addresses + - POST /account/namespaces + - Gets namespaces for a given array of addresses. + - examples: [{contentType=application/json, example=[ { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "namespace" : { + "owner" : "owner", + "depth" : 6, + "ownerAddress" : "ownerAddress", + "type" : 0, + "level1" : "", + "level0" : "", + "parentId" : "", + "startHeight" : "", + "level2" : "", + "endHeight" : "" + } +}, { + "meta" : { + "active" : true, + "index" : 0, + "id" : "id" + }, + "namespace" : { + "owner" : "owner", + "depth" : 6, + "ownerAddress" : "ownerAddress", + "type" : 0, + "level1" : "", + "level0" : "", + "parentId" : "", + "startHeight" : "", + "level2" : "", + "endHeight" : "" + } +} ]}] + + - parameter addresses: (body) An array of addresses. + - parameter pageSize: (query) The number of namespaces to return. (optional) + - parameter id: (query) The namespace id up to which namespace objects are returned. (optional) + + - returns: RequestBuilder<[NamespaceInfoDTO]> + */ + class func getNamespacesFromAccountsWithRequestBuilder(addresses: Addresses, pageSize: Int? = nil, id: String? = nil) -> RequestBuilder<[NamespaceInfoDTO]> { + let path = "/account/namespaces" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: addresses) + + let url = NSURLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ + "pageSize": pageSize?.encodeToJSON(), + "id": id + ]) + + + let requestBuilder: RequestBuilder<[NamespaceInfoDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Get readable names for a set of namespaces + + - parameter namespaceIds: (body) An array of namespaceIds. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNamespacesNames(namespaceIds: NamespaceIds, completion: @escaping ((_ data: [NamespaceNameDTO]?,_ error: Error?) -> Void)) { + getNamespacesNamesWithRequestBuilder(namespaceIds: namespaceIds).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get readable names for a set of namespaces + - POST /namespace/names + - Returns friendly names for mosaics. + - examples: [{contentType=application/json, example=[ { + "namespaceId" : "", + "name" : "name", + "parentId" : "" +}, { + "namespaceId" : "", + "name" : "name", + "parentId" : "" +} ]}] + + - parameter namespaceIds: (body) An array of namespaceIds. + + - returns: RequestBuilder<[NamespaceNameDTO]> + */ + class func getNamespacesNamesWithRequestBuilder(namespaceIds: NamespaceIds) -> RequestBuilder<[NamespaceNameDTO]> { + let path = "/namespace/names" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: namespaceIds) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[NamespaceNameDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NetworkRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NetworkRoutesAPI.swift new file mode 100644 index 0000000..ab6fc7d --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NetworkRoutesAPI.swift @@ -0,0 +1,53 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NetworkRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class NetworkRoutesAPI { + /** + Get the current network type of the chain + + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNetworkType(completion: @escaping ((_ data: NetworkTypeDTO?,_ error: Error?) -> Void)) { + getNetworkTypeWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get the current network type of the chain + - GET /network + - Returns the current network type. + - examples: [{contentType=application/json, example={ + "name" : "mijinTest", + "description" : "catapult development network" +}}] + + - returns: RequestBuilder + */ + class func getNetworkTypeWithRequestBuilder() -> RequestBuilder { + let path = "/network" + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NodeRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NodeRoutesAPI.swift new file mode 100644 index 0000000..aed3425 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/NodeRoutesAPI.swift @@ -0,0 +1,96 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NodeRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class NodeRoutesAPI { + /** + Get the node information + + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNodeInfo(completion: @escaping ((_ data: NodeInfoDTO?,_ error: Error?) -> Void)) { + getNodeInfoWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get the node information + - GET /node/info + - Supplies additional information about the application running on a [Node](https://nemtech.github.io/concepts/node.html). + - examples: [{contentType=application/json, example={ + "port" : 7900, + "roles" : 2, + "host" : "api-node-0", + "publicKey" : "EB6839C7E6BD0031FDD5F8CB5137E9BC950D7EE7756C46B767E68F3F58C24390", + "networkIdentifier" : 144, + "version" : 0, + "friendlyName" : "api-node-0" +}}] + + - returns: RequestBuilder + */ + class func getNodeInfoWithRequestBuilder() -> RequestBuilder { + let path = "/node/info" + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get the node time + + - parameter completion: completion handler to receive the data and the error objects + */ + class func getNodeTime(completion: @escaping ((_ data: NodeTimeDTO?,_ error: Error?) -> Void)) { + getNodeTimeWithRequestBuilder().execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get the node time + - GET /node/time + - Supplies additional information about the application running on a node. + - examples: [{contentType=application/json, example={ + "communicationTimestamps" : { + "receiveTimestamp" : "", + "sendTimestamp" : "" + } +}}] + + - returns: RequestBuilder + */ + class func getNodeTimeWithRequestBuilder() -> RequestBuilder { + let path = "/node/time" + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/APIs/TransactionRoutesAPI.swift b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/TransactionRoutesAPI.swift new file mode 100644 index 0000000..fee255e --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/APIs/TransactionRoutesAPI.swift @@ -0,0 +1,291 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// TransactionRoutesAPI.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + + + +class TransactionRoutesAPI { + /** + Announce a cosignature transaction + + - parameter payload: (body) The transaction [payload](https://github.com/nemtech/guidelines/blob/master/development/sdk-development.md#transaction-serialization). + - parameter completion: completion handler to receive the data and the error objects + */ + //class func announceCosignatureTransaction(payload: TransactionPayload, completion: @escaping ((_ data: AnyObjectDictionary?,_ error: Error?) -> Void)) { + class func announceCosignatureTransaction(payload: CosignatureSignedTransactionDTO, completion: @escaping ((_ data: AnyObjectDictionary?,_ error: Error?) -> Void)) { + announceCosignatureTransactionWithRequestBuilder(payload: payload).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Announce a cosignature transaction + - PUT /transaction/cosignature + - Announces a [cosignature transaction](https://nemtech.github.io/concepts/aggregate-transaction.html#cosignature-transaction) to the network. It is recommended to use the NEM2-SDK to announce transactions. + - examples: [{contentType=application/json, example="{}"}] + + - parameter payload: (body) The transaction [payload](https://github.com/nemtech/guidelines/blob/master/development/sdk-development.md#transaction-serialization). + + - returns: RequestBuilder + */ + //class func announceCosignatureTransactionWithRequestBuilder(payload: TransactionPayload) -> RequestBuilder { + class func announceCosignatureTransactionWithRequestBuilder(payload: CosignatureSignedTransactionDTO) -> RequestBuilder { + let path = "/transaction/cosignature" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: payload) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Announce an aggregate bonded transaction + + - parameter payload: (body) The transaction [payload](https://github.com/nemtech/guidelines/blob/master/development/sdk-development.md#transaction-serialization). + - parameter completion: completion handler to receive the data and the error objects + */ + class func announcePartialTransaction(payload: TransactionPayload, completion: @escaping ((_ data: AnyObjectDictionary?,_ error: Error?) -> Void)) { + announcePartialTransactionWithRequestBuilder(payload: payload).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Announce an aggregate bonded transaction + - PUT /transaction/partial + - Announces an [aggregate bonded transaction](https://nemtech.github.io/concepts/aggregate-transaction.html#aggregate-bonded) to the network. + - examples: [{contentType=application/json, example="{}"}] + + - parameter payload: (body) The transaction [payload](https://github.com/nemtech/guidelines/blob/master/development/sdk-development.md#transaction-serialization). + + - returns: RequestBuilder + */ + class func announcePartialTransactionWithRequestBuilder(payload: TransactionPayload) -> RequestBuilder { + let path = "/transaction/partial" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: payload) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Announce a new transaction + + - parameter payload: (body) The transaction [payload](https://github.com/nemtech/guidelines/blob/master/development/sdk-development.md#transaction-serialization). + - parameter completion: completion handler to receive the data and the error objects + */ + class func announceTransaction(payload: TransactionPayload, completion: @escaping ((_ data: AnyObjectDictionary?,_ error: Error?) -> Void)) { + announceTransactionWithRequestBuilder(payload: payload).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Announce a new transaction + - PUT /transaction + - Announces a [transaction](https://nemtech.github.io/concepts/transaction.html) to the network. It is recommended to use the NEM2-SDK to announce transactions. + - examples: [{contentType=application/json, example="{}"}] + + - parameter payload: (body) The transaction [payload](https://github.com/nemtech/guidelines/blob/master/development/sdk-development.md#transaction-serialization). + + - returns: RequestBuilder + */ + class func announceTransactionWithRequestBuilder(payload: TransactionPayload) -> RequestBuilder { + let path = "/transaction" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: payload) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Get transaction information + + - parameter transactionId: (path) The transaction id or hash. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getTransaction(transactionId: String, completion: @escaping ((_ data: AnyObjectDictionary?,_ error: Error?) -> Void)) { + getTransactionWithRequestBuilder(transactionId: transactionId).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get transaction information + - GET /transaction/{transactionId} + - Returns transaction information given a transactionId or hash. + - examples: [{contentType=application/json, example="{}"}] + + - parameter transactionId: (path) The transaction id or hash. + + - returns: RequestBuilder + */ + class func getTransactionWithRequestBuilder(transactionId: String) -> RequestBuilder { + var path = "/transaction/{transactionId}" + path = path.replacingOccurrences(of: "{transactionId}", with: "\(transactionId)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get transaction status + + - parameter hash: (path) The transaction hash. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getTransactionStatus(hash: String, completion: @escaping ((_ data: TransactionStatusDTO?,_ error: Error?) -> Void)) { + getTransactionStatusWithRequestBuilder(hash: hash).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get transaction status + - GET /transaction/{hash}/status + - Returns the transaction status for a given hash. + - examples: [{contentType=application/json, example={ + "deadline" : "", + "hash" : "hash", + "group" : "group", + "status" : "status", + "height" : "" +}}] + + - parameter hash: (path) The transaction hash. + + - returns: RequestBuilder + */ + class func getTransactionStatusWithRequestBuilder(hash: String) -> RequestBuilder { + var path = "/transaction/{hash}/status" + path = path.replacingOccurrences(of: "{hash}", with: "\(hash)", options: .literal, range: nil) + let URLString = SwaggerClientAPI.basePath + path + let parameters: [String:Any]? = nil + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get transactions information + + - parameter transactionIds: (body) An array of transaction ids or hashes. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getTransactions(transactionIds: TransactionIds, completion: @escaping ((_ data: [AnyObjectDictionary]?,_ error: Error?) -> Void)) { + getTransactionsWithRequestBuilder(transactionIds: transactionIds).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get transactions information + - POST /transaction + - Returns transactions information for a given array of transactionIds. + - examples: [{contentType=application/json, example=[ "{}", "{}" ]}] + + - parameter transactionIds: (body) An array of transaction ids or hashes. + + - returns: RequestBuilder<[Any]> + */ + class func getTransactionsWithRequestBuilder(transactionIds: TransactionIds) -> RequestBuilder<[AnyObjectDictionary]> { + let path = "/transaction" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: transactionIds) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[AnyObjectDictionary]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Get transactions status. + + - parameter transactionHashes: (body) An array of transaction hashes. + - parameter completion: completion handler to receive the data and the error objects + */ + class func getTransactionsStatuses(transactionHashes: TransactionHashes, completion: @escaping ((_ data: [TransactionStatusDTO]?,_ error: Error?) -> Void)) { + getTransactionsStatusesWithRequestBuilder(transactionHashes: transactionHashes).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + Get transactions status. + - POST /transaction/statuses + - Returns an array of transaction statuses for a given array of transaction hashes. + - examples: [{contentType=application/json, example=[ { + "deadline" : "", + "hash" : "hash", + "group" : "group", + "status" : "status", + "height" : "" +}, { + "deadline" : "", + "hash" : "hash", + "group" : "group", + "status" : "status", + "height" : "" +} ]}] + + - parameter transactionHashes: (body) An array of transaction hashes. + + - returns: RequestBuilder<[TransactionStatusDTO]> + */ + class func getTransactionsStatusesWithRequestBuilder(transactionHashes: TransactionHashes) -> RequestBuilder<[TransactionStatusDTO]> { + let path = "/transaction/statuses" + let URLString = SwaggerClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: transactionHashes) + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder<[TransactionStatusDTO]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/AlamofireImplementations.swift b/Nem2SdkSwift/sdk/infrastructure/raw/AlamofireImplementations.swift new file mode 100644 index 0000000..dcbc38b --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/AlamofireImplementations.swift @@ -0,0 +1,416 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// AlamofireImplementations.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + +class AlamofireRequestBuilderFactory: RequestBuilderFactory { + func getNonDecodableBuilder() -> RequestBuilder.Type { + return AlamofireRequestBuilder.self + } + + func getBuilder() -> RequestBuilder.Type { + return AlamofireDecodableRequestBuilder.self + } +} + +// Store manager to retain its reference +private var managerStore: [String: Alamofire.SessionManager] = [:] + +class AlamofireRequestBuilder: RequestBuilder { + required init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) + } + + /** + May be overridden by a subclass if you want to control the session + configuration. + */ + func createSessionManager() -> Alamofire.SessionManager { + let configuration = URLSessionConfiguration.default + configuration.httpAdditionalHeaders = buildHeaders() + return Alamofire.SessionManager(configuration: configuration) + } + + /** + May be overridden by a subclass if you want to control the Content-Type + that is given to an uploaded form part. + + Return nil to use the default behavior (inferring the Content-Type from + the file extension). Return the desired Content-Type otherwise. + */ + func contentTypeForFormPart(fileURL: URL) -> String? { + return nil + } + + /** + May be overridden by a subclass if you want to control the request + configuration (e.g. to override the cache policy). + */ + func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest { + return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) + } + + override func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + let managerId:String = UUID().uuidString + // Create a new manager for each request to customize its request header + let manager = createSessionManager() + managerStore[managerId] = manager + + let encoding:ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() + + let xMethod = Alamofire.HTTPMethod(rawValue: method) + let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL } + .map { $0.0 } + + if fileKeys.count > 0 { + manager.upload(multipartFormData: { mpForm in + for (k, v) in self.parameters! { + switch v { + case let fileURL as URL: + if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) { + mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType) + } + else { + mpForm.append(fileURL, withName: k) + } + case let string as String: + mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) + case let number as NSNumber: + mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) + default: + fatalError("Unprocessable value \(v) with key \(k)") + } + } + }, to: URLString, method: xMethod!, headers: nil, encodingCompletion: { encodingResult in + switch encodingResult { + case .success(let upload, _, _): + if let onProgressReady = self.onProgressReady { + onProgressReady(upload.uploadProgress) + } + self.processRequest(request: upload, managerId, completion) + case .failure(let encodingError): + completion(nil, ErrorResponse.error(415, nil, encodingError)) + } + }) + } else { + let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers) + if let onProgressReady = self.onProgressReady { + onProgressReady(request.progress) + } + processRequest(request: request, managerId, completion) + } + + } + + fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + if let credential = self.credential { + request.authenticate(usingCredential: credential) + } + + let cleanupRequest = { + _ = managerStore.removeValue(forKey: managerId) + } + + let validatedRequest = request.validate() + + switch T.self { + case is String.Type: + validatedRequest.responseString(completionHandler: { (stringResponse) in + cleanupRequest() + + if stringResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, stringResponse.result.error as Error!) + ) + return + } + + completion( + Response( + response: stringResponse.response!, + body: ((stringResponse.result.value ?? "") as! T) + ), + nil + ) + }) + case is URL.Type: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + do { + + guard !dataResponse.result.isFailure else { + throw DownloadException.responseFailed + } + + guard let data = dataResponse.data else { + throw DownloadException.responseDataMissing + } + + guard let request = request.request else { + throw DownloadException.requestMissing + } + + let fileManager = FileManager.default + let urlRequest = try request.asURLRequest() + let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] + let requestURL = try self.getURL(from: urlRequest) + + var requestPath = try self.getPath(from: requestURL) + + if let headerFileName = self.getFileName(fromContentDisposition: dataResponse.response?.allHeaderFields["Content-Disposition"] as? String) { + requestPath = requestPath.appending("/\(headerFileName)") + } + + let filePath = documentsDirectory.appendingPathComponent(requestPath) + let directoryPath = filePath.deletingLastPathComponent().path + + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) + try data.write(to: filePath, options: .atomic) + + completion( + Response( + response: dataResponse.response!, + body: (filePath as! T) + ), + nil + ) + + } catch let requestParserError as DownloadException { + completion(nil, ErrorResponse.error(400, dataResponse.data, requestParserError)) + } catch let error { + completion(nil, ErrorResponse.error(400, dataResponse.data, error)) + } + return + }) + case is Void.Type: + validatedRequest.responseData(completionHandler: { (voidResponse) in + cleanupRequest() + + if voidResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, voidResponse.result.error!) + ) + return + } + + completion( + Response( + response: voidResponse.response!, + body: nil), + nil + ) + }) + default: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + if dataResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!) + ) + return + } + + completion( + Response( + response: dataResponse.response!, + body: (dataResponse.data as! T) + ), + nil + ) + }) + } + } + + func buildHeaders() -> [String: String] { + var httpHeaders = SessionManager.defaultHTTPHeaders + for (key, value) in self.headers { + httpHeaders[key] = value + } + return httpHeaders + } + + fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + + guard let contentDisposition = contentDisposition else { + return nil + } + + let items = contentDisposition.components(separatedBy: ";") + + var filename : String? = nil + + for contentItem in items { + + let filenameKey = "filename=" + guard let range = contentItem.range(of: filenameKey) else { + break + } + + filename = contentItem + return filename? + .replacingCharacters(in: range, with:"") + .replacingOccurrences(of: "\"", with: "") + .trimmingCharacters(in: .whitespacesAndNewlines) + } + + return filename + + } + + fileprivate func getPath(from url : URL) throws -> String { + + guard var path = NSURLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { + throw DownloadException.requestMissingPath + } + + if path.hasPrefix("/") { + path.remove(at: path.startIndex) + } + + return path + + } + + fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + return url + } + +} + +fileprivate enum DownloadException : Error { + case responseDataMissing + case responseFailed + case requestMissing + case requestMissingPath + case requestMissingURL +} + +enum AlamofireDecodableRequestBuilderError: Error { + case emptyDataResponse + case nilHTTPResponse + case jsonDecoding(DecodingError) + case generalError(Error) +} + +class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { + + override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { + if let credential = self.credential { + request.authenticate(usingCredential: credential) + } + + let cleanupRequest = { + _ = managerStore.removeValue(forKey: managerId) + } + + let validatedRequest = request.validate() + + switch T.self { + case is String.Type: + validatedRequest.responseString(completionHandler: { (stringResponse) in + cleanupRequest() + + if stringResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, stringResponse.result.error as Error!) + ) + return + } + + completion( + Response( + response: stringResponse.response!, + body: ((stringResponse.result.value ?? "") as! T) + ), + nil + ) + }) + case is Void.Type: + validatedRequest.responseData(completionHandler: { (voidResponse) in + cleanupRequest() + + if voidResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, voidResponse.result.error!) + ) + return + } + + completion( + Response( + response: voidResponse.response!, + body: nil), + nil + ) + }) + case is Data.Type: + validatedRequest.responseData(completionHandler: { (dataResponse) in + cleanupRequest() + + if dataResponse.result.isFailure { + completion( + nil, + ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!) + ) + return + } + + completion( + Response( + response: dataResponse.response!, + body: (dataResponse.data as! T) + ), + nil + ) + }) + default: + validatedRequest.responseData(completionHandler: { (dataResponse: DataResponse) in + cleanupRequest() + + guard dataResponse.result.isSuccess else { + completion(nil, ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, dataResponse.result.error!)) + return + } + + guard let data = dataResponse.data, !data.isEmpty else { + completion(nil, ErrorResponse.error(-1, nil, AlamofireDecodableRequestBuilderError.emptyDataResponse)) + return + } + + guard let httpResponse = dataResponse.response else { + completion(nil, ErrorResponse.error(-2, nil, AlamofireDecodableRequestBuilderError.nilHTTPResponse)) + return + } + + var responseObj: Response? = nil + + let decodeResult: (decodableObj: T?, error: Error?) = CodableHelper.decode(T.self, from: data) + if decodeResult.error == nil { + responseObj = Response(response: httpResponse, body: decodeResult.decodableObj) + } + + completion(responseObj, decodeResult.error) + }) + } + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/AnyObjectDictionary.swift b/Nem2SdkSwift/sdk/infrastructure/raw/AnyObjectDictionary.swift new file mode 100644 index 0000000..4e29442 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/AnyObjectDictionary.swift @@ -0,0 +1,151 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +enum AnyObjectDictionary: Codable { + case integer(Int64) + case double(Double) + case string(String) + case boolean(Bool) + case array([AnyObjectDictionary]) + case object([String: AnyObjectDictionary]) + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let bool = try? container.decode(Bool.self) { + self = .boolean(bool) + } else if let string = try? container.decode(String.self) { + self = .string(string) + } else if let int = try? container.decode(Int64.self) { + self = .integer(int) + } else if let number = try? container.decode(Double.self) { + self = .double(number) + } else if let array = try? container.decode([AnyObjectDictionary].self) { + self = .array(array) + } else if let dict = try? container.decode([String: AnyObjectDictionary].self) { + self = .object(dict) + } else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "Could not decode data into a JSON-compatible value") + } + } + + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case .integer(let int): + try container.encode(int) + case .double(let number): + try container.encode(number) + case .string(let string): + try container.encode(string) + case .boolean(let bool): + try container.encode(bool) + case .array(let jsonArray): + try container.encode(jsonArray) + case .object(let jsonObject): + try container.encode(jsonObject) + } + } +} + +/* +struct AnyCodingKeys: CodingKey { + var stringValue: String + var intValue: Int? + + init?(stringValue: String) { self.stringValue = stringValue } + + init?(intValue: Int) { + self.stringValue = String(intValue) + self.intValue = intValue + } +} + +extension KeyedDecodingContainer { + func decode(_ type: [Any].Type, forKey key: K) throws -> [Any] { + var container = try self.nestedUnkeyedContainer(forKey: key) + return try container.decode(type) + } + + func decodeIfPresent(_ type: [Any].Type, forKey key: K) throws -> [Any]? { + guard contains(key) else { return .none } + return try decode(type, forKey: key) + } + + func decode(_ type: [String:Any].Type, forKey key: K) throws -> [String:Any] { + let container = try nestedContainer(keyedBy: AnyCodingKeys.self, forKey: key) + return try container.decode(type) + } + + func decodeIfPresent(_ type: [String:Any].Type, forKey key: K) throws -> [String:Any]? { + guard contains(key) else { return .none } + return try decode(type, forKey: key) + } + + func decode(_ type: [String:Any].Type) throws -> [String:Any] { + var dictionary = [String:Any]() + + allKeys.forEach { key in + if let value = try? decode(Bool.self, forKey: key) { + dictionary[key.stringValue] = value + } else if let value = try? decode(String.self, forKey: key) { + dictionary[key.stringValue] = value + } else if let value = try? decode(Int64.self, forKey: key) { + dictionary[key.stringValue] = value + } else if let value = try? decode(Double.self, forKey: key) { + dictionary[key.stringValue] = value + } else if let value = try? decode([String:Any].self, forKey: key) { + dictionary[key.stringValue] = value + } else if let value = try? decode([Any].self, forKey: key) { + dictionary[key.stringValue] = value + } + } + + return dictionary + } +} + +extension UnkeyedDecodingContainer { + mutating func decode(_ type: [Any].Type) throws -> [Any] { + var array = [Any]() + + while isAtEnd == false { + if let value = try? decode(Bool.self) { + array.append(value) + } else if let value = try? decode(String.self) { + array.append(value) + } else if let value = try? decode(Int64.self) { + array.append(value) + } else if let value = try? decode(Double.self) { + array.append(value) + } else if let value = try? decode([String:Any].self) { + array.append(value) + } else if let value = try? decode([Any].self) { + array.append(value) + } + } + + return array + } + + mutating func decode(_ type: [String:Any].Type) throws -> [String:Any] { + let nestedContainer = try self.nestedContainer(keyedBy: AnyCodingKeys.self) + return try nestedContainer.decode(type) + } +} + +struct AnyObjectDictionary: Codable { + let items: [String:Any] + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: AnyCodingKeys.self) + items = try container.decode([String:Any].self) + } + + func encode(to encoder: Encoder) throws { + return + } +} +*/ diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/CodableHelper.swift b/Nem2SdkSwift/sdk/infrastructure/raw/CodableHelper.swift new file mode 100644 index 0000000..aca5e5f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/CodableHelper.swift @@ -0,0 +1,70 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// CodableHelper.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + +typealias EncodeResult = (data: Data?, error: Error?) + +class CodableHelper { + + static var dateformatter: DateFormatter? + + class func decode(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T : Decodable { + var returnedDecodable: T? = nil + var returnedError: Error? = nil + + let decoder = JSONDecoder() + if let df = self.dateformatter { + decoder.dateDecodingStrategy = .formatted(df) + } else { + decoder.dataDecodingStrategy = .base64 + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + decoder.dateDecodingStrategy = .formatted(formatter) + } + + do { + returnedDecodable = try decoder.decode(type, from: data) + } catch { + returnedError = error + } + + return (returnedDecodable, returnedError) + } + + class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T : Encodable { + var returnedData: Data? + var returnedError: Error? = nil + + let encoder = JSONEncoder() + if prettyPrint { + encoder.outputFormatting = .prettyPrinted + } + encoder.dataEncodingStrategy = .base64 + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + + do { + returnedData = try encoder.encode(value) + } catch { + returnedError = error + } + + return (returnedData, returnedError) + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Configuration.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Configuration.swift new file mode 100644 index 0000000..e47cacd --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Configuration.swift @@ -0,0 +1,18 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// Configuration.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + +class Configuration { + + // This value is used to configure the date formatter that is used to serialize dates into JSON format. + // You must set it prior to encoding any dates, and it will only be read once. + static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Extensions.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Extensions.swift new file mode 100644 index 0000000..bdb60e1 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Extensions.swift @@ -0,0 +1,176 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// Extensions.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + +extension Bool: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Float: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int32: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } +} + +extension Int64: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } +} + +extension Double: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension String: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +private func encodeIfPossible(_ object: T) -> Any { + if let encodableObject = object as? JSONEncodable { + return encodableObject.encodeToJSON() + } else { + return object as Any + } +} + +extension Array: JSONEncodable { + func encodeToJSON() -> Any { + return self.map(encodeIfPossible) + } +} + +extension Dictionary: JSONEncodable { + func encodeToJSON() -> Any { + var dictionary = [AnyHashable: Any]() + for (key, value) in self { + dictionary[key] = encodeIfPossible(value) + } + return dictionary as Any + } +} + +extension Data: JSONEncodable { + func encodeToJSON() -> Any { + return self.base64EncodedString(options: Data.Base64EncodingOptions()) + } +} + +private let dateFormatter: DateFormatter = { + let fmt = DateFormatter() + fmt.dateFormat = Configuration.dateFormat + fmt.locale = Locale(identifier: "en_US_POSIX") + return fmt +}() + +extension Date: JSONEncodable { + func encodeToJSON() -> Any { + return dateFormatter.string(from: self) as Any + } +} + +extension UUID: JSONEncodable { + func encodeToJSON() -> Any { + return self.uuidString + } +} + +extension String: CodingKey { + + public var stringValue: String { + return self + } + + public init?(stringValue: String) { + self.init(stringLiteral: stringValue) + } + + public var intValue: Int? { + return nil + } + + public init?(intValue: Int) { + return nil + } + +} + +extension KeyedEncodingContainerProtocol { + + mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + var arrayContainer = nestedUnkeyedContainer(forKey: key) + try arrayContainer.encode(contentsOf: values) + } + + mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + if let values = values { + try encodeArray(values, forKey: key) + } + } + + mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T : Encodable { + for (key, value) in pairs { + try encode(value, forKey: key) + } + } + + mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T : Encodable { + if let pairs = pairs { + try encodeMap(pairs) + } + } + +} + +extension KeyedDecodingContainerProtocol { + + func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + var tmpArray = [T]() + + var nestedContainer = try nestedUnkeyedContainer(forKey: key) + while !nestedContainer.isAtEnd { + let arrayValue = try nestedContainer.decode(T.self) + tmpArray.append(arrayValue) + } + + return tmpArray + } + + func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { + var tmpArray: [T]? = nil + + if contains(key) { + tmpArray = try decodeArray(T.self, forKey: key) + } + + return tmpArray + } + + func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T : Decodable { + var map: [Self.Key : T] = [:] + + for key in allKeys { + if !excludedKeys.contains(key) { + let value = try decode(T.self, forKey: key) + map[key] = value + } + } + + return map + } + +} + + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/JSONEncodableEncoding.swift b/Nem2SdkSwift/sdk/infrastructure/raw/JSONEncodableEncoding.swift new file mode 100644 index 0000000..e53a101 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/JSONEncodableEncoding.swift @@ -0,0 +1,57 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// JSONDataEncoding.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + +struct JSONDataEncoding: ParameterEncoding { + + // MARK: Properties + + private static let jsonDataKey = "jsonData" + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. This should have a single key/value + /// pair with "jsonData" as the key and a Data object as the value. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { + return urlRequest + } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = jsonData + + return urlRequest + } + + static func encodingParameters(jsonData: Data?) -> Parameters? { + var returnedParams: Parameters? = nil + if let jsonData = jsonData, !jsonData.isEmpty { + var params = Parameters() + params[jsonDataKey] = jsonData + returnedParams = params + } + return returnedParams + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/JSONEncodingHelper.swift b/Nem2SdkSwift/sdk/infrastructure/raw/JSONEncodingHelper.swift new file mode 100644 index 0000000..dfc89f5 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/JSONEncodingHelper.swift @@ -0,0 +1,31 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +// JSONEncodingHelper.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation +import Alamofire + +class JSONEncodingHelper { + + class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { + var params: Parameters? = nil + + // Encode the Encodable object + if let encodableObj = encodableObj { + let encodeResult = CodableHelper.encode(encodableObj, prettyPrint: true) + if encodeResult.error == nil { + params = JSONDataEncoding.encodingParameters(jsonData: encodeResult.data) + } + } + + return params + } + +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models.swift new file mode 100644 index 0000000..572e936 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models.swift @@ -0,0 +1,40 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Models.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + +protocol JSONEncodable { + func encodeToJSON() -> Any +} + +enum ErrorResponse : Error { + case error(Int, Data?, Error) +} + +class Response { + let statusCode: Int + let header: [String: String] + let body: T? + + init(statusCode: Int, header: [String: String], body: T?) { + self.statusCode = statusCode + self.header = header + self.body = body + } + + convenience init(response: HTTPURLResponse, body: T?) { + let rawHeader = response.allHeaderFields + var header = [String:String]() + for case let (key, value) as (String, String) in rawHeader { + header[key] = value + } + self.init(statusCode: response.statusCode, header: header, body: body) + } +} diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountDTO.swift new file mode 100644 index 0000000..8773c26 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountDTO.swift @@ -0,0 +1,67 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// AccountDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class AccountDTO: Codable { + + var address: String + var addressHeight: UInt64DTO + var publicKey: String + var publicKeyHeight: UInt64DTO + var mosaics: [MosaicDTO] + var importance: UInt64DTO + var importanceHeight: UInt64DTO + + + + init(address: String, addressHeight: UInt64DTO, publicKey: String, publicKeyHeight: UInt64DTO, mosaics: [MosaicDTO], importance: UInt64DTO, importanceHeight: UInt64DTO) { + self.address = address + self.addressHeight = addressHeight + self.publicKey = publicKey + self.publicKeyHeight = publicKeyHeight + self.mosaics = mosaics + self.importance = importance + self.importanceHeight = importanceHeight + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(address, forKey: "address") + try container.encode(addressHeight, forKey: "addressHeight") + try container.encode(publicKey, forKey: "publicKey") + try container.encode(publicKeyHeight, forKey: "publicKeyHeight") + try container.encode(mosaics, forKey: "mosaics") + try container.encode(importance, forKey: "importance") + try container.encode(importanceHeight, forKey: "importanceHeight") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + address = try container.decode(String.self, forKey: "address") + addressHeight = try container.decode(UInt64DTO.self, forKey: "addressHeight") + publicKey = try container.decode(String.self, forKey: "publicKey") + publicKeyHeight = try container.decode(UInt64DTO.self, forKey: "publicKeyHeight") + mosaics = try container.decode([MosaicDTO].self, forKey: "mosaics") + importance = try container.decode(UInt64DTO.self, forKey: "importance") + importanceHeight = try container.decode(UInt64DTO.self, forKey: "importanceHeight") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountInfoDTO.swift new file mode 100644 index 0000000..adedc12 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountInfoDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// AccountInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class AccountInfoDTO: Codable { + + var meta: AccountMetaDTO + var account: AccountDTO + + + + init(meta: AccountMetaDTO, account: AccountDTO) { + self.meta = meta + self.account = account + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(meta, forKey: "meta") + try container.encode(account, forKey: "account") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + meta = try container.decode(AccountMetaDTO.self, forKey: "meta") + account = try container.decode(AccountDTO.self, forKey: "account") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountMetaDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountMetaDTO.swift new file mode 100644 index 0000000..5bcb6df --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AccountMetaDTO.swift @@ -0,0 +1,36 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// AccountMetaDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class AccountMetaDTO: Codable { + + + + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + //var container = encoder.container(keyedBy: String.self) + + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + // let container = try decoder.container(keyedBy: String.self) + + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/Addresses.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/Addresses.swift new file mode 100644 index 0000000..e714673 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/Addresses.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// Addresses.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class Addresses: Codable { + + var addresses: [String]? + + + + init(addresses: [String]?) { + self.addresses = addresses + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(addresses, forKey: "addresses") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + addresses = try container.decodeIfPresent([String].self, forKey: "addresses") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/AnnounceTransactionInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AnnounceTransactionInfoDTO.swift new file mode 100644 index 0000000..449250f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/AnnounceTransactionInfoDTO.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// AnnounceTransactionInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class AnnounceTransactionInfoDTO: Codable { + + var message: String + + + + init(message: String) { + self.message = message + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(message, forKey: "message") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + message = try container.decode(String.self, forKey: "message") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockDTO.swift new file mode 100644 index 0000000..1a4a011 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockDTO.swift @@ -0,0 +1,75 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// BlockDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class BlockDTO: Codable { + + var signature: String + var signer: String + var version: Double + var type: Double + var height: UInt64DTO + var timestamp: UInt64DTO + var difficulty: UInt64DTO + var previousBlockHash: String + var blockTransactionsHash: String + + + + init(signature: String, signer: String, version: Double, type: Double, height: UInt64DTO, timestamp: UInt64DTO, difficulty: UInt64DTO, previousBlockHash: String, blockTransactionsHash: String) { + self.signature = signature + self.signer = signer + self.version = version + self.type = type + self.height = height + self.timestamp = timestamp + self.difficulty = difficulty + self.previousBlockHash = previousBlockHash + self.blockTransactionsHash = blockTransactionsHash + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(signature, forKey: "signature") + try container.encode(signer, forKey: "signer") + try container.encode(version, forKey: "version") + try container.encode(type, forKey: "type") + try container.encode(height, forKey: "height") + try container.encode(timestamp, forKey: "timestamp") + try container.encode(difficulty, forKey: "difficulty") + try container.encode(previousBlockHash, forKey: "previousBlockHash") + try container.encode(blockTransactionsHash, forKey: "blockTransactionsHash") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + signature = try container.decode(String.self, forKey: "signature") + signer = try container.decode(String.self, forKey: "signer") + version = try container.decode(Double.self, forKey: "version") + type = try container.decode(Double.self, forKey: "type") + height = try container.decode(UInt64DTO.self, forKey: "height") + timestamp = try container.decode(UInt64DTO.self, forKey: "timestamp") + difficulty = try container.decode(UInt64DTO.self, forKey: "difficulty") + previousBlockHash = try container.decode(String.self, forKey: "previousBlockHash") + blockTransactionsHash = try container.decode(String.self, forKey: "blockTransactionsHash") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockInfoDTO.swift new file mode 100644 index 0000000..261bebf --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockInfoDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// BlockInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class BlockInfoDTO: Codable { + + var meta: BlockMetaDTO + var block: BlockDTO + + + + init(meta: BlockMetaDTO, block: BlockDTO) { + self.meta = meta + self.block = block + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(meta, forKey: "meta") + try container.encode(block, forKey: "block") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + meta = try container.decode(BlockMetaDTO.self, forKey: "meta") + block = try container.decode(BlockDTO.self, forKey: "block") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockMetaDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockMetaDTO.swift new file mode 100644 index 0000000..c53deec --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockMetaDTO.swift @@ -0,0 +1,55 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// BlockMetaDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class BlockMetaDTO: Codable { + + var hash: String + var generationHash: String + var totalFee: UInt64DTO + var numTransactions: Double + + + + init(hash: String, generationHash: String, totalFee: UInt64DTO, numTransactions: Double) { + self.hash = hash + self.generationHash = generationHash + self.totalFee = totalFee + self.numTransactions = numTransactions + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(hash, forKey: "hash") + try container.encode(generationHash, forKey: "generationHash") + try container.encode(totalFee, forKey: "totalFee") + try container.encode(numTransactions, forKey: "numTransactions") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + hash = try container.decode(String.self, forKey: "hash") + generationHash = try container.decode(String.self, forKey: "generationHash") + totalFee = try container.decode(UInt64DTO.self, forKey: "totalFee") + numTransactions = try container.decode(Double.self, forKey: "numTransactions") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockchainScoreDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockchainScoreDTO.swift new file mode 100644 index 0000000..4459d1c --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockchainScoreDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// BlockchainScoreDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class BlockchainScoreDTO: Codable { + + var scoreHigh: UInt64DTO + var scoreLow: UInt64DTO + + + + init(scoreHigh: UInt64DTO, scoreLow: UInt64DTO) { + self.scoreHigh = scoreHigh + self.scoreLow = scoreLow + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(scoreHigh, forKey: "scoreHigh") + try container.encode(scoreLow, forKey: "scoreLow") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + scoreHigh = try container.decode(UInt64DTO.self, forKey: "scoreHigh") + scoreLow = try container.decode(UInt64DTO.self, forKey: "scoreLow") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockchainStorageInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockchainStorageInfoDTO.swift new file mode 100644 index 0000000..0c813ce --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/BlockchainStorageInfoDTO.swift @@ -0,0 +1,51 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// BlockchainStorageInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class BlockchainStorageInfoDTO: Codable { + + var numBlocks: Int + var numTransactions: Int + var numAccounts: Int + + + + init(numBlocks: Int, numTransactions: Int, numAccounts: Int) { + self.numBlocks = numBlocks + self.numTransactions = numTransactions + self.numAccounts = numAccounts + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(numBlocks, forKey: "numBlocks") + try container.encode(numTransactions, forKey: "numTransactions") + try container.encode(numAccounts, forKey: "numAccounts") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + numBlocks = try container.decode(Int.self, forKey: "numBlocks") + numTransactions = try container.decode(Int.self, forKey: "numTransactions") + numAccounts = try container.decode(Int.self, forKey: "numAccounts") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/CommunicationTimestamps.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/CommunicationTimestamps.swift new file mode 100644 index 0000000..109dda2 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/CommunicationTimestamps.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// CommunicationTimestamps.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class CommunicationTimestamps: Codable { + + var sendTimestamp: UInt64DTO? + var receiveTimestamp: UInt64DTO? + + + + init(sendTimestamp: UInt64DTO?, receiveTimestamp: UInt64DTO?) { + self.sendTimestamp = sendTimestamp + self.receiveTimestamp = receiveTimestamp + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(sendTimestamp, forKey: "sendTimestamp") + try container.encodeIfPresent(receiveTimestamp, forKey: "receiveTimestamp") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + sendTimestamp = try container.decodeIfPresent(UInt64DTO.self, forKey: "sendTimestamp") + receiveTimestamp = try container.decodeIfPresent(UInt64DTO.self, forKey: "receiveTimestamp") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/CosignatureSignedTransactionDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/CosignatureSignedTransactionDTO.swift new file mode 100644 index 0000000..0c6199e --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/CosignatureSignedTransactionDTO.swift @@ -0,0 +1,12 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +struct CosignatureSignedTransactionDTO: Codable { + let parentHash: String + let signature: String + let signer: String +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/HeightDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/HeightDTO.swift new file mode 100644 index 0000000..ab19a1e --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/HeightDTO.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// HeightDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class HeightDTO: Codable { + + var height: UInt64DTO + + + + init(height: UInt64DTO) { + self.height = height + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(height, forKey: "height") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + height = try container.decode(UInt64DTO.self, forKey: "height") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicDTO.swift new file mode 100644 index 0000000..f8252bd --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MosaicDTO: Codable { + + var id: UInt64DTO + var amount: UInt64DTO + + + + init(id: UInt64DTO, amount: UInt64DTO) { + self.id = id + self.amount = amount + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(id, forKey: "id") + try container.encode(amount, forKey: "amount") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + id = try container.decode(UInt64DTO.self, forKey: "id") + amount = try container.decode(UInt64DTO.self, forKey: "amount") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicDefinitionDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicDefinitionDTO.swift new file mode 100644 index 0000000..0fa7e6f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicDefinitionDTO.swift @@ -0,0 +1,67 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicDefinitionDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MosaicDefinitionDTO: Codable { + + var namespaceId: UInt64DTO + var mosaicId: UInt64DTO + var supply: UInt64DTO + var height: UInt64DTO + var owner: String + var properties: MosaicPropertiesDTO + var levy: AnyObjectDictionary + + + + init(namespaceId: UInt64DTO, mosaicId: UInt64DTO, supply: UInt64DTO, height: UInt64DTO, owner: String, properties: MosaicPropertiesDTO, levy: AnyObjectDictionary) { + self.namespaceId = namespaceId + self.mosaicId = mosaicId + self.supply = supply + self.height = height + self.owner = owner + self.properties = properties + self.levy = levy + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(namespaceId, forKey: "namespaceId") + try container.encode(mosaicId, forKey: "mosaicId") + try container.encode(supply, forKey: "supply") + try container.encode(height, forKey: "height") + try container.encode(owner, forKey: "owner") + try container.encode(properties, forKey: "properties") + try container.encode(levy, forKey: "levy") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + namespaceId = try container.decode(UInt64DTO.self, forKey: "namespaceId") + mosaicId = try container.decode(UInt64DTO.self, forKey: "mosaicId") + supply = try container.decode(UInt64DTO.self, forKey: "supply") + height = try container.decode(UInt64DTO.self, forKey: "height") + owner = try container.decode(String.self, forKey: "owner") + properties = try container.decode(MosaicPropertiesDTO.self, forKey: "properties") + levy = try container.decode(AnyObjectDictionary.self, forKey: "levy") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicIds.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicIds.swift new file mode 100644 index 0000000..1c40b07 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicIds.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicIds.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MosaicIds: Codable { + + var mosaicIds: [String]? + + + + init(mosaicIds: [String]?) { + self.mosaicIds = mosaicIds + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(mosaicIds, forKey: "mosaicIds") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + mosaicIds = try container.decodeIfPresent([String].self, forKey: "mosaicIds") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicInfoDTO.swift new file mode 100644 index 0000000..b70a7b9 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicInfoDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MosaicInfoDTO: Codable { + + var meta: NamespaceMosaicMetaDTO + var mosaic: MosaicDefinitionDTO + + + + init(meta: NamespaceMosaicMetaDTO, mosaic: MosaicDefinitionDTO) { + self.meta = meta + self.mosaic = mosaic + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(meta, forKey: "meta") + try container.encode(mosaic, forKey: "mosaic") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + meta = try container.decode(NamespaceMosaicMetaDTO.self, forKey: "meta") + mosaic = try container.decode(MosaicDefinitionDTO.self, forKey: "mosaic") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicNameDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicNameDTO.swift new file mode 100644 index 0000000..f919c24 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicNameDTO.swift @@ -0,0 +1,51 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicNameDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MosaicNameDTO: Codable { + + var parentId: UInt64DTO + var mosaicId: UInt64DTO + var name: String + + + + init(parentId: UInt64DTO, mosaicId: UInt64DTO, name: String) { + self.parentId = parentId + self.mosaicId = mosaicId + self.name = name + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(parentId, forKey: "parentId") + try container.encode(mosaicId, forKey: "mosaicId") + try container.encode(name, forKey: "name") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + parentId = try container.decode(UInt64DTO.self, forKey: "parentId") + mosaicId = try container.decode(UInt64DTO.self, forKey: "mosaicId") + name = try container.decode(String.self, forKey: "name") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicPropertiesDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicPropertiesDTO.swift new file mode 100644 index 0000000..3de7cb7 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MosaicPropertiesDTO.swift @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MosaicPropertiesDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +typealias MosaicPropertiesDTO = [UInt64DTO] diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/Multisig.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/Multisig.swift new file mode 100644 index 0000000..96afd8a --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/Multisig.swift @@ -0,0 +1,63 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// Multisig.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class Multisig: Codable { + + var account: String + var accountAddress: String? + var minApproval: Int + var minRemoval: Int + var cosignatories: [String] + var multisigAccounts: [String] + + + + init(account: String, accountAddress: String?, minApproval: Int, minRemoval: Int, cosignatories: [String], multisigAccounts: [String]) { + self.account = account + self.accountAddress = accountAddress + self.minApproval = minApproval + self.minRemoval = minRemoval + self.cosignatories = cosignatories + self.multisigAccounts = multisigAccounts + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(account, forKey: "account") + try container.encodeIfPresent(accountAddress, forKey: "accountAddress") + try container.encode(minApproval, forKey: "minApproval") + try container.encode(minRemoval, forKey: "minRemoval") + try container.encode(cosignatories, forKey: "cosignatories") + try container.encode(multisigAccounts, forKey: "multisigAccounts") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + account = try container.decode(String.self, forKey: "account") + accountAddress = try container.decodeIfPresent(String.self, forKey: "accountAddress") + minApproval = try container.decode(Int.self, forKey: "minApproval") + minRemoval = try container.decode(Int.self, forKey: "minRemoval") + cosignatories = try container.decode([String].self, forKey: "cosignatories") + multisigAccounts = try container.decode([String].self, forKey: "multisigAccounts") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MultisigAccountGraphInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MultisigAccountGraphInfoDTO.swift new file mode 100644 index 0000000..0057cc9 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MultisigAccountGraphInfoDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MultisigAccountGraphInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MultisigAccountGraphInfoDTO: Codable { + + var level: Int + var multisigEntries: [MultisigAccountInfoDTO] + + + + init(level: Int, multisigEntries: [MultisigAccountInfoDTO]) { + self.level = level + self.multisigEntries = multisigEntries + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(level, forKey: "level") + try container.encode(multisigEntries, forKey: "multisigEntries") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + level = try container.decode(Int.self, forKey: "level") + multisigEntries = try container.decode([MultisigAccountInfoDTO].self, forKey: "multisigEntries") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/MultisigAccountInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MultisigAccountInfoDTO.swift new file mode 100644 index 0000000..16ce758 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/MultisigAccountInfoDTO.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// MultisigAccountInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class MultisigAccountInfoDTO: Codable { + + var multisig: Multisig + + + + init(multisig: Multisig) { + self.multisig = multisig + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(multisig, forKey: "multisig") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + multisig = try container.decode(Multisig.self, forKey: "multisig") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceDTO.swift new file mode 100644 index 0000000..30bc50f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceDTO.swift @@ -0,0 +1,79 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NamespaceDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NamespaceDTO: Codable { + + var type: Int + var depth: Int + var level0: UInt64DTO + var level1: UInt64DTO? + var level2: UInt64DTO? + var parentId: UInt64DTO + var owner: String + var ownerAddress: String? + var startHeight: UInt64DTO + var endHeight: UInt64DTO + + + + init(type: Int, depth: Int, level0: UInt64DTO, level1: UInt64DTO?, level2: UInt64DTO?, parentId: UInt64DTO, owner: String, ownerAddress: String?, startHeight: UInt64DTO, endHeight: UInt64DTO) { + self.type = type + self.depth = depth + self.level0 = level0 + self.level1 = level1 + self.level2 = level2 + self.parentId = parentId + self.owner = owner + self.ownerAddress = ownerAddress + self.startHeight = startHeight + self.endHeight = endHeight + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(type, forKey: "type") + try container.encode(depth, forKey: "depth") + try container.encode(level0, forKey: "level0") + try container.encodeIfPresent(level1, forKey: "level1") + try container.encodeIfPresent(level2, forKey: "level2") + try container.encode(parentId, forKey: "parentId") + try container.encode(owner, forKey: "owner") + try container.encodeIfPresent(ownerAddress, forKey: "ownerAddress") + try container.encode(startHeight, forKey: "startHeight") + try container.encode(endHeight, forKey: "endHeight") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + type = try container.decode(Int.self, forKey: "type") + depth = try container.decode(Int.self, forKey: "depth") + level0 = try container.decode(UInt64DTO.self, forKey: "level0") + level1 = try container.decodeIfPresent(UInt64DTO.self, forKey: "level1") + level2 = try container.decodeIfPresent(UInt64DTO.self, forKey: "level2") + parentId = try container.decode(UInt64DTO.self, forKey: "parentId") + owner = try container.decode(String.self, forKey: "owner") + ownerAddress = try container.decodeIfPresent(String.self, forKey: "ownerAddress") + startHeight = try container.decode(UInt64DTO.self, forKey: "startHeight") + endHeight = try container.decode(UInt64DTO.self, forKey: "endHeight") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceIds.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceIds.swift new file mode 100644 index 0000000..da652b7 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceIds.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NamespaceIds.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NamespaceIds: Codable { + + var namespaceIds: [String]? + + + + init(namespaceIds: [String]?) { + self.namespaceIds = namespaceIds + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(namespaceIds, forKey: "namespaceIds") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + namespaceIds = try container.decodeIfPresent([String].self, forKey: "namespaceIds") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceInfoDTO.swift new file mode 100644 index 0000000..f783e80 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceInfoDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NamespaceInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NamespaceInfoDTO: Codable { + + var meta: NamespaceMosaicMetaDTO + var namespace: NamespaceDTO + + + + init(meta: NamespaceMosaicMetaDTO, namespace: NamespaceDTO) { + self.meta = meta + self.namespace = namespace + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(meta, forKey: "meta") + try container.encode(namespace, forKey: "namespace") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + meta = try container.decode(NamespaceMosaicMetaDTO.self, forKey: "meta") + namespace = try container.decode(NamespaceDTO.self, forKey: "namespace") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceMosaicMetaDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceMosaicMetaDTO.swift new file mode 100644 index 0000000..a67d009 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceMosaicMetaDTO.swift @@ -0,0 +1,51 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NamespaceMosaicMetaDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NamespaceMosaicMetaDTO: Codable { + + var active: Bool + var index: Int + var id: String + + + + init(active: Bool, index: Int, id: String) { + self.active = active + self.index = index + self.id = id + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(active, forKey: "active") + try container.encode(index, forKey: "index") + try container.encode(id, forKey: "id") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + active = try container.decode(Bool.self, forKey: "active") + index = try container.decode(Int.self, forKey: "index") + id = try container.decode(String.self, forKey: "id") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceNameDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceNameDTO.swift new file mode 100644 index 0000000..c204b44 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NamespaceNameDTO.swift @@ -0,0 +1,51 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NamespaceNameDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NamespaceNameDTO: Codable { + + var parentId: UInt64DTO? + var namespaceId: UInt64DTO + var name: String + + + + init(parentId: UInt64DTO?, namespaceId: UInt64DTO, name: String) { + self.parentId = parentId + self.namespaceId = namespaceId + self.name = name + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(parentId, forKey: "parentId") + try container.encode(namespaceId, forKey: "namespaceId") + try container.encode(name, forKey: "name") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + parentId = try container.decodeIfPresent(UInt64DTO.self, forKey: "parentId") + namespaceId = try container.decode(UInt64DTO.self, forKey: "namespaceId") + name = try container.decode(String.self, forKey: "name") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NetworkTypeDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NetworkTypeDTO.swift new file mode 100644 index 0000000..2c5e8a0 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NetworkTypeDTO.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NetworkTypeDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NetworkTypeDTO: Codable { + + var name: String + var description: String + + + + init(name: String, description: String) { + self.name = name + self.description = description + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(name, forKey: "name") + try container.encode(description, forKey: "description") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + name = try container.decode(String.self, forKey: "name") + description = try container.decode(String.self, forKey: "description") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NodeInfoDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NodeInfoDTO.swift new file mode 100644 index 0000000..6ecb47f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NodeInfoDTO.swift @@ -0,0 +1,67 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NodeInfoDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NodeInfoDTO: Codable { + + var publicKey: String + var port: Int + var networkIdentifier: Int + var version: Int + var roles: Int + var host: String + var friendlyName: String + + + + init(publicKey: String, port: Int, networkIdentifier: Int, version: Int, roles: Int, host: String, friendlyName: String) { + self.publicKey = publicKey + self.port = port + self.networkIdentifier = networkIdentifier + self.version = version + self.roles = roles + self.host = host + self.friendlyName = friendlyName + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(publicKey, forKey: "publicKey") + try container.encode(port, forKey: "port") + try container.encode(networkIdentifier, forKey: "networkIdentifier") + try container.encode(version, forKey: "version") + try container.encode(roles, forKey: "roles") + try container.encode(host, forKey: "host") + try container.encode(friendlyName, forKey: "friendlyName") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + publicKey = try container.decode(String.self, forKey: "publicKey") + port = try container.decode(Int.self, forKey: "port") + networkIdentifier = try container.decode(Int.self, forKey: "networkIdentifier") + version = try container.decode(Int.self, forKey: "version") + roles = try container.decode(Int.self, forKey: "roles") + host = try container.decode(String.self, forKey: "host") + friendlyName = try container.decode(String.self, forKey: "friendlyName") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/NodeTimeDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NodeTimeDTO.swift new file mode 100644 index 0000000..0800fe2 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/NodeTimeDTO.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// NodeTimeDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class NodeTimeDTO: Codable { + + var communicationTimestamps: CommunicationTimestamps + + + + init(communicationTimestamps: CommunicationTimestamps) { + self.communicationTimestamps = communicationTimestamps + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encode(communicationTimestamps, forKey: "communicationTimestamps") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + communicationTimestamps = try container.decode(CommunicationTimestamps.self, forKey: "communicationTimestamps") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionHashes.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionHashes.swift new file mode 100644 index 0000000..f0a8890 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionHashes.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// TransactionHashes.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class TransactionHashes: Codable { + + var hashes: [String]? + + + + init(hashes: [String]?) { + self.hashes = hashes + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(hashes, forKey: "hashes") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + hashes = try container.decodeIfPresent([String].self, forKey: "hashes") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionIds.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionIds.swift new file mode 100644 index 0000000..dbfc499 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionIds.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// TransactionIds.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class TransactionIds: Codable { + + var transactionIds: [String]? + + + + init(transactionIds: [String]?) { + self.transactionIds = transactionIds + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(transactionIds, forKey: "transactionIds") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + transactionIds = try container.decodeIfPresent([String].self, forKey: "transactionIds") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionPayload.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionPayload.swift new file mode 100644 index 0000000..2366f77 --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionPayload.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// TransactionPayload.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class TransactionPayload: Codable { + + var payload: String? + + + + init(payload: String?) { + self.payload = payload + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(payload, forKey: "payload") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + payload = try container.decodeIfPresent(String.self, forKey: "payload") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionStatusDTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionStatusDTO.swift new file mode 100644 index 0000000..ecd39ba --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/TransactionStatusDTO.swift @@ -0,0 +1,59 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// TransactionStatusDTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + + +class TransactionStatusDTO: Codable { + + var group: String? + var status: String + var hash: String? + var deadline: UInt64DTO? + var height: UInt64DTO? + + + + init(group: String?, status: String, hash: String?, deadline: UInt64DTO?, height: UInt64DTO?) { + self.group = group + self.status = status + self.hash = hash + self.deadline = deadline + self.height = height + } + + + // Encodable protocol methods + + func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeIfPresent(group, forKey: "group") + try container.encode(status, forKey: "status") + try container.encodeIfPresent(hash, forKey: "hash") + try container.encodeIfPresent(deadline, forKey: "deadline") + try container.encodeIfPresent(height, forKey: "height") + } + + // Decodable protocol methods + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + group = try container.decodeIfPresent(String.self, forKey: "group") + status = try container.decode(String.self, forKey: "status") + hash = try container.decodeIfPresent(String.self, forKey: "hash") + deadline = try container.decodeIfPresent(UInt64DTO.self, forKey: "deadline") + height = try container.decodeIfPresent(UInt64DTO.self, forKey: "height") + } +} + diff --git a/Nem2SdkSwift/sdk/infrastructure/raw/Models/UInt64DTO.swift b/Nem2SdkSwift/sdk/infrastructure/raw/Models/UInt64DTO.swift new file mode 100644 index 0000000..418278f --- /dev/null +++ b/Nem2SdkSwift/sdk/infrastructure/raw/Models/UInt64DTO.swift @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. +// +// UInt64DTO.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +typealias UInt64DTO = [Int] diff --git a/Nem2SdkSwift/sdk/model/account/Account.swift b/Nem2SdkSwift/sdk/model/account/Account.swift new file mode 100644 index 0000000..f741761 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/account/Account.swift @@ -0,0 +1,98 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The account structure describes an account private key, public key, address and allows signing transactions. +public class Account { + // MARK: Properties + /// Account keyPair containing public and private key. + public let keyPair: KeyPair + /// Public account. + public let publicAccount: PublicAccount + + /// Account address + public var address: Address { + return publicAccount.address + } + /// Account public key hex string + public var publicKeyHexString: String { + return keyPair.publicKey.description + } + /// Account public key bytes + public var publicKeyBytes: [UInt8] { + return keyPair.publicKey.bytes + } + + /// Account private key hex string + public var privateKeyHexString: String { + return keyPair.privateKey.description + } + + // MARK: Methods + /** + * Create an Account from a given private key hex string. + * + * - parameter privateKeyHexString: Private key hex string + * - parameter networkType: NetworkType + * - throws: Nem2SdkSwiftError.illegalArgument if the private key hex string is malformed. + */ + public convenience init(privateKeyHexString: String, networkType: NetworkType) throws { + let keyPair = KeyPair(privateKey: try PrivateKey(hexString: privateKeyHexString)) + self.init(keyPair: keyPair, networkType: networkType) + } + + /** + * Create an Account from a given private key. + * + * - parameter keyPair: Key pair + * - parameter networkType: NetworkType + */ + public init(keyPair: KeyPair, networkType: NetworkType) { + self.keyPair = keyPair + self.publicAccount = PublicAccount(publicKey: keyPair.publicKey, networkType: networkType) + } + + /** + * Create an Account with random generated private key. + * + * - parameter networkType: NetworkType + */ + public convenience init(networkType: NetworkType) { + self.init(keyPair: KeyPair(), networkType: networkType) + } + + /** + * Sign a transaction. + * + * - parameter transaction: The transaction to be signed. + * - returns: SignedTransaction + */ + public func sign(transaction: Transaction) -> SignedTransaction { + return transaction.signWith(account: self) + } + + + /** + * Sign aggregate signature transaction. + * + * - parameter cosignatureTransaction: The aggregate signature transaction. + * - returns CosignatureSignedTransaction + */ + public func sign(cosignatureTransaction: CosignatureTransaction) -> CosignatureSignedTransaction { + return cosignatureTransaction.signWith(account: self) + } + + /** + * Sign transaction with cosignatories creating a new SignedTransaction. + * + * - parameter transaction: The aggregate transaction to be signed. + * - parameter cosignatories: The list of accounts that will cosign the transaction + * - returns: SignedTransaction + */ + public func sign(aggregateTransaction: AggregateTransaction, with cosignatories: [Account]) -> SignedTransaction { + return aggregateTransaction.signWith(initiatorAccount: self, cosignatories: cosignatories) + } +} diff --git a/Nem2SdkSwift/sdk/model/account/AccountInfo.swift b/Nem2SdkSwift/sdk/model/account/AccountInfo.swift new file mode 100644 index 0000000..0905ed3 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/account/AccountInfo.swift @@ -0,0 +1,37 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The account info structure describes basic information for an account. +public struct AccountInfo { + // MARK: Properties + /// Account address. + public let address: Address + /// Height when the address was published. + public let addressHeight: UInt64 + /// Public key of the account. + public let publicKey: String + /// Height when the public key was published. + public let publicKeyHeight: UInt64 + /// Importance of the account. + public let importance: UInt64 + /// Importance height of the account. + public let importanceHeight: UInt64 + /// Mosaics hold by the account. + public let mosaics: [Mosaic] + + /// :nodoc: + public init(address: Address, addressHeight: UInt64, publicKey: String, publicKeyHeight: UInt64, importance: UInt64, importanceHeight: UInt64, mosaics: [Mosaic]) { + self.address = address + self.addressHeight = addressHeight + self.publicKey = publicKey + self.publicKeyHeight = publicKeyHeight + self.importance = importance + self.importanceHeight = importanceHeight + self.mosaics = mosaics + } +} + diff --git a/Nem2SdkSwift/sdk/model/account/Address.swift b/Nem2SdkSwift/sdk/model/account/Address.swift new file mode 100644 index 0000000..ca87367 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/account/Address.swift @@ -0,0 +1,152 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The address structure describes an address with its network. +public struct Address: Equatable { + private static let NUM_CHECKSUM_BYTES = 4 + private let address: String + + // MARK: Properties + /// Network type + public let networkType: NetworkType + + /// The address in plain format ex: SB3KUBHATFCPV7UZQLWAQ2EUR6SIHBSBEOEDDDF3. + public var plain: String { + return self.address + } + + /// The address in pretty format ex: SB3KUB-HATFCP-V7UZQL-WAQ2EU-R6SIHB-SBEOED-DDF3. + public var pretty: String { + let matcher = try! NSRegularExpression(pattern: ".{1,6}") + return matcher.matches(in: self.address, range: NSRange(location: 0, length: self.address.count)).map { + (self.address as NSString).substring(with: $0.range) + }.joined(separator: "-") + } + + // Address bytes before encoded with Base32 + let bytes: [UInt8] + + + // MARK: Methods + /** + * Constructor + * + * - parameter address: Address in plain format + * - parameter networkType: Network type + * - throws: Nem2SdkSwiftError.illegalArgument if the address is invalid length or doesn't match the network. + */ + public init(address: String, networkType: NetworkType) throws { + self.address = address + .replacingOccurrences(of: "-", with: "") + .replacingOccurrences(of: " ", with: "") + .uppercased() + self.networkType = networkType + + guard let addressNetwork = self.address.first else { + throw Nem2SdkSwiftError.illegalArgument("Address must not be empty.") + } + + guard String(addressNetwork) == networkType.initialCharacterOfAddress else { + throw Nem2SdkSwiftError + .illegalArgument("\(networkType.description) Address start with \(networkType.initialCharacterOfAddress)") + } + + guard let bytes = try? Base32Encoder.bytes(from: self.address) else { + throw Nem2SdkSwiftError + .illegalArgument("Address must be base 32 encoded.") + } + self.bytes = bytes + } + + /** + * Creates an Address from a given raw address. + * + * - parameter rawAddress: Address string. + * - throws: Nem2SdkSwiftError.illegalArgument if the address is invalid length or does't match any network. + */ + public init(rawAddress: String) throws { + guard let addressNetwork = rawAddress.first else { + throw Nem2SdkSwiftError.illegalArgument("Address must not be empty.") + } + + for networkType in NetworkType.allCases { + if networkType.initialCharacterOfAddress == String(addressNetwork) { + try self.init(address: rawAddress, networkType: networkType) + return + } + } + throw Nem2SdkSwiftError.illegalArgument("Address \(rawAddress) has unknown network initial character.") + } + + /** + * Creates an Address from a given base32 encoded address. + * + * - parameter encodedAddress: Base32 encoded address string. + * - throws: Nem2SdkSwiftError.illegalArgument if the address is invalid length or does't match any network. + */ + public init(encodedAddress: String) throws { + try self.init(rawAddress: String(Base32Encoder.base32String(from: try HexEncoder.toBytes(encodedAddress)))) + } + + + /** + * Creates from public key hex string. + * + * - parameter publicKeyHexString: Public key hex string. + * - parameter networkType: Network type + * - throws: Nem2SdkSwiftError.illegalArgument if the public key is invalid length or malformed. + */ + public init(publicKeyHexString: String, networkType: NetworkType) throws { + let address = try Address.generateEncoded(version: networkType.rawValue, publicKeyHexString: publicKeyHexString) + try self.init(address: address, networkType: networkType) + } + + /** + * Creates from public key. + * + * - parameter publicKey: Public key. + * - parameter networkType: Network type + */ + public init(publicKey: PublicKey, networkType: NetworkType) { + let address = Address.generateEncoded(version: networkType.rawValue, publicKeyBytes: publicKey.bytes) + try! self.init(address: address, networkType: networkType) + } + + private static func generateEncoded(version: UInt8, publicKeyHexString: String) throws -> String { + guard let publicKeyBytes = try? HexEncoder.toBytes(publicKeyHexString) else { + throw Nem2SdkSwiftError.illegalArgument("public key is not valid") + } + + return generateEncoded(version: version, publicKeyBytes: publicKeyBytes) + } + + + private static func generateEncoded(version: UInt8, publicKeyBytes: [UInt8]) -> String { + // step 1: sha3 hash of the public key + let sha3PublicKeyHash = Hashes.sha3_256(publicKeyBytes) + + // step 2: ripemd160 hash of (1) + let ripemd160StepOneHash = Hashes.ripemd160(sha3PublicKeyHash) + + // step 3: add version byte in front of (2) + let versionPrefixedRipemd160Hash = [version] + ripemd160StepOneHash + + // step 4: get the checksum of (3) + let stepThreeChecksum = Array(Hashes.sha3_256(versionPrefixedRipemd160Hash)[0.. Bool { + return lhs.address == rhs.address && lhs.networkType == rhs.networkType + } +} diff --git a/Nem2SdkSwift/sdk/model/account/MultisigAccountGraphInfo.swift b/Nem2SdkSwift/sdk/model/account/MultisigAccountGraphInfo.swift new file mode 100644 index 0000000..8f8d772 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/account/MultisigAccountGraphInfo.swift @@ -0,0 +1,28 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/** + * + * + * @since 1.0 + */ +/// The multisig account graph info structure describes the information of all the mutlisig levels an account is involved in. +public struct MultisigAccountGraphInfo { + // MARK: Properties + /// Multisig accounts. + public let multisigAccounts: [Int:[MultisigAccountInfo]] + + /// Multisig accounts levels number. + public var levelsNumber: Set { + return Set(self.multisigAccounts.keys) + } + + // MARK: Methods + public init(multisigAccounts: [Int:[MultisigAccountInfo]]) { + self.multisigAccounts = multisigAccounts + } +} diff --git a/Nem2SdkSwift/sdk/model/account/MultisigAccountInfo.swift b/Nem2SdkSwift/sdk/model/account/MultisigAccountInfo.swift new file mode 100644 index 0000000..d6db66e --- /dev/null +++ b/Nem2SdkSwift/sdk/model/account/MultisigAccountInfo.swift @@ -0,0 +1,66 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The multisig account info structure describes information of a multisig account. +public struct MultisigAccountInfo: Equatable { + // MARK: Properties + /// Account multisig public account. + public let account: PublicAccount + /// Number of signatures needed to approve a transaction. + public let minApproval: Int + /// Number of signatures needed to remove a cosignatory. + public let minRemoval: Int + /// Multisig account cosignatories. + public let cosignatories: [PublicAccount] + /// Multisig accounts this account is cosigner of. + public let multisigAccounts: [PublicAccount] + + /// if the account is a multisig account. + public var isMultisig: Bool { + return minApproval != 0 && minRemoval != 0 + } + + // MARK: Methods + + /// :nodoc: + public init(account: PublicAccount, minApproval: Int, minRemoval: Int, cosignatories: [PublicAccount], multisigAccounts: [PublicAccount]) { + self.account = account + self.minApproval = minApproval + self.minRemoval = minRemoval + self.cosignatories = cosignatories + self.multisigAccounts = multisigAccounts + } + + /** + * Checks if an account is cosignatory of the multisig account. + * + * - parameter account: PublicAccount + * - returns: boolean + */ + public func hasCosigner(account: PublicAccount) -> Bool { + return self.cosignatories.contains(account) + } + + /** + * Checks if the multisig account is cosignatory of an account. + * + * - parameter account: PublicAccount + * - returns: boolean + */ + public func isCosignerOf(account: PublicAccount) -> Bool { + return self.multisigAccounts.contains(account) + } + + /// :nodoc: + public static func ==(lhs: MultisigAccountInfo, rhs: MultisigAccountInfo) -> Bool { + return lhs.account == rhs.account && + lhs.minApproval == rhs.minApproval && + lhs.minRemoval == rhs.minRemoval && + lhs.cosignatories == rhs.cosignatories && + lhs.multisigAccounts == rhs.multisigAccounts + } +} diff --git a/Nem2SdkSwift/sdk/model/account/PublicAccount.swift b/Nem2SdkSwift/sdk/model/account/PublicAccount.swift new file mode 100644 index 0000000..350b9c1 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/account/PublicAccount.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The public account structure contains account's address and public key. +public struct PublicAccount: Equatable { + // MARK: Properties + /// Account address. + public let address: Address + /// Account public key. + public let publicKey: PublicKey + + // MARK: Methods + /** + * Create a PublicAccount from a public key and network type. + * + * - parameter publicKey: Public key + * - parameter networkType: Network type + */ + public init(publicKey: PublicKey, networkType: NetworkType) { + self.address = Address(publicKey: publicKey, networkType: networkType) + self.publicKey = publicKey + } + + /** + * Create a PublicAccount from a public key hex string and network type. + * + * - parameter publicKeyHexString: Public key hex string + * - parameter networkType: Network type + */ + public init(publicKeyHexString: String, networkType: NetworkType) throws{ + let publicKey = try PublicKey(hexString: publicKeyHexString) + self.init(publicKey: publicKey, networkType: networkType) + } + + /// :nodoc: + public static func ==(lhs: PublicAccount, rhs: PublicAccount) -> Bool { + return lhs.address == rhs.address && lhs.publicKey == rhs.publicKey + } +} diff --git a/Nem2SdkSwift/sdk/model/blockchain/BlockInfo.swift b/Nem2SdkSwift/sdk/model/blockchain/BlockInfo.swift new file mode 100644 index 0000000..687a539 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/blockchain/BlockInfo.swift @@ -0,0 +1,90 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The block info structure describes basic information of a block. +public struct BlockInfo: CustomStringConvertible { + // MARK: Properties + /// Block hash. + public let hash: String + /// Block generation hash. + public let generationHash: String + /// Total fee paid to the account harvesting the block. Nil when generated by listeners. + public let totalFee: UInt64? + /// Number of transactions included the block. Nil when generated by listeners. + public let numTransactions: Int? + /// The block signature. + /// The signature was generated by the signer and can be used to validate that the blockchain data was not modified by a node. + public let signature: String + /// Public account of block harvester. + public let signer: PublicAccount + /// Network type. + public let networkType: NetworkType + /// Block transaction version. + public let version: Int + /// Block transaction type. + public let type: Int + /// Height of which the block was confirmed. Each block has a unique height. Subsequent blocks differ in height by 1. + public let height: UInt64 + /// The number of seconds elapsed since the creation of the nemesis blockchain. + public let timestamp: UInt64 + /// POI difficulty to harvest a block. + public let difficulty: UInt64 + /// The last block hash. + public let previousBlockHash: String + /// The block transaction hash. + public let blockTransactionHash: String + + + // MAK: Methods + /// :nodoc: + public init(hash: String, + generationHash: String, + totalFee: UInt64?, + numTransactions: Int?, + signature: String, + signer: PublicAccount, + networkType: NetworkType, + version: Int, + type: Int, + height: UInt64, + timestamp: UInt64, + difficulty: UInt64, + previousBlockHash: String, + blockTransactionHash: String) { + self.hash = hash + self.generationHash = generationHash + self.totalFee = totalFee + self.numTransactions = numTransactions + self.signature = signature + self.signer = signer + self.networkType = networkType + self.version = version + self.type = type + self.height = height + self.timestamp = timestamp + self.difficulty = difficulty + self.previousBlockHash = previousBlockHash + self.blockTransactionHash = blockTransactionHash + } + + public var description: String { + return "BlockInfo{" + + "hash='\(hash)', " + + "generationHash='\(generationHash)', " + + "totalFee=\(String(describing: totalFee)), " + + "numTransactions=\(String(describing: numTransactions)), " + + "signature=\(signature), " + + "signer=\(signer), " + + "networkType=\(networkType), " + + "version=\(version), " + + "height=\(height), " + + "timestamp=\(timestamp), " + + "difficulty=\(difficulty), " + + "previousBlockHash='\(previousBlockHash)', " + + "blockTransactionHash='\(blockTransactionHash)'" + } +} diff --git a/Nem2SdkSwift/sdk/model/blockchain/BlockchainStorageInfo.swift b/Nem2SdkSwift/sdk/model/blockchain/BlockchainStorageInfo.swift new file mode 100644 index 0000000..bc76089 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/blockchain/BlockchainStorageInfo.swift @@ -0,0 +1,24 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The blockchain storage info structure describes stored data. +public struct BlockchainStorageInfo { + // MARK: Properties + /// Number of accounts published in the blockchain. + public let numAccounts: Int + /// Number of confirmed blocks. + public let numBlocks: Int + /// Number of confirmed transactions. + public let numTransactions: Int + + /// :nodoc: + public init(numAccounts: Int, numBlocks: Int, numTransactions: Int) { + self.numAccounts = numAccounts + self.numBlocks = numBlocks + self.numTransactions = numTransactions + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/model/blockchain/NetworkType.swift b/Nem2SdkSwift/sdk/model/blockchain/NetworkType.swift new file mode 100644 index 0000000..40847f9 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/blockchain/NetworkType.swift @@ -0,0 +1,39 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Network type +public enum NetworkType: UInt8, CaseIterable { + /// Main network + case mainNet = 104 + /// Test network + case testNet = 152 + /// Mijin network + case mijin = 96 + /// Mijin test network + case mijinTest = 144 + + /// MARK: Properties + /// Initial address character of this network. + public var initialCharacterOfAddress: String { + switch self { + case .mainNet: return "N" + case .testNet: return "T" + case .mijin: return "M" + case .mijinTest: return "S" + } + } + + /// String description of this network + public var description: String { + switch self { + case .mainNet: return "MAIN_NET" + case .testNet: return "TEST_NET" + case .mijin: return "MIJIN" + case .mijinTest: return "MIJIN_TEST" + } + } + +} diff --git a/Nem2SdkSwift/sdk/model/mosaic/Mosaic.swift b/Nem2SdkSwift/sdk/model/mosaic/Mosaic.swift new file mode 100644 index 0000000..83db8a2 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/Mosaic.swift @@ -0,0 +1,23 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/** + * A mosaic describes an instance of a mosaic definition. + * Mosaics can be transferred by means of a transfer transaction. + */ +public struct Mosaic { + /// Mosaic identifier + public let id: MosaicId + /// Amount of mosaic + public let amount: UInt64 + + /// :nodoc: + public init(id: MosaicId, amount: UInt64) { + self.id = id + self.amount = amount + } +} diff --git a/Nem2SdkSwift/sdk/model/mosaic/MosaicId.swift b/Nem2SdkSwift/sdk/model/mosaic/MosaicId.swift new file mode 100644 index 0000000..616abad --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/MosaicId.swift @@ -0,0 +1,52 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The mosaic id structure describes mosaic id +public struct MosaicId: Equatable { + // MARK: Properties + /// Mosaic integer id + public let id: UInt64 + /// Mosaic full name, with namespace name (ex: nem:xem) + public let fullName: String? + + // MARK: Methods + /** + * Create MosaicId from mosaic and namespace string name (ex: nem:xem or domain.subdom.subdome:token) + * + * - parameter fullName: Mosaic full name + * - throws: Nem2SdkSwiftError.illegalArgument if the fullName is malformed. + */ + public init(fullName: String) throws { + guard !fullName.isEmpty && fullName.contains(":") else { + throw Nem2SdkSwiftError.illegalArgument(fullName + " is not valid") + } + let parts = fullName.split(separator: ":"); + guard parts.count == 2 else { + throw Nem2SdkSwiftError.illegalArgument(fullName + " is not valid") + } + let namespaceFullName = String(parts[0]) + let mosaicName = String(parts[1]) + + self.id = try IdGenerator.generateMosaicId(namespaceFullName: namespaceFullName, mosaicName: mosaicName) + self.fullName = fullName + } + + /** + * Create MosaicId from integer id + * + * - parameter id: Mosaic integer id + */ + public init(id: UInt64) { + self.id = id + self.fullName = nil + } + + /// Compares only the ids. + public static func ==(lhs: MosaicId, rhs: MosaicId) -> Bool { + return lhs.id == rhs.id + } +} diff --git a/Nem2SdkSwift/sdk/model/mosaic/MosaicInfo.swift b/Nem2SdkSwift/sdk/model/mosaic/MosaicInfo.swift new file mode 100644 index 0000000..d607841 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/MosaicInfo.swift @@ -0,0 +1,61 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The mosaic info structure contains its properties, the owner and the namespace to which it belongs to. +public struct MosaicInfo { + /// MARK: Properties + /// If the mosaic is active + public let isActive: Bool + /// Index + public let index: Int + /// Meta ID + public let metaId: String + /// The namespace id it belongs to + public let namespaceId: NamespaceId + /// Mosaic id + public let mosaicId: MosaicId + /// Total mosaic supply + public let supply: UInt64 + /// Block height it was created + public let height: UInt64 + /// Mosaic account owner + public let owner: PublicAccount + + let properties: MosaicProperties + + /// If the mosaic is expired + public var isExpired: Bool { + return !isActive + } + + + /// True if the supply is mutable + public var isSupplyMutable: Bool { + return properties.isSupplyMutable + } + + /// True if the mosaic is transferable between non-owner accounts + public var isTransferable: Bool { + return properties.isTransferable + } + + /// If the mosaic levy is mutable + public var isLevyMutable: Bool { + return properties.isLevyMutable + } + + /// The number of blocks from height it will be active + public var duration: UInt64 { + return properties.duration + } + + /// Mosaic divisibility + public var divisibility: Int { + return properties.divisibility + } +} + diff --git a/Nem2SdkSwift/sdk/model/mosaic/MosaicName.swift b/Nem2SdkSwift/sdk/model/mosaic/MosaicName.swift new file mode 100644 index 0000000..693fde3 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/MosaicName.swift @@ -0,0 +1,17 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The mosaic name info structure describes basic information of a mosaic and name. +public struct MosaicName { + // MARK: Properties + /// Mosaic identifier + public let mosaicId: MosaicId + /// Mosaic name + public let name: String + /// Namespace identifier it belongs to + public let parentId: NamespaceId +} diff --git a/Nem2SdkSwift/sdk/model/mosaic/MosaicProperties.swift b/Nem2SdkSwift/sdk/model/mosaic/MosaicProperties.swift new file mode 100644 index 0000000..55512db --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/MosaicProperties.swift @@ -0,0 +1,33 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// The mosaic properties structure describes mosaic properties. +public struct MosaicProperties { + /// True if supply is mutable + public let isSupplyMutable: Bool + /// True if mosaic is transferable between non-owner accounts + public let isTransferable: Bool + /// True if the mosaic levy is mutable + public let isLevyMutable: Bool + /// Mosaic divisibility + public let divisibility: Int + /// Number of blocks from height it will be active + public let duration: UInt64 + + /// :nodoc: + public init(isSupplyMutable: Bool, + isTransferable: Bool, + isLevyMutable: Bool, + divisibility: Int, + duration: UInt64) { + self.isSupplyMutable = isSupplyMutable + self.isTransferable = isTransferable + self.isLevyMutable = isLevyMutable + self.divisibility = divisibility + self.duration = duration + } +} diff --git a/Nem2SdkSwift/sdk/model/mosaic/MosaicSupplyType.swift b/Nem2SdkSwift/sdk/model/mosaic/MosaicSupplyType.swift new file mode 100644 index 0000000..1dff6d4 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/MosaicSupplyType.swift @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +// Mosaic supply type. +public enum MosaicSupplyType: UInt8, CaseIterable { + /// Decrease the supply. + case decrease = 0 + /// Increase the supply. + case increase = 1 +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/model/mosaic/XEM.swift b/Nem2SdkSwift/sdk/model/mosaic/XEM.swift new file mode 100644 index 0000000..a171597 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/mosaic/XEM.swift @@ -0,0 +1,45 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + + +import Foundation + +/// XEM Mosaic +public class XEM { + // MARK: Properties + + /// Divisibility + public static let divisibility = 6 + /// Initial supply + public static let initialSupply: UInt64 = 8_999_999_999 + /// Is transferable + public static let transferable = true + /// Is supply mutable + public static let supplyMutable = false + /// Namespace id + public static let namespaceId = try! NamespaceId(fullName: "nem") + /// Mosaic id + public static let mosaicId = try! MosaicId(fullName: "nem:xem") + + /** + * Create xem with using xem as unit. + * + * - parameter xemAmount: XEM amount + * - returns: XEM Mosaic + */ + public static func of(xemAmount: Decimal) -> Mosaic { + let microXem = xemAmount.scale10(divisibility).uint64Value + return Mosaic(id: mosaicId, amount: microXem) + } + + /** + * Create xem with using micro xem as unit, 1 XEM = 1000000 micro XEM. + * + * - parameter microXemAmount: micro XEM amount + * - returns: XEM Mosaic + */ + public static func of(microXemAmount: UInt64) -> Mosaic { + return Mosaic(id: mosaicId, amount: microXemAmount) + } +} diff --git a/Nem2SdkSwift/sdk/model/namespace/NamespaceId.swift b/Nem2SdkSwift/sdk/model/namespace/NamespaceId.swift new file mode 100644 index 0000000..7c3ebd1 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/namespace/NamespaceId.swift @@ -0,0 +1,41 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The namespace id structure describes namespace id +public struct NamespaceId: Equatable { + // MARK: Properties + /// Namespace id + public let id: UInt64 + /// Namespace full name, with subnamespaces if it's the case. + public let fullName: String? + + // MARK: Methods + /** + * Create NamespaceId from namespace string name (ex: nem or domain.subdom.subdome) + * + * - parameter fullName: Namespace full name + * - throws: Nem2SdkSwiftError.illegalArgument if the fullName is malformed. + */ + public init(fullName: String) throws { + self.id = try IdGenerator.generateNamespaceId(namespaceFullName: fullName) + self.fullName = fullName + } + /** + * Create NamespaceId from integer id + * + * - parameter id + */ + public init(id: UInt64) { + self.id = id; + self.fullName = nil + } + + /// Compares only the ids. + public static func ==(lhs: NamespaceId, rhs: NamespaceId) -> Bool { + // only checks the ids + return lhs.id == rhs.id + } +} diff --git a/Nem2SdkSwift/sdk/model/namespace/NamespaceInfo.swift b/Nem2SdkSwift/sdk/model/namespace/NamespaceInfo.swift new file mode 100644 index 0000000..108a1b8 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/namespace/NamespaceInfo.swift @@ -0,0 +1,50 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// NamespaceInfo contains the state information of a namespace. +public struct NamespaceInfo { + /// MARK: Properties + /// If namespace is active + public let isActive: Bool + /// Index + public let index: Int + /// Meta id + public let metaId: String + /// Namespace type + public let type: NamespaceType + /// Namespace level depth + public let depth: Int + /// Different NamespaceIds per level + public let levels: [NamespaceId] + /// Parent namespace id + public let parentId: NamespaceId? + /// Mosaic owner account + public let owner: PublicAccount + /// Block height the namespace was registered + public let startHeight: UInt64 + /// Block height the namespace expires if not renewed + public let endHeight: UInt64 + + /// Namespace expiration status + public var isExpired: Bool { + return !isActive; + } + + /// Namespace id + public var id: NamespaceId { + return levels.last! + } + + /// True if namespace is Root + public var isRoot: Bool { + return self.type == .rootNamespace + } + + /// True if namespace is SubNamespace + public var isSubNamespace: Bool { + return self.type == .subNamespace + } +} diff --git a/Nem2SdkSwift/sdk/model/namespace/NamespaceName.swift b/Nem2SdkSwift/sdk/model/namespace/NamespaceName.swift new file mode 100644 index 0000000..fd9cc42 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/namespace/NamespaceName.swift @@ -0,0 +1,16 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The namespace name info structure describes basic information of a namespace and name. +public struct NamespaceName { + // MARK: Properties + /// Namespace id + public let namespaceId: NamespaceId + /// Namespace name + public let name: String + /// Parent namespace id + public let parentId: NamespaceId? +} diff --git a/Nem2SdkSwift/sdk/model/namespace/NamespaceType.swift b/Nem2SdkSwift/sdk/model/namespace/NamespaceType.swift new file mode 100644 index 0000000..6d716ba --- /dev/null +++ b/Nem2SdkSwift/sdk/model/namespace/NamespaceType.swift @@ -0,0 +1,13 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Namespace level type +public enum NamespaceType: UInt8, CaseIterable { + /// Root namespace + case rootNamespace = 0 + /// Sub namespace + case subNamespace = 1 +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/model/transaction/AggregateTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/AggregateTransaction.swift new file mode 100644 index 0000000..69b9c29 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/AggregateTransaction.swift @@ -0,0 +1,111 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts. +public class AggregateTransaction: Transaction { + // MARK: Properties + /// List of innerTransactions included in the aggregate transaction. + public let innerTransactions: [Transaction] + /// List of transaction cosigners signatures. + public let cosignatures: [AggregateTransactionCosignature] + + // MARK: Methods + init(base: Transaction, + innerTransactions: [Transaction], + cosignatures: [AggregateTransactionCosignature]) { + + self.innerTransactions = innerTransactions + self.cosignatures = cosignatures + + super.init(base: base) + } + + /** + * Create an aggregate complete transaction object + * + * - parameter deadline: The deadline to include the transaction. + * - parameter innerTransactions: The list of inner innerTransactions. + * - parameter networkType: The network type. + * - returns: AggregateTransaction + */ + public static func createComplete( + innerTransactions: [Transaction], + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60) ) throws -> AggregateTransaction { + + if innerTransactions.contains(where: {$0.signer == nil}) { + throw Nem2SdkSwiftError.illegalArgument("Inner transaction must have a signer.") + } + + let base = Transaction(type: .aggregateComplete, networkType: networkType, version: 2, deadline: deadline) + return AggregateTransaction(base: base, innerTransactions: innerTransactions, cosignatures: []); + } + + /** + * Create an aggregate bonded transaction object + * + * - parameter innerTransactions: The list of inner innerTransactions. + * - parameter networkType: The network type. + * - parameter deadline: The deadline to include the transaction. + * - returns: AggregateTransaction + */ + public static func createBonded( + innerTransactions: [Transaction], + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60 ) ) throws -> AggregateTransaction { + if innerTransactions.contains(where: {$0.signer == nil}) { + throw Nem2SdkSwiftError.illegalArgument("Inner transaction must have a signer.") + } + + let base = Transaction(type: .aggregateBonded, networkType: networkType, version: 2, deadline: deadline) + return AggregateTransaction(base: base, innerTransactions: innerTransactions, cosignatures: []); + } + + override func getTransactionBodyBytes() -> [UInt8] { + let transactionBytes = self.innerTransactions.reduce([]) { (current: [UInt8], transaction: Transaction) in + if let aggregateTransactionBytes = try? transaction.toAggregateTransactionBytes() { + return current + aggregateTransactionBytes + } else { + return current + } + + } + return UInt32(transactionBytes.count).bytes + transactionBytes + } + + /** + * Sign transaction with cosignatories creating a new SignedTransaction. + * + * - parameter initiatorAccount: Initiator account + * - parameter cosignatories: The list of accounts that will cosign the transaction + * - returns: Signed transaction + */ + public func signWith(initiatorAccount: Account, cosignatories: [Account] ) -> SignedTransaction { + let signedTransaction = self.signWith(account: initiatorAccount) + var payloadBytes = signedTransaction.payload + + for cosignatory in cosignatories { + let signer = Signer(keyPair: cosignatory.keyPair) + let bytes = signedTransaction.hash + let signatureBytes = signer.sign(message: bytes) + payloadBytes += cosignatory.publicKeyBytes + signatureBytes + } + + let payload = UInt64(payloadBytes.count).bytes + Array(payloadBytes[8.. Bool { + return self.signer == publicAccount || cosignatures.contains(where: {$0.signer == publicAccount}) + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/model/transaction/AggregateTransactionCosignature.swift b/Nem2SdkSwift/sdk/model/transaction/AggregateTransactionCosignature.swift new file mode 100644 index 0000000..dbc8b7f --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/AggregateTransactionCosignature.swift @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The model representing cosignature of an aggregate transaction. +public struct AggregateTransactionCosignature { + /// Signature of aggregate transaction done by the cosigner. + public let signature: [UInt8] + /// Cosigner public account. + public let signer: PublicAccount +} + diff --git a/Nem2SdkSwift/sdk/model/transaction/CosignatureSignedTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/CosignatureSignedTransaction.swift new file mode 100644 index 0000000..e160794 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/CosignatureSignedTransaction.swift @@ -0,0 +1,16 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +/// The co-signature signed transaction. +public struct CosignatureSignedTransaction { + /// Hash of parent aggregate transaction that has been signed by a cosignatory of the transaction. + public let parentHash: [UInt8] + /// Signatures generated by signing the parent aggregate transaction hash. + public let signature: [UInt8] + /// Signer of the cosignature transaction. + public let signer: [UInt8] +} diff --git a/Nem2SdkSwift/sdk/model/transaction/CosignatureTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/CosignatureTransaction.swift new file mode 100644 index 0000000..81aa12b --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/CosignatureTransaction.swift @@ -0,0 +1,41 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The cosignature transaction is used to sign an aggregate transactions with missing cosignatures. +public class CosignatureTransaction { + // MARK: Properties + /// Transaction to cosign. + public let transactionToCosign: AggregateTransaction + + private let transactionToCosignHash: [UInt8] + + // MARK: Methods + /** + * Constructor + * + * - parameter transactionToCosign: Aggregate transaction that will be cosigned. + */ + public init(transactionToCosign: AggregateTransaction) throws { + guard let hash = transactionToCosign.transactionInfo?.hash else { + throw Nem2SdkSwiftError.illegalArgument("Transaction to cosign should be announced before being able to cosign it") + } + self.transactionToCosign = transactionToCosign + self.transactionToCosignHash = hash + } + + /** + * Serialize and sign transaction creating a new SignedTransaction. + * + * - parameter account: Account + * - returns: CosignatureSignedTransaction + */ + public func signWith(account: Account) -> CosignatureSignedTransaction { + let signer = Signer(keyPair: account.keyPair) + let bytes = self.transactionToCosignHash + let signatureBytes = signer.sign(message: bytes) + return CosignatureSignedTransaction(parentHash: transactionToCosignHash, signature: signatureBytes, signer: account.publicKeyBytes) + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/Deadline.swift b/Nem2SdkSwift/sdk/model/transaction/Deadline.swift new file mode 100644 index 0000000..21eb358 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/Deadline.swift @@ -0,0 +1,38 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The deadline of the transaction. The deadline is given as the number of seconds elapsed since the creation of the nemesis block. +public class Deadline { + // + /// Nemesis block date. The date is 2016/04/01 00:00:00 UTC. + public static let dateOfNemesisBlock = Date(timeIntervalSince1970: 1459468800) + + /// Deadline date + public let date: Date + + /// Number of milli seconds elapsed since the creation of the nemesis block. + public var timestamp: UInt64 { + return UInt64(date.timeIntervalSince(Deadline.dateOfNemesisBlock) * 1000) + } + + /** + * Constructor + * + * - parameter fromNow: Duration time from now + */ + public init(fromNow interval: TimeInterval) { + self.date = Date(timeInterval: interval, since: Date()) + } + + /** + * Constructor + * + * - parameter fromNemesis: Duration time from nemesis block + */ + public init(fromNemesis interval: TimeInterval) { + self.date = Date(timeInterval: interval, since: Deadline.dateOfNemesisBlock) + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/HashType.swift b/Nem2SdkSwift/sdk/model/transaction/HashType.swift new file mode 100644 index 0000000..3c922f4 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/HashType.swift @@ -0,0 +1,11 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Enum containing hash type. +public enum HashType: UInt8 { + /// SHA3 512 + case sha3_512 = 0 +} diff --git a/Nem2SdkSwift/sdk/model/transaction/IdGenerator.swift b/Nem2SdkSwift/sdk/model/transaction/IdGenerator.swift new file mode 100644 index 0000000..3c84db9 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/IdGenerator.swift @@ -0,0 +1,64 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +/// Static functions to generate mosaic ID and namespace ID. +class IdGenerator { + /** + * Generates ID + * + * - parameter name: Name of the entity. + * - parameter parentId: ID of the parent of the entity. + */ + static func generateId(name: String, parentId: UInt64) -> UInt64 { + let parentIdBytes = parentId.bytes + let bytes = Array(name.utf8) + + let result = Hashes.sha3_256(parentIdBytes + bytes) + return UInt64.createFrom(bytes: Array(result[0..<8]))! + } + + static func generateNamespacePath(name: String) throws -> [UInt64] { + let parts = name.split(separator: ".", omittingEmptySubsequences: false) + + if (parts.count == 0) { + throw Nem2SdkSwiftError.illegalArgument("invalid namespace name") + } else if (parts.count > 3) { + throw Nem2SdkSwiftError.illegalArgument("too many parts") + } + + var namespaceId: UInt64 = 0 + + return try parts.map { partView in + let part = String(partView) + + guard part.matches("^[a-z0-9][a-z0-9-_]*$") else { + throw Nem2SdkSwiftError.illegalArgument("invalid namespace name") + } + namespaceId = generateId(name: part, parentId: namespaceId) + return namespaceId + } + } + + + static func generateNamespaceId(namespaceFullName: String) throws -> UInt64 { + let namespacePath = try generateNamespacePath(name: namespaceFullName) + return namespacePath.last! + } + + + static func generateMosaicId(namespaceFullName: String, mosaicName: String) throws -> UInt64 { + guard !mosaicName.isEmpty else { + throw Nem2SdkSwiftError.illegalArgument("having zero length") + } + let parentNamespaceId = try generateNamespaceId(namespaceFullName: namespaceFullName) + + guard mosaicName.matches("^[a-z0-9][a-z0-9-_]*$") else { + throw Nem2SdkSwiftError.illegalArgument("invalid mosaic name") + } + return generateId(name: mosaicName, parentId: parentNamespaceId) + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/LockFundsTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/LockFundsTransaction.swift new file mode 100644 index 0000000..4488616 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/LockFundsTransaction.swift @@ -0,0 +1,63 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/** + * Lock funds transaction is used before sending an Aggregate bonded transaction, as a deposit to announce the transaction. + * When aggregate bonded transaction is confirmed funds are returned to LockFundsTransaction signer. + * + */ +public class LockFundsTransaction: Transaction { + /// Locked mosaic. + public let mosaic: Mosaic + /// Funds lock duration in number of blocks. + public let duration: UInt64 + /// Signed transaction for which funds are locked. + public let signedTransaction: SignedTransaction + + init(base: Transaction, + mosaic: Mosaic, + duration: UInt64, + signedTransaction: SignedTransaction) { + + self.mosaic = mosaic + self.duration = duration + self.signedTransaction = signedTransaction + + super.init(base: base) + } + + /** + * Create a lock funds transaction object. + * + * - parameter mosaic: Locked mosaic. + * - parameter duration: Funds lock duration in number of blocks. + * - parameter signedTransaction: Signed transaction for which funds are locked. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + * - returns: LockFundsTransaction + */ + public static func create( + mosaic: Mosaic, + duration: UInt64, + signedTransaction: SignedTransaction, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> LockFundsTransaction { + + guard signedTransaction.type == .aggregateBonded else { + throw Nem2SdkSwiftError.illegalArgument("Signed transaction must be Aggregate Bonded Transaction"); + } + + let base = Transaction(type: .lock, networkType: networkType, version: 3, deadline: deadline) + return LockFundsTransaction(base: base, mosaic: mosaic, duration: duration, signedTransaction: signedTransaction) + } + + override func getTransactionBodyBytes() -> [UInt8] { + return self.mosaic.id.id.bytes + // mosaic id 8 bytes + self.mosaic.amount.bytes + // mosaic amount 8 bytes + self.duration.bytes + // duration 8 bytes + self.signedTransaction.hash // hash 32 bytes + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/Message.swift b/Nem2SdkSwift/sdk/model/transaction/Message.swift new file mode 100644 index 0000000..09e3ebd --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/Message.swift @@ -0,0 +1,19 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// An abstract message class that serves as the base class of all message types. +public class Message { + // MARK: Properties + /// Message type. + public let type: UInt8 + /// Returns message payload. + public let payload: [UInt8] + + init(type: UInt8, payload: [UInt8]) { + self.type = type + self.payload = payload + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/ModifyMultisigAccountTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/ModifyMultisigAccountTransaction.swift new file mode 100644 index 0000000..cc7b780 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/ModifyMultisigAccountTransaction.swift @@ -0,0 +1,72 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/** + * Modify multisig account transactions are part of the NEM's multisig account system. + * A modify multisig account transaction holds an array of multisig cosignatory modifications, min number of signatures to approve a transaction and a min number of signatures to remove a cosignatory. + */ +public class ModifyMultisigAccountTransaction: Transaction { + // MARK: Properties + /** + * Number of signatures needed to approve a transaction. + * If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories. + */ + public let minApprovalDelta: Int8 + /** + * Number of signatures needed to remove a cosignatory. + * If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories. + */ + public let minRemovalDelta: Int8 + /// List of cosigner accounts added or removed from the multi-signature account. + public let modifications: [MultisigCosignatoryModification] + + // MARK: Methods + init(base: Transaction, + minApprovalDelta: Int8, + minRemovalDelta: Int8, + modifications: [MultisigCosignatoryModification]) { + + self.minApprovalDelta = minApprovalDelta + self.minRemovalDelta = minRemovalDelta + self.modifications = modifications + + super.init(base: base) + } + + /** + * Create a modify multisig account transaction object. + * + * - parameter minApprovalDelta: Min approval relative change. + * - parameter minRemovalDelta: Min removal relative change. + * - parameter modifications: List of modifications. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + * - returns: ModifyMultisigAccountTransaction + */ + public static func create( + minApprovalDelta: Int8, + minRemovalDelta: Int8, + modifications: [MultisigCosignatoryModification], + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) -> ModifyMultisigAccountTransaction { + let base = Transaction(type: .modifyMultisigAccount, networkType: networkType, version: 3, deadline: deadline) + return ModifyMultisigAccountTransaction(base: base, minApprovalDelta: minApprovalDelta, minRemovalDelta: minRemovalDelta, modifications: modifications) + } + + override func getTransactionBodyBytes() -> [UInt8] { + let modificationsBytes = self.modifications.reduce([]){ (current: [UInt8], modification: MultisigCosignatoryModification) in + return current + + modification.type.rawValue.bytes + // modification type 1 byte + modification.cosignatory.publicKey.bytes // cosigner public key 32 bytes + } + + return self.minRemovalDelta.bytes + // min removal delta 1 byte + self.minApprovalDelta.bytes + // min approval delta 1 byte + UInt8(self.modifications.count).bytes + // num modifications 1 byte + modificationsBytes // modifications + } + +} diff --git a/Nem2SdkSwift/sdk/model/transaction/MosaicDefinitionTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/MosaicDefinitionTransaction.swift new file mode 100644 index 0000000..932d59a --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/MosaicDefinitionTransaction.swift @@ -0,0 +1,81 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/** + * Before a mosaic can be created or transferred, a corresponding definition of the mosaic has to be created and published to the network. + * This is done via a mosaic definition transaction. + */ +public class MosaicDefinitionTransaction: Transaction { + // MARK: Properties + /// Mosaic name. + public let mosaicName: String + /// Mosaic id generated from namespace name and mosaic name. + public let mosaicId: MosaicId + /// Namespace id generated from namespace name. + public let namespaceId: NamespaceId + /// Mosaic properties defining mosaic. + public let mosaicProperties: MosaicProperties + + // MARK: Methods + init(base: Transaction, + mosaicName: String, + mosaicId: MosaicId, + namespaceId: NamespaceId, + mosaicProperties: MosaicProperties) { + + self.mosaicName = mosaicName + self.mosaicId = mosaicId + self.namespaceId = namespaceId + self.mosaicProperties = mosaicProperties + + super.init(base: base) + } + + + /** + * Create a mosaic creation transaction object. + * + * - parameter mosaicName: Mosaic name ex: xem. + * - parameter namespaceFullName: Namespace where mosaic will be included ex: nem. + * - parameter mosaicProperties: Mosaic properties. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + * - returns: MosaicDefinitionTransaction + */ + public static func create( + mosaicName: String, + namespaceFullName: String, + mosaicProperties: MosaicProperties, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> MosaicDefinitionTransaction { + + let mosaicId = try MosaicId(fullName: namespaceFullName + ":" + mosaicName) + let namespaceId = try NamespaceId(fullName: namespaceFullName) + + let base = Transaction(type: .mosaicDefinition, networkType: networkType, version: 2, deadline: deadline) + return MosaicDefinitionTransaction(base: base, mosaicName: mosaicName, mosaicId: mosaicId, namespaceId: namespaceId, mosaicProperties: mosaicProperties) + } + + override func getTransactionBodyBytes() -> [UInt8] { + let flags: UInt8 = (self.mosaicProperties.isSupplyMutable ? 0x01 : 0x00) + + (self.mosaicProperties.isTransferable ? 0x02 : 0x00) + + (self.mosaicProperties.isLevyMutable ? 0x04 : 0x00) + + let nameBytes = Array(self.mosaicName.utf8) + + var bytes = self.namespaceId.id.bytes // namespace id 8 bytes + bytes += self.mosaicId.id.bytes // mosaic id 8 bytes + bytes += UInt8(nameBytes.count).bytes // mosaic name length 1 byte + bytes += UInt8(1).bytes // property count 1 byte + bytes += flags.bytes // flag 1 byte + bytes += UInt8(self.mosaicProperties.divisibility).bytes // divisibility 1 byte + bytes += nameBytes // mosaic name(UTF8) + bytes += UInt8(2).bytes // indicate duration 1 byte + bytes += mosaicProperties.duration.bytes // // duration 8 byte + + return bytes + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/MosaicSupplyChangeTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/MosaicSupplyChangeTransaction.swift new file mode 100644 index 0000000..94682c8 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/MosaicSupplyChangeTransaction.swift @@ -0,0 +1,58 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/** + * In case a mosaic has the flag 'supplyMutable' set to true, the creator of the mosaic can change the supply, + * i.e. increase or decrease the supply. + */ +public class MosaicSupplyChangeTransaction: Transaction { + // MARK: Properties + /// Mosaic id. + public let mosaicId: MosaicId + /// Mosaic supply type. + public let mosaicSupplyType: MosaicSupplyType + /// Amount of mosaics added or removed. + public let delta: UInt64 + + // MARK: Methods + init(base: Transaction, + mosaicId: MosaicId, + mosaicSupplyType: MosaicSupplyType, + delta: UInt64) { + + self.mosaicId = mosaicId + self.mosaicSupplyType = mosaicSupplyType + self.delta = delta + + super.init(base: base) + } + + /** + * Create a mosaic supply change transaction object. + * + * - parameter mosaicId: Mosaic id. + * - parameter mosaicSupplyType: Supply type. + * - parameter delta: Supply change in units for the mosaic. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction. + * - returns: MosaicSupplyChangeTransaction + */ + public static func create( + mosaicId: MosaicId, + mosaicSupplyType: MosaicSupplyType, + delta: UInt64, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) -> MosaicSupplyChangeTransaction { + let base = Transaction(type: .mosaicSupplyChange, networkType: networkType, version: 2, deadline: deadline) + return MosaicSupplyChangeTransaction(base: base, mosaicId: mosaicId, mosaicSupplyType: mosaicSupplyType, delta: delta) + } + + override func getTransactionBodyBytes() -> [UInt8] { + return self.mosaicId.id.bytes + // id 8 bytes + self.mosaicSupplyType.rawValue.bytes + // direction 1 byte + self.delta.bytes // amount delta 8 bytes + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/MultisigCosignatoryModification.swift b/Nem2SdkSwift/sdk/model/transaction/MultisigCosignatoryModification.swift new file mode 100644 index 0000000..b30b505 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/MultisigCosignatoryModification.swift @@ -0,0 +1,22 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/** + * The multisig cosignatory modifications are part of the NEM's multisig account system. + * With a multisig cosignatory modification a cosignatory is added to or deleted from a multisig account. + * Multisig cosignatory modifications are part of a modify multisig account transactions. + */ +public struct MultisigCosignatoryModification { + /// Multisig modification type. + public let type: MultisigCosignatoryModificationType + /// Cosignatory public account. + public let cosignatory: PublicAccount + + public init(type: MultisigCosignatoryModificationType, cosignatory: PublicAccount) { + self.type = type + self.cosignatory = cosignatory + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/MultisigCosignatoryModificationType.swift b/Nem2SdkSwift/sdk/model/transaction/MultisigCosignatoryModificationType.swift new file mode 100644 index 0000000..470671d --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/MultisigCosignatoryModificationType.swift @@ -0,0 +1,14 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Enum containing multisig cosignatory modification type constants. +public enum MultisigCosignatoryModificationType: UInt8 { + /// Add cosignatory. + case add = 0 + /// Remove cosignatory. + case remove = 1 +} + diff --git a/Nem2SdkSwift/sdk/model/transaction/PlainMessage.swift b/Nem2SdkSwift/sdk/model/transaction/PlainMessage.swift new file mode 100644 index 0000000..9d8e517 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/PlainMessage.swift @@ -0,0 +1,35 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The plain message model defines a plain string. When sending it to the network we transform the payload to hex-string. +public class PlainMessage: Message { + // MARK: Properties + /// Plain message containing an empty string. + public static let empty = PlainMessage(text: "") + /// Plain text message. Nil If loaded payload cannot be decoded as utf-8 string. + public let text: String? + + /** + * Constructor + * + * - parameter text: plain message text. + */ + public init(text: String) { + self.text = text + super.init(type: 0, payload: Array(text.utf8)) + } + + /** + * Constructor + * + * - parameter payload: plain message payload + */ + init(payload: [UInt8]) { + self.text = String(bytes: payload, encoding: .utf8) + super.init(type: 0, payload: payload) + } +} + diff --git a/Nem2SdkSwift/sdk/model/transaction/RegisterNamespaceTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/RegisterNamespaceTransaction.swift new file mode 100644 index 0000000..e5b0c76 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/RegisterNamespaceTransaction.swift @@ -0,0 +1,101 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/** + * Accounts can rent a namespace for an amount of blocks and after a this renew the contract. + * This is done via a RegisterNamespaceTransaction. + */ +public class RegisterNamespaceTransaction: Transaction { + // MARK: Properties + /// Namespace name. + public let namespaceName: String + /// ID of the namespace derived from namespaceName. + /// When creating a sub namespace the namespaceId is derived from namespaceName and parentId. + public let namespaceId: NamespaceId + /// Namespace type either rootNamespace or subNamespace. + public let namespaceType: NamespaceType + /// Number of blocks a namespace is active. + public let duration: UInt64? + /// ID of the parent of sub namespace. + public let parentId: NamespaceId? + + // MARK: Methods + init(base: Transaction, + namespaceName: String, + namespaceId: NamespaceId, + namespaceType: NamespaceType, + duration: UInt64? = nil, + parentId: NamespaceId? = nil) { + + self.namespaceName = namespaceName + self.namespaceId = namespaceId + self.namespaceType = namespaceType + self.duration = duration + self.parentId = parentId + + super.init(base: base) + } + + + /** + * Create a root namespace object. + * + * - parameter namespaceName: Namespace name. + * - parameter duration: Duration of the namespace. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + * - returns: Instance of RegisterNamespaceTransaction + */ + public static func createRootNamespace( + namespaceName: String, + duration: UInt64, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> RegisterNamespaceTransaction { + + let namespaceId = try NamespaceId(fullName: namespaceName) + let base = Transaction(type: .registerNamespace, networkType: networkType, version: 2, deadline: deadline) + return RegisterNamespaceTransaction(base: base, + namespaceName: namespaceName, + namespaceId: namespaceId, + namespaceType: .rootNamespace, + duration: duration) + } + + /** + * Create a sub namespace object. + * + * - parameter namespaceName: Namespace name. + * - parameter parentId: Parent id name. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + * - returns: Instance of RegisterNamespaceTransaction + */ + public static func createSubNamespace( + namespaceName: String, + parentId: NamespaceId, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> RegisterNamespaceTransaction { + + let base = Transaction(type: .registerNamespace, networkType: networkType, version: 2, deadline: deadline) + return RegisterNamespaceTransaction( + base: base, + namespaceName: namespaceName, + namespaceId: NamespaceId(id: IdGenerator.generateId(name: namespaceName, parentId: parentId.id)), + namespaceType: .subNamespace, + parentId: parentId) + } + + override func getTransactionBodyBytes() -> [UInt8] { + + let nameBytes = Array(namespaceName.utf8) + + return namespaceType.rawValue.bytes + // type 1 byte + (namespaceType == .rootNamespace ? duration!.bytes : parentId!.id.bytes) + // duration if root, parent if if sub. Both are 8 bytes + namespaceId.id.bytes + // namespace id 8 bytes + UInt8(nameBytes.count).bytes + // namespace name length 1 byte + nameBytes // namespace name( UTF8 ) + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/SecretLockTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/SecretLockTransaction.swift new file mode 100644 index 0000000..3690db8 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/SecretLockTransaction.swift @@ -0,0 +1,80 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Secret lock transaction +public class SecretLockTransaction: Transaction { + // MARK: Properties + + /// Locked mosaic. + public let mosaic: Mosaic + /// Duration for the funds to be released or returned. + public let duration: UInt64 + /// Hash algorithm, secret is generated with. + public let hashType: HashType + /// Proof hashed. + public let secret: [UInt8] + /// Recipient of the funds. + public let recipient: Address + + // MARK: Methods + init(base: Transaction, + mosaic: Mosaic, + duration: UInt64, + hashType: HashType, + secret: [UInt8], + recipient: Address) { + + self.mosaic = mosaic + self.duration = duration + self.hashType = hashType + self.secret = secret + self.recipient = recipient + + super.init(base: base) + } + + + /** + * Create a secret lock transaction object. + * + * - parameter mosaic: Locked mosaic. + * - parameter duration: Duration for the funds to be released or returned. + * - parameter hashType: Hash algorithm secret is generated with. + * - parameter secret: Proof hashed. + * - parameter recipient: Recipient of the funds. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction. + * + * - returns: a SecretLockTransaction instance + */ + public static func create( + mosaic: Mosaic, + duration: UInt64, + hashType: HashType, + secret: [UInt8], + recipient: Address, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) -> SecretLockTransaction { + let base = Transaction(type: .secretLock, networkType: networkType, version: 3, deadline: deadline) + return SecretLockTransaction( + base: base, + mosaic: mosaic, + duration: duration, + hashType: hashType, + secret: secret, + recipient: recipient) + } + + override func getTransactionBodyBytes() -> [UInt8] { + return self.mosaic.id.id.bytes + // mosaic id 8 bytes + self.mosaic.amount.bytes + // mosaic amount 8 bytes + self.duration.bytes + // duration 8 bytes + self.hashType.rawValue.bytes + // hash algorithm 1 byte + self.secret + // secret 64 byte + self.recipient.bytes // base 32 address + } + +} diff --git a/Nem2SdkSwift/sdk/model/transaction/SecretProofTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/SecretProofTransaction.swift new file mode 100644 index 0000000..935accf --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/SecretProofTransaction.swift @@ -0,0 +1,64 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Secret lock transaction +public class SecretProofTransaction: Transaction { + // MARK: Properties + + /// Hash algorithm, secret is generated with. + public let hashType: HashType + /// Proof hashed. + public let secret: [UInt8] + /// Proof. + public let proof: [UInt8] + + // MARK: Methods + init(base: Transaction, + hashType: HashType, + secret: [UInt8], + proof: [UInt8]) { + + self.hashType = hashType + self.secret = secret + self.proof = proof + + super.init(base: base) + } + + + /** + * Create a secret proof transaction object. + * + * - parameter hashType: Hash algorithm secret is generated with. + * - parameter secret: Proof hashed. + * - parameter proof: Proof. + * - parameter recipient: Recipient of the funds. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + * + * - returns: a SecretProofTransaction instance + */ + public static func create( + hashType: HashType, + secret: [UInt8], + proof: [UInt8], + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) -> SecretProofTransaction { + let base = Transaction(type: .secretProof, networkType: networkType, version: 3, deadline: deadline) + return SecretProofTransaction( + base: base, + hashType: hashType, + secret: secret, + proof: proof) + } + + override func getTransactionBodyBytes() -> [UInt8] { + return self.hashType.rawValue.bytes + // hash algorithm 1 byte + self.secret + // secret 64 byte + UInt16(self.proof.count).bytes + // proof size 2 bytes + self.proof // proof + } +} diff --git a/Nem2SdkSwift/sdk/model/transaction/SignedTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/SignedTransaction.swift new file mode 100644 index 0000000..d3d2cc4 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/SignedTransaction.swift @@ -0,0 +1,16 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The signed transaction object is used to transfer the transaction data and the signature to NIS +public struct SignedTransaction { + // MARK: Properties + /// Transaction serialized data. + public let payload: [UInt8] + /// Transaction hash. + public let hash: [UInt8] + /// Transaction type. + public let type: TransactionType +} diff --git a/Nem2SdkSwift/sdk/model/transaction/Transaction.swift b/Nem2SdkSwift/sdk/model/transaction/Transaction.swift new file mode 100644 index 0000000..f67608f --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/Transaction.swift @@ -0,0 +1,184 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +/// An abstract transaction class that serves as the base class of all NEM transactions. +public class Transaction { + // MARK: Properties + /// Transaction type. + public let type: TransactionType + /// Network type. + public let networkType: NetworkType + /// Transaction version. + public let version: UInt8 + /// Deadline to include the transaction. + public let deadline: Deadline + /// Fee for the transaction. The higher the fee, the higher the priority of the transaction. Transactions with high priority get included in a block before transactions with lower priority. + public let fee: UInt64 + /// Transaction signature (missing if part of an aggregate transaction). + public let signature: String? + /// Transaction creator public account. + public private(set) var signer: PublicAccount? + /// Meta data object contains additional information about the transaction. + public let transactionInfo: TransactionInfo? + + /// If a transaction is pending to be included in a block. + public var isUnconfirmed: Bool { + guard let transactionInfo = self.transactionInfo else { + return false + } + return transactionInfo.height == 0 && transactionInfo.hash == transactionInfo.merkleComponentHash + } + + /// If a transaction is included in a block. + public var isConfirmed: Bool { + return transactionInfo != nil && transactionInfo!.height > 0 + } + + /// if a transaction has missing signatures. + public var hasMissingSignatures: Bool { + guard let transactionInfo = self.transactionInfo else { + return false + } + return transactionInfo.height == 0 && transactionInfo.hash != transactionInfo.merkleComponentHash + } + + /// If a transaction is not known by the network. + public var isUnannounced: Bool { + return self.transactionInfo == nil + } + + // MARK: Methods + /** + * Constructor + * + * - parameter type: Transaction type. + * - parameter networkType: Network type. + * - parameter version: Transaction version. + * - parameter deadline: Transaction deadline. + * - parameter fee: Transaction fee. + * - parameter signature: Transaction signature. + * - parameter signer: Transaction signer. + * - parameter transactionInfo: Transaction meta data info. + */ + init(type: TransactionType, + networkType: NetworkType, + version: UInt8, + deadline: Deadline, + fee: UInt64 = 0, + signature: String? = nil, + signer: PublicAccount? = nil, + transactionInfo: TransactionInfo? = nil) { + self.type = type + self.networkType = networkType + self.version = version + self.deadline = deadline + self.fee = fee + self.signature = signature + self.signer = signer + self.transactionInfo = transactionInfo + } + + init(base: Transaction) { + self.type = base.type + self.networkType = base.networkType + self.version = base.version + self.deadline = base.deadline + self.fee = base.fee + self.signature = base.signature + self.signer = base.signer + self.transactionInfo = base.transactionInfo + } + + /** + * Generates hash for a serialized transaction payload. + * + * - parameter signature: Signature bytes + * - parameter signer: Signer bytes + * - parameter message: Message bytes to be signed. + * - returns: Generated transaction hash. + */ + static func createTransactionHash(signature: [UInt8], signer: [UInt8], message: [UInt8]) -> [UInt8] { + return Hashes.sha3_256(Array(signature[0..<32]) + signer + message) + } + + + // abstract function to create transaction payload bytes + func getTransactionBodyBytes() -> [UInt8] { + return [] + } + + + /** + * Serialize and sign transaction creating a new SignedTransaction. + * + * - parameter account: The account to sign the transaction. + * - returns: Signed transaction. + */ + public func signWith(account: Account) -> SignedTransaction { + let signer = Signer(keyPair: account.keyPair) + + let body = getTransactionBodyBytes() + + let signingBytes = self.version.bytes + // version 1 byte + self.networkType.rawValue.bytes + // network type 1 byte + self.type.rawValue.bytes + // type 2 bytes + self.fee.bytes + // fee 8 bytes + self.deadline.timestamp.bytes + // deadline 8 bytes + body // and actual data + + let signature = signer.sign(message: signingBytes) + let signerBytes = account.keyPair.publicKey.bytes + + let hash = Transaction.createTransactionHash( + signature: signature, + signer: signerBytes, + message: signingBytes) + + let payload = signature + // signature 64 bytes + signerBytes + // signer 32 bytes + signingBytes // message bytes to be singed + + + let size = UInt32(payload.count + 4) // size including the size of itself + return SignedTransaction(payload: size.bytes + payload, hash: hash, type: type) + } + + /** + * Takes a transaction and formats bytes to be included in an aggregate transaction. + * + * - returns: transaction with signer serialized to be part of an aggregate transaction + */ + func toAggregateTransactionBytes() throws -> [UInt8] { + guard let signer = self.signer else { + throw Nem2SdkSwiftError.serializeError("Failed to serialize transaction as aggregate inner transaction because it has no signer.") + } + + let signerBytes = signer.publicKey.bytes + + let body = getTransactionBodyBytes() + + let resultBytes = signerBytes + + self.version.bytes + // version 1 byte + self.networkType.rawValue.bytes + // network type 1 byte + self.type.rawValue.bytes + // type 2 bytes + body // and actual data + + let size = UInt32(resultBytes.count + 4) // size including the size of itself + return size.bytes + resultBytes + } + + /** + * Convert an aggregate transaction to an inner transaction including transaction signer. + * + * - parameter signer: Transaction signer. + * - returns: instance of Transaction with signer + */ + public func toAggregate(signer: PublicAccount) -> Transaction { + self.signer = signer + return self + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/model/transaction/TransactionAnnounceResponse.swift b/Nem2SdkSwift/sdk/model/transaction/TransactionAnnounceResponse.swift new file mode 100644 index 0000000..c3c2a5a --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransactionAnnounceResponse.swift @@ -0,0 +1,11 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The transaction response of an announce transaction. +public struct TransactionAnnounceResponse { + /// Success or error message. + public let message: String +} diff --git a/Nem2SdkSwift/sdk/model/transaction/TransactionInfo.swift b/Nem2SdkSwift/sdk/model/transaction/TransactionInfo.swift new file mode 100644 index 0000000..f8fa945 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransactionInfo.swift @@ -0,0 +1,82 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The transaction information model included in all transactions. +public struct TransactionInfo { + // MARK: Properties + /// Block height in which the transaction was included. + public let height: UInt64 + /// Index representing either transaction index/position within block or within an aggregate transaction. + public let index: Int? + /// Transaction id. + public let id: String? + /// Transaction hash. + public let hash: [UInt8]? + /// Transaction merkle component hash. + public let merkleComponentHash: [UInt8]? + /// Hash of the aggregate transaction. + public let aggregateHash: [UInt8]? + /// Id of the aggregate transaction. + public let aggregateId: String? + + private init(height: UInt64, + index: Int? = nil, + id: String? = nil, + hash: [UInt8]? = nil, + merkleComponentHash: [UInt8]? = nil, + aggregateHash: [UInt8]? = nil, + aggregateId: String? = nil) { + self.height = height + self.index = index + self.id = id + self.hash = hash + self.merkleComponentHash = merkleComponentHash + self.aggregateHash = aggregateHash + self.aggregateId = aggregateId + } + + // MARK: Methods + /** + * Create transaction info object for aggregate transaction inner transaction. + * + * - parameter height: Block height in which the transaction was included. + * - parameter index: The transaction index. + * - parameter id: transaction id. + * - parameter aggregateHash: The hash of the aggregate transaction. + * - parameter aggregateId: The id of the aggregate transaction. + * - returns: Instance of TransactionInfo + */ + public static func createAggregate(height: UInt64, index: Int, id: String, aggregateHash: [UInt8], aggregateId: String) -> TransactionInfo { + return TransactionInfo(height: height, index: index, id: id, aggregateHash: aggregateHash, aggregateId: aggregateId) + } + + /** + * Create transaction info object for a transaction. + * + * - parameter height: Block height in which the transaction was included. + * - parameter index: The transaction index. + * - parameter id: transaction id. + * - parameter hash: The transaction hash. + * - parameter merkleComponentHash: The transaction merkle component hash. + * - returns: Instance of TransactionInfo + */ + public static func create(height: UInt64, index: Int, id: String, hash: [UInt8], merkleComponentHash: [UInt8]) -> TransactionInfo { + return TransactionInfo(height: height, index: index, id: id, hash: hash, merkleComponentHash: merkleComponentHash) + } + + /** + * Create transaction info retrieved by listener. + * + * - parameter height: Block height in which the transaction was included. + * - parameter hash: The transaction hash + * - parameter merkleComponentHash: The transaction merkle component hash. + * - returns: Instance of TransactionInfo + */ + public static func create(height: UInt64, hash: [UInt8], merkleComponentHash: [UInt8]) -> TransactionInfo { + return TransactionInfo(height: height, hash: hash, merkleComponentHash: merkleComponentHash) + } + +} diff --git a/Nem2SdkSwift/sdk/model/transaction/TransactionMapping.swift b/Nem2SdkSwift/sdk/model/transaction/TransactionMapping.swift new file mode 100644 index 0000000..b10e6ef --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransactionMapping.swift @@ -0,0 +1,325 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +class TransactionMapping { + static func apply(_ dictionary: AnyObjectDictionary) throws -> Transaction { + guard case .object(let object) = dictionary else { + throw Nem2SdkSwiftError.parseError("Failed to parse transaction.") + } + + let meta = try object.getDictionary("meta") + let transaction = try object.getDictionary("transaction") + + return try apply(meta, transaction) + } + + static func apply(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> Transaction { + let type: TransactionType = try transaction.getEnum("type") + + switch type { + case .aggregateComplete, .aggregateBonded: return try getAggregate(meta, transaction) + case .mosaicDefinition: return try getMosaicDefinition(meta, transaction) + case .mosaicSupplyChange: return try getMosaicSupplyChange(meta, transaction) + case .modifyMultisigAccount: return try getModifyMultisigAccount(meta, transaction) + case .registerNamespace: return try getRegisterNamespace(meta, transaction) + case .transfer: return try getTransfer(meta, transaction) + case .lock: return try getLockFunds(meta, transaction) + case .secretLock: return try getSecretLock(meta, transaction) + case .secretProof: return try getSecretProof(meta, transaction) + } + } + + static func getBase(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> Transaction { + let type: TransactionType = try transaction.getEnum("type") + let versionAndNetwork = try transaction.getInt("version") + let version = UInt8(versionAndNetwork & 0xFF) + let networkValue = UInt8((versionAndNetwork >> 8) & 0xFF) + guard let network = NetworkType(rawValue: networkValue) else { + throw Nem2SdkSwiftError.parseError("Unknown network \(networkValue).") + } + + let hash = try? meta.getString("hash") + let id = try? meta.getString("id") + let aggregateHash = try? meta.getString("aggregateHash") + + let transactionInfo: TransactionInfo + if (hash != nil && id != nil) { + transactionInfo = TransactionInfo.create( + height: try meta.getUInt64("height"), + index: Int(try meta.getInt("index")), + id: id!, + hash: try HexEncoder.toBytes(hash!), + merkleComponentHash: try HexEncoder.toBytes(try meta.getString("merkleComponentHash"))) + } else if aggregateHash != nil && id != nil { + transactionInfo = TransactionInfo.createAggregate( + height: try meta.getUInt64("height"), + index: Int(try meta.getInt("index")), + id: id!, + aggregateHash: try HexEncoder.toBytes(aggregateHash!), + aggregateId: try! meta.getString("aggregateId")) + } else { + transactionInfo = TransactionInfo.create( + height: try meta.getUInt64("height"), + hash: try HexEncoder.toBytes(try meta.getString("hash")), + merkleComponentHash: try HexEncoder.toBytes(try meta.getString("merkleComponentHash"))) + } + + return Transaction( + type: type, + networkType: network, + version: version, + deadline: Deadline(fromNemesis: TimeInterval(try transaction.getUInt64("deadline")) / 1000.0), + fee: try transaction.getUInt64("fee"), + signature: try transaction.getString("signature"), + signer: try PublicAccount(publicKeyHexString: try transaction.getString("signer"), networkType: network), + transactionInfo: transactionInfo) + } + + static func getAggregate(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> AggregateTransaction { + let baseTransaction = try getBase(meta, transaction) + let innerTransactions = try transaction.getArrayOfDictionary("transactions").map { (innerTransaction: [String: AnyObjectDictionary]) -> Transaction in + var innerTransactionObject = try innerTransaction.getDictionary("transaction") + // copy deadline, fee, signature to inner transaction. + ["deadline", "fee", "signature"].forEach {innerTransactionObject[$0] = transaction[$0]} + return try TransactionMapping.apply((try? innerTransaction.getDictionary("meta")) ?? meta, innerTransactionObject) + } + + let cosignatures = try (try? transaction.getArrayOfDictionary("cosignatures"))?.map { (aggregateCosignature: [String: AnyObjectDictionary]) -> AggregateTransactionCosignature in + return AggregateTransactionCosignature( + signature: try HexEncoder.toBytes(aggregateCosignature.getString("signature")), + signer: try PublicAccount(publicKeyHexString: aggregateCosignature.getString("signer"), networkType: baseTransaction.networkType)) + } ?? [] + + return AggregateTransaction( + base: baseTransaction, + innerTransactions: innerTransactions, + cosignatures: cosignatures) + } + + static func getMosaicDefinition(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> MosaicDefinitionTransaction { + let properties = try transaction.getArrayOfDictionary("properties") + let flags = try properties[0].getArrayOfInt("value")[0] + + let mosaicProperties = MosaicProperties( + isSupplyMutable: (flags & 0x01) != 0, + isTransferable: (flags & 0x02) != 0, + isLevyMutable: (flags & 0x04) != 0, + divisibility: Int(try properties[1].getArrayOfInt("value")[0]), + duration: properties.count > 2 ? (try properties[2].getUInt64("value")) : 0) + + return MosaicDefinitionTransaction( + base: try getBase(meta, transaction), + mosaicName: try transaction.getString("name"), + mosaicId: MosaicId(id: try transaction.getUInt64("mosaicId")), + namespaceId: NamespaceId(id: try transaction.getUInt64("parentId")), + mosaicProperties: mosaicProperties) + } + + static func getMosaicSupplyChange(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> MosaicSupplyChangeTransaction { + return MosaicSupplyChangeTransaction( + base: try getBase(meta, transaction), + mosaicId: MosaicId(id: try transaction.getUInt64("mosaicId")), + mosaicSupplyType: try transaction.getEnum("direction"), + delta: try transaction.getUInt64("delta")) + } + + static func getModifyMultisigAccount(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> ModifyMultisigAccountTransaction { + let base = try getBase(meta, transaction) + let modifications: [MultisigCosignatoryModification] = try (try? transaction.getArrayOfDictionary("modifications"))?.map { modification in + return MultisigCosignatoryModification( + type: try modification.getEnum("type"), + cosignatory: try PublicAccount(publicKeyHexString: try modification.getString("cosignatoryPublicKey"), networkType: base.networkType)) + } ?? [] + + return ModifyMultisigAccountTransaction( + base: try getBase(meta, transaction), + minApprovalDelta: Int8(try transaction.getInt("minApprovalDelta")), + minRemovalDelta: Int8(try transaction.getInt("minRemovalDelta")), + modifications: modifications) + } + + static func getRegisterNamespace(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> RegisterNamespaceTransaction { + let namespaceType: NamespaceType = try transaction.getEnum("namespaceType") + + return RegisterNamespaceTransaction( + base: try getBase(meta, transaction), + namespaceName: try transaction.getString("name"), + namespaceId: NamespaceId(id: try transaction.getUInt64("namespaceId")), + namespaceType: namespaceType, + duration: namespaceType == .rootNamespace ? try transaction.getUInt64("duration") : nil, + parentId: namespaceType == .subNamespace ? NamespaceId(id: try transaction.getUInt64("parentId")) : nil) + } + + static func getTransfer(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> TransferTransaction{ + let mosaics = try (try? transaction.getArrayOfDictionary("mosaics"))?.map { mosaicJson in + Mosaic(id: MosaicId(id: try mosaicJson.getUInt64("id")), amount: try mosaicJson.getUInt64("amount")) + } ?? [] + + let message: Message? + if let messageJson = try? transaction.getDictionary("message") { + let payload = try HexEncoder.toBytes(try messageJson.getString("payload")) + // TODO: Encrypted message + message = PlainMessage(payload: payload) + } else { + message = nil + } + + return TransferTransaction( + base: try getBase(meta, transaction), + recipient: try Address(encodedAddress: try transaction.getString("recipient")), + mosaics: mosaics, + message: message) + } + + static func getLockFunds(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> LockFundsTransaction { + let mosaic: Mosaic + if transaction["mosaicId"] != nil { + mosaic = Mosaic(id: MosaicId(id: try transaction.getUInt64("mosaicId")), amount: try transaction.getUInt64("amount")) + } else { + let mosaicObject = try transaction.getDictionary("mosaic") + mosaic = Mosaic(id: MosaicId(id: try mosaicObject.getUInt64("id")), amount: try mosaicObject.getUInt64("amount")) + } + return LockFundsTransaction( + base: try getBase(meta, transaction), + mosaic: mosaic, + duration: try transaction.getUInt64("duration"), + signedTransaction: SignedTransaction(payload: [], hash: try HexEncoder.toBytes(try transaction.getString("hash")), type: .aggregateBonded)) + } + + static func getSecretLock(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> SecretLockTransaction { + let mosaic: Mosaic + if transaction["mosaicId"] != nil { + mosaic = Mosaic(id: MosaicId(id: try transaction.getUInt64("mosaicId")), amount: try transaction.getUInt64("amount")) + } else { + let mosaicObject = try transaction.getDictionary("mosaic") + mosaic = Mosaic(id: MosaicId(id: try mosaicObject.getUInt64("id")), amount: try mosaicObject.getUInt64("amount")) + } + + return SecretLockTransaction( + base: try getBase(meta, transaction), + mosaic: mosaic, + duration: try transaction.getUInt64("duration"), + hashType: try transaction.getEnum("hashAlgorithm"), + secret: try HexEncoder.toBytes(transaction.getString("secret")), + recipient: try Address(encodedAddress: try transaction.getString("recipient"))) + } + + static func getSecretProof(_ meta: [String: AnyObjectDictionary], _ transaction: [String: AnyObjectDictionary]) throws -> SecretProofTransaction { + return SecretProofTransaction( + base: try getBase(meta, transaction), + hashType: try transaction.getEnum("hashAlgorithm"), + secret: try HexEncoder.toBytes(transaction.getString("secret")), + proof: try HexEncoder.toBytes(transaction.getString("proof"))) + } +} + + +extension Array where Element == AnyObjectDictionary { + private func getObject(_ index: Int) throws -> AnyObjectDictionary{ + guard index < self.count else { + throw Nem2SdkSwiftError.parseError("Index \(index) is out of bounds") + } + return self[index] + } + + func getInt(_ index: Int) throws -> Int64 { + guard case .integer(let value) = try getObject(index) else { + throw Nem2SdkSwiftError.parseError("Failed to parse array element as integer.") + } + return value + } + + func getArray(_ index: Int) throws -> [AnyObjectDictionary] { + guard case .array(let value) = try getObject(index) else { + throw Nem2SdkSwiftError.parseError("Failed to parse array element as array.") + } + return value + } + + func getDictionary(_ index: Int) throws -> [String: AnyObjectDictionary] { + guard case .object(let value) = try getObject(index) else { + throw Nem2SdkSwiftError.parseError("Failed to parse array element as dictionary.") + } + return value + } + + func getUInt64(_ index: Int) throws -> UInt64 { + let array = try getArray(index) + guard array.count != 2 else { + throw Nem2SdkSwiftError.parseError("Failed to parse array element as uint64") + } + let lower = try array.getInt(0) + let higher = try array.getInt(1) + return UInt64(UInt32(higher) << 32) + UInt64(UInt32(lower)) + } +} + +extension Dictionary where Key == String, Value == AnyObjectDictionary { + func getInt(_ key: String) throws -> Int64 { + guard let valueObject = self[key], + case .integer(let value) = valueObject else { + throw Nem2SdkSwiftError.parseError("Failed to parse \(key)") + } + return value + } + + func getString(_ key: String) throws -> String { + guard let valueObject = self[key], + case .string(let value) = valueObject else { + throw Nem2SdkSwiftError.parseError("Failed to parse \(key)") + } + return value + } + + func getArray(_ key: String) throws -> [AnyObjectDictionary] { + guard let valueObject = self[key], + case .array(let value) = valueObject else { + throw Nem2SdkSwiftError.parseError("Failed to parse \(key)") + } + return value + } + + func getDictionary(_ key: String) throws -> [String: AnyObjectDictionary] { + guard let valueObject = self[key], + case .object(let value) = valueObject else { + throw Nem2SdkSwiftError.parseError("Failed to parse \(key)") + } + return value + } + + func getArrayOfInt(_ key: String) throws -> [Int64] { + let array = try getArray(key) + return try array.enumerated().map { index, _ in try array.getInt(index) } + } + + + func getArrayOfDictionary(_ key: String) throws -> [[String: AnyObjectDictionary]] { + let array = try getArray(key) + return try array.enumerated().map { index, _ in try array.getDictionary(index) } + } + + + func getUInt64(_ key: String) throws -> UInt64 { + let array = try getArray(key) + guard array.count == 2 else { + throw Nem2SdkSwiftError.parseError("Failed to parse \(key) as uint64") + } + + let lower = try array.getInt(0) + let higher = try array.getInt(1) + + return UInt64(UInt32(higher)) << 32 + UInt64(UInt32(lower)) + } + + func getEnum(_ key: String) throws -> T where T.RawValue : FixedWidthInteger{ + let rawValue = try getInt(key) + + guard let value = T(rawValue: T.RawValue(clamping: rawValue)) else { + throw Nem2SdkSwiftError.parseError("\(rawValue) is unknown value as \(String(describing: T.self)).") + } + return value + } +} \ No newline at end of file diff --git a/Nem2SdkSwift/sdk/model/transaction/TransactionStatus.swift b/Nem2SdkSwift/sdk/model/transaction/TransactionStatus.swift new file mode 100644 index 0000000..b3476bd --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransactionStatus.swift @@ -0,0 +1,21 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + + +/// The transaction status contains basic of a transaction announced to the blockchain. +public struct TransactionStatus { + // MARK: Properties + /// Transaction status group "failed", "unconfirmed", "confirmed", etc... + public let group: String? + /// Transaction status being the error name in case of failure and success otherwise. + public let status: String + /// Transaction hash. + public let hash: [UInt8]? + /// Transaction deadline. + public let deadline: Deadline? + /// Height of the block at which it was confirmed or rejected. + public let height: UInt64? +} diff --git a/Nem2SdkSwift/sdk/model/transaction/TransactionStatusError.swift b/Nem2SdkSwift/sdk/model/transaction/TransactionStatusError.swift new file mode 100644 index 0000000..0715ed3 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransactionStatusError.swift @@ -0,0 +1,15 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The transaction status error model returned by listeners. +public struct TransactionStatusError { + /// Transaction hash. + public let hash: [UInt8] + /// Transaction status error when transaction fails. + public let status: String + /// Transaction deadline. + public let deadline: Deadline +} diff --git a/Nem2SdkSwift/sdk/model/transaction/TransactionType.swift b/Nem2SdkSwift/sdk/model/transaction/TransactionType.swift new file mode 100644 index 0000000..f846146 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransactionType.swift @@ -0,0 +1,29 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Enum containing transaction type constants. +public enum TransactionType: UInt16 { + /// Aggregate complete transaction type. + case aggregateComplete = 0x4141 + /// Aggregate bonded transaction type + case aggregateBonded = 0x4241 + /// Mosaic definition transaction type. + case mosaicDefinition = 0x414d + /// Mosaic supply change + case mosaicSupplyChange = 0x424d + /// Modify multisig account + case modifyMultisigAccount = 0x4155 + /// Register namespace transaction type. + case registerNamespace = 0x414e + /// Transfer Transaction transaction type. + case transfer = 0x4154 + /// Lock transaction type + case lock = 0x414C + /// Secret Lock Transaction type + case secretLock = 0x424C + /// Secret Proof transaction type + case secretProof = 0x434C +} diff --git a/Nem2SdkSwift/sdk/model/transaction/TransferTransaction.swift b/Nem2SdkSwift/sdk/model/transaction/TransferTransaction.swift new file mode 100644 index 0000000..f096f58 --- /dev/null +++ b/Nem2SdkSwift/sdk/model/transaction/TransferTransaction.swift @@ -0,0 +1,70 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// Transfer transaction. +public class TransferTransaction: Transaction { + /// Address of the recipient. + public let recipient: Address + /// List of mosaic objects. + public let mosaics: [Mosaic] + /// Transaction message. + public let message: Message? + + + init(base: Transaction, + recipient: Address, + mosaics: [Mosaic], + message: Message?) { + + self.recipient = recipient + self.mosaics = mosaics + self.message = message + + super.init(base: base) + } + + /** + * Create a transfer transaction object. + * + * - parameter recipient: Recipient of the transaction. + * - parameter mosaics: Array of mosaics. + * - parameter message: Transaction message. + * - parameter networkType: Network type. + * - parameter deadline: Deadline to include the transaction.(Optional. The default is 1 hour from now.) + */ + public static func create( + recipient: Address, + mosaics: [Mosaic], + message: Message? = nil, + networkType: NetworkType, + deadline: Deadline = Deadline(fromNow: 60 * 60)) -> TransferTransaction { + let base = Transaction(type: .transfer, networkType: networkType, version: 3, deadline: deadline) + return TransferTransaction(base: base, recipient: recipient, mosaics: mosaics, message: message) + } + + override func getTransactionBodyBytes() -> [UInt8] { + let recipientBytes = recipient.bytes + + // message + let messageSize: UInt16 + let messageBytes: [UInt8] + if let message = self.message { + messageSize = UInt16(message.payload.count + 1) + messageBytes = [message.type] + message.payload + } else { + messageSize = 0 + messageBytes = [] + } + // mosaics + let mosaicsBytes = mosaics.map { mosaic in mosaic.id.id.bytes + mosaic.amount.bytes }.reduce([]) { $0 + $1 } + + return recipientBytes + + messageSize.bytes + + UInt8(mosaics.count).bytes + + messageBytes + + mosaicsBytes + } +} diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.pbxproj b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..53c59f5 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.pbxproj @@ -0,0 +1,680 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 5FB684A3216C1504003EE6C4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB684A2216C1504003EE6C4 /* AppDelegate.swift */; }; + 5FB684A5216C1504003EE6C4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB684A4216C1504003EE6C4 /* ViewController.swift */; }; + 5FB684A8216C1504003EE6C4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5FB684A6216C1504003EE6C4 /* Main.storyboard */; }; + 5FB684AA216C1505003EE6C4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5FB684A9216C1505003EE6C4 /* Assets.xcassets */; }; + 5FB684AD216C1505003EE6C4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5FB684AB216C1505003EE6C4 /* LaunchScreen.storyboard */; }; + 5FB684B8216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB684B7216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.swift */; }; + 5FB684C3216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB684C2216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.swift */; }; + 5FB684D9216C153C003EE6C4 /* Nem2SdkSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FB684D6216C1534003EE6C4 /* Nem2SdkSwift.framework */; }; + 5FB684DA216C153C003EE6C4 /* Nem2SdkSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5FB684D6216C1534003EE6C4 /* Nem2SdkSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5FB6853D216EB71C003EE6C4 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FB6853C216EB71C003EE6C4 /* RxSwift.framework */; }; + 5FB6853E216EB71C003EE6C4 /* RxSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5FB6853C216EB71C003EE6C4 /* RxSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 5FB684B4216C1506003EE6C4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5FB68497216C1504003EE6C4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5FB6849E216C1504003EE6C4; + remoteInfo = Nem2SdkSwiftDemo; + }; + 5FB684BF216C1506003EE6C4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5FB68497216C1504003EE6C4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5FB6849E216C1504003EE6C4; + remoteInfo = Nem2SdkSwiftDemo; + }; + 5FB684D5216C1534003EE6C4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5FB684D0216C1534003EE6C4 /* Nem2SdkSwift.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5F61FE792159AC0500B8474A; + remoteInfo = Nem2SdkSwift; + }; + 5FB684D7216C1534003EE6C4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5FB684D0216C1534003EE6C4 /* Nem2SdkSwift.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5F61FE822159AC0500B8474A; + remoteInfo = Nem2SdkSwiftTests; + }; + 5FB684DB216C153C003EE6C4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5FB684D0216C1534003EE6C4 /* Nem2SdkSwift.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 5F61FE782159AC0500B8474A; + remoteInfo = Nem2SdkSwift; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 5FB684DD216C153C003EE6C4 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 5FB6853E216EB71C003EE6C4 /* RxSwift.framework in Embed Frameworks */, + 5FB684DA216C153C003EE6C4 /* Nem2SdkSwift.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 5FB6849F216C1504003EE6C4 /* Nem2SdkSwiftDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nem2SdkSwiftDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 5FB684A2216C1504003EE6C4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 5FB684A4216C1504003EE6C4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 5FB684A7216C1504003EE6C4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 5FB684A9216C1505003EE6C4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 5FB684AC216C1505003EE6C4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 5FB684AE216C1505003EE6C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5FB684B3216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Nem2SdkSwiftDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5FB684B7216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Nem2SdkSwiftDemoTests.swift; sourceTree = ""; }; + 5FB684B9216C1506003EE6C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5FB684BE216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Nem2SdkSwiftDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5FB684C2216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Nem2SdkSwiftDemoUITests.swift; sourceTree = ""; }; + 5FB684C4216C1506003EE6C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5FB684D0216C1534003EE6C4 /* Nem2SdkSwift.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Nem2SdkSwift.xcodeproj; path = ../Nem2SdkSwift.xcodeproj; sourceTree = ""; }; + 5FB6853C216EB71C003EE6C4 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = ../Carthage/Build/iOS/RxSwift.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5FB6849C216C1504003EE6C4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5FB6853D216EB71C003EE6C4 /* RxSwift.framework in Frameworks */, + 5FB684D9216C153C003EE6C4 /* Nem2SdkSwift.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5FB684B0216C1506003EE6C4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5FB684BB216C1506003EE6C4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5FB68496216C1504003EE6C4 = { + isa = PBXGroup; + children = ( + 5FB6853C216EB71C003EE6C4 /* RxSwift.framework */, + 5FB684D0216C1534003EE6C4 /* Nem2SdkSwift.xcodeproj */, + 5FB684A1216C1504003EE6C4 /* Nem2SdkSwiftDemo */, + 5FB684B6216C1506003EE6C4 /* Nem2SdkSwiftDemoTests */, + 5FB684C1216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests */, + 5FB684A0216C1504003EE6C4 /* Products */, + ); + sourceTree = ""; + }; + 5FB684A0216C1504003EE6C4 /* Products */ = { + isa = PBXGroup; + children = ( + 5FB6849F216C1504003EE6C4 /* Nem2SdkSwiftDemo.app */, + 5FB684B3216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.xctest */, + 5FB684BE216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 5FB684A1216C1504003EE6C4 /* Nem2SdkSwiftDemo */ = { + isa = PBXGroup; + children = ( + 5FB684A2216C1504003EE6C4 /* AppDelegate.swift */, + 5FB684A4216C1504003EE6C4 /* ViewController.swift */, + 5FB684A6216C1504003EE6C4 /* Main.storyboard */, + 5FB684A9216C1505003EE6C4 /* Assets.xcassets */, + 5FB684AB216C1505003EE6C4 /* LaunchScreen.storyboard */, + 5FB684AE216C1505003EE6C4 /* Info.plist */, + ); + path = Nem2SdkSwiftDemo; + sourceTree = ""; + }; + 5FB684B6216C1506003EE6C4 /* Nem2SdkSwiftDemoTests */ = { + isa = PBXGroup; + children = ( + 5FB684B7216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.swift */, + 5FB684B9216C1506003EE6C4 /* Info.plist */, + ); + path = Nem2SdkSwiftDemoTests; + sourceTree = ""; + }; + 5FB684C1216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests */ = { + isa = PBXGroup; + children = ( + 5FB684C2216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.swift */, + 5FB684C4216C1506003EE6C4 /* Info.plist */, + ); + path = Nem2SdkSwiftDemoUITests; + sourceTree = ""; + }; + 5FB684D1216C1534003EE6C4 /* Products */ = { + isa = PBXGroup; + children = ( + 5FB684D6216C1534003EE6C4 /* Nem2SdkSwift.framework */, + 5FB684D8216C1534003EE6C4 /* Nem2SdkSwiftTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5FB6849E216C1504003EE6C4 /* Nem2SdkSwiftDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5FB684C7216C1506003EE6C4 /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftDemo" */; + buildPhases = ( + 5FB6849B216C1504003EE6C4 /* Sources */, + 5FB6849C216C1504003EE6C4 /* Frameworks */, + 5FB6849D216C1504003EE6C4 /* Resources */, + 5FB684DD216C153C003EE6C4 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 5FB684DC216C153C003EE6C4 /* PBXTargetDependency */, + ); + name = Nem2SdkSwiftDemo; + productName = Nem2SdkSwiftDemo; + productReference = 5FB6849F216C1504003EE6C4 /* Nem2SdkSwiftDemo.app */; + productType = "com.apple.product-type.application"; + }; + 5FB684B2216C1506003EE6C4 /* Nem2SdkSwiftDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5FB684CA216C1506003EE6C4 /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftDemoTests" */; + buildPhases = ( + 5FB684AF216C1506003EE6C4 /* Sources */, + 5FB684B0216C1506003EE6C4 /* Frameworks */, + 5FB684B1216C1506003EE6C4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 5FB684B5216C1506003EE6C4 /* PBXTargetDependency */, + ); + name = Nem2SdkSwiftDemoTests; + productName = Nem2SdkSwiftDemoTests; + productReference = 5FB684B3216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 5FB684BD216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5FB684CD216C1506003EE6C4 /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftDemoUITests" */; + buildPhases = ( + 5FB684BA216C1506003EE6C4 /* Sources */, + 5FB684BB216C1506003EE6C4 /* Frameworks */, + 5FB684BC216C1506003EE6C4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 5FB684C0216C1506003EE6C4 /* PBXTargetDependency */, + ); + name = Nem2SdkSwiftDemoUITests; + productName = Nem2SdkSwiftDemoUITests; + productReference = 5FB684BE216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5FB68497216C1504003EE6C4 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1000; + LastUpgradeCheck = 1000; + ORGANIZATIONNAME = "ProximaX Limited"; + TargetAttributes = { + 5FB6849E216C1504003EE6C4 = { + CreatedOnToolsVersion = 10.0; + }; + 5FB684B2216C1506003EE6C4 = { + CreatedOnToolsVersion = 10.0; + TestTargetID = 5FB6849E216C1504003EE6C4; + }; + 5FB684BD216C1506003EE6C4 = { + CreatedOnToolsVersion = 10.0; + TestTargetID = 5FB6849E216C1504003EE6C4; + }; + }; + }; + buildConfigurationList = 5FB6849A216C1504003EE6C4 /* Build configuration list for PBXProject "Nem2SdkSwiftDemo" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 5FB68496216C1504003EE6C4; + productRefGroup = 5FB684A0216C1504003EE6C4 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 5FB684D1216C1534003EE6C4 /* Products */; + ProjectRef = 5FB684D0216C1534003EE6C4 /* Nem2SdkSwift.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 5FB6849E216C1504003EE6C4 /* Nem2SdkSwiftDemo */, + 5FB684B2216C1506003EE6C4 /* Nem2SdkSwiftDemoTests */, + 5FB684BD216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 5FB684D6216C1534003EE6C4 /* Nem2SdkSwift.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Nem2SdkSwift.framework; + remoteRef = 5FB684D5216C1534003EE6C4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5FB684D8216C1534003EE6C4 /* Nem2SdkSwiftTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = Nem2SdkSwiftTests.xctest; + remoteRef = 5FB684D7216C1534003EE6C4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 5FB6849D216C1504003EE6C4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5FB684AD216C1505003EE6C4 /* LaunchScreen.storyboard in Resources */, + 5FB684AA216C1505003EE6C4 /* Assets.xcassets in Resources */, + 5FB684A8216C1504003EE6C4 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5FB684B1216C1506003EE6C4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5FB684BC216C1506003EE6C4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 5FB6849B216C1504003EE6C4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5FB684A5216C1504003EE6C4 /* ViewController.swift in Sources */, + 5FB684A3216C1504003EE6C4 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5FB684AF216C1506003EE6C4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5FB684B8216C1506003EE6C4 /* Nem2SdkSwiftDemoTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5FB684BA216C1506003EE6C4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5FB684C3216C1506003EE6C4 /* Nem2SdkSwiftDemoUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 5FB684B5216C1506003EE6C4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5FB6849E216C1504003EE6C4 /* Nem2SdkSwiftDemo */; + targetProxy = 5FB684B4216C1506003EE6C4 /* PBXContainerItemProxy */; + }; + 5FB684C0216C1506003EE6C4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5FB6849E216C1504003EE6C4 /* Nem2SdkSwiftDemo */; + targetProxy = 5FB684BF216C1506003EE6C4 /* PBXContainerItemProxy */; + }; + 5FB684DC216C153C003EE6C4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Nem2SdkSwift; + targetProxy = 5FB684DB216C153C003EE6C4 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 5FB684A6216C1504003EE6C4 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 5FB684A7216C1504003EE6C4 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 5FB684AB216C1505003EE6C4 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 5FB684AC216C1505003EE6C4 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 5FB684C5216C1506003EE6C4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/iOS"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 5FB684C6216C1506003EE6C4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/iOS"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 5FB684C8216C1506003EE6C4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + INFOPLIST_FILE = Nem2SdkSwiftDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 5FB684C9216C1506003EE6C4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + INFOPLIST_FILE = Nem2SdkSwiftDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 5FB684CB216C1506003EE6C4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + INFOPLIST_FILE = Nem2SdkSwiftDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nem2SdkSwiftDemo.app/Nem2SdkSwiftDemo"; + }; + name = Debug; + }; + 5FB684CC216C1506003EE6C4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + INFOPLIST_FILE = Nem2SdkSwiftDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nem2SdkSwiftDemo.app/Nem2SdkSwiftDemo"; + }; + name = Release; + }; + 5FB684CE216C1506003EE6C4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + INFOPLIST_FILE = Nem2SdkSwiftDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Nem2SdkSwiftDemo; + }; + name = Debug; + }; + 5FB684CF216C1506003EE6C4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQ3LYTWKVQ; + INFOPLIST_FILE = Nem2SdkSwiftDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.proximax.Nem2SdkSwiftDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Nem2SdkSwiftDemo; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5FB6849A216C1504003EE6C4 /* Build configuration list for PBXProject "Nem2SdkSwiftDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5FB684C5216C1506003EE6C4 /* Debug */, + 5FB684C6216C1506003EE6C4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5FB684C7216C1506003EE6C4 /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5FB684C8216C1506003EE6C4 /* Debug */, + 5FB684C9216C1506003EE6C4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5FB684CA216C1506003EE6C4 /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftDemoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5FB684CB216C1506003EE6C4 /* Debug */, + 5FB684CC216C1506003EE6C4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5FB684CD216C1506003EE6C4 /* Build configuration list for PBXNativeTarget "Nem2SdkSwiftDemoUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5FB684CE216C1506003EE6C4 /* Debug */, + 5FB684CF216C1506003EE6C4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5FB68497216C1504003EE6C4 /* Project object */; +} diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a7688fd --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/AppDelegate.swift b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/AppDelegate.swift new file mode 100644 index 0000000..97b3d60 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/AppDelegate.swift @@ -0,0 +1,42 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Assets.xcassets/Contents.json b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Base.lproj/LaunchScreen.storyboard b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..bfa3612 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Base.lproj/Main.storyboard b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Base.lproj/Main.storyboard new file mode 100644 index 0000000..c2ce2fb --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Base.lproj/Main.storyboard @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Info.plist b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/ViewController.swift b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/ViewController.swift new file mode 100644 index 0000000..7f2ae4f --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemo/ViewController.swift @@ -0,0 +1,174 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import UIKit +import Nem2SdkSwift +import RxSwift + +class ViewController: UIViewController { + @IBOutlet weak var textAddress: UILabel! + @IBOutlet weak var textMessage: UITextView! + + var account: Account! + + static let url = URL(string: "http://192.168.10.9:3000")! + + let accountHttp = AccountHttp(url: ViewController.url) + let transactionHttp = TransactionHttp(url: ViewController.url) + let listener = Listener(url: ViewController.url) + let disposeBag = DisposeBag() + + //let privateKey: String? = nil + let privateKey: String? = "7DC9CB2015E7E180E86F6037E79EEF98F347056ADF89324A97858D7628433652" + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + account = setupAccount()! + + listener.open() + .subscribeOn(ConcurrentMainScheduler.instance) + .observeOn(MainScheduler.instance) + .subscribe(onCompleted: { + self.listener.confirmed(address: self.account.address) + .subscribeOn(ConcurrentMainScheduler.instance) + .observeOn(MainScheduler.instance) + .subscribe(onNext: { transaction in + self.showMessage("transaction \(transaction.transactionInfo!.hash!.hexString) confirmed") + }).disposed(by: self.disposeBag) + }).disposed(by: disposeBag) + textAddress.text = account.address.pretty + } + + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + @IBAction func onTouchedAccountInfo(_ sender: Any) { + fetchAccountInfo() + } + + @IBAction func onTouchedSendXem(_ sender: Any) { + let alert = UIAlertController(title: "Send XEM", message: "Input Address and Micro NEM", preferredStyle: .alert) + + alert.addTextField { (textField) in + textField.keyboardType = .asciiCapable + textField.placeholder = "Receiver Address" + } + alert.addTextField { (textField) in + textField.keyboardType = .numberPad + textField.placeholder = "Micro NEM" + } + let okAction = UIAlertAction(title: "OK", style: .default) { [weak self](action:UIAlertAction!) -> Void in + guard let weakSelf = self else { + return + } + let addressField = alert.textFields![0] as UITextField + let microXemField = alert.textFields![1] as UITextField + guard let address = addressField.text, + let microXemText = microXemField.text, + let microXem = Int(microXemText) else { + print("Failed to analyze input") + return + } + weakSelf.textMessage.text = "" + do { + try weakSelf.sendXem(address, UInt64(microXem)) + } + catch let error { + print(error.localizedDescription) + } + } + + let cancelAction = UIAlertAction(title: "Cancel", style: .default) { (action:UIAlertAction!) -> Void in } + + alert.addAction(cancelAction) + alert.addAction(okAction) + + present(alert, animated: true, completion: nil) + } + + private func setupAccount() -> Account? { + if let privateKey = self.privateKey { + return try? Account(privateKeyHexString: privateKey, networkType: .mijinTest) + } else { + return Account(networkType: .mijinTest) + } + } + + private func clearMessage() { + textMessage.text = "" + } + + private func showMessage(_ message: String) { + textMessage.text.append(message + "\n") + } + + private func fetchAccountInfo() { + clearMessage() + + accountHttp.getAccountInfo(address: account.address) + .subscribeOn(ConcurrentMainScheduler.instance) + .observeOn(MainScheduler.instance) + .subscribe( + onSuccess: { (result: AccountInfo) in + if let xem = result.mosaics.first(where: { mosaic in mosaic.id == XEM.mosaicId }) { + self.showMessage("balance: \(xem.amount) micro xem") + } + }, + onError: { error in + self.showMessage(error.localizedDescription) + } + ).disposed(by: disposeBag) + } + + + private func sendXem(_ recipientAddress: String, _ microXem: UInt64) throws { + clearMessage() + // Create transfer transaction + let transaction = TransferTransaction.create( + recipient: try Address(address: recipientAddress, networkType: .mijinTest), + mosaics: [XEM.of(microXemAmount: microXem)], + message: PlainMessage.empty, + networkType: .mijinTest) + + // Sign the transaction + let signedTransaction = account.sign(transaction: transaction) + + // Send + transactionHttp.announce(signedTransaction: signedTransaction) + .subscribeOn(ConcurrentMainScheduler.instance) + .observeOn(MainScheduler.instance) + .subscribe( + onSuccess: { (result: TransactionAnnounceResponse) in + self.showMessage(result.message) + self.showTransactionStatus(signedTransaction.hash) + }, + onError: { error in + self.showMessage(error.localizedDescription) + } + ).disposed(by: disposeBag) + } + + private func showTransactionStatus(_ hash: [UInt8]) { + // get transaction status and print + transactionHttp.getTransactionStatus(hash: hash) + .subscribeOn(ConcurrentMainScheduler.instance) + .observeOn(MainScheduler.instance) + .subscribe( + onSuccess: { (status: TransactionStatus) in + self.showMessage(status.status) + }, + onError: { error in + // retry + self.showTransactionStatus(hash) + } + ).disposed(by: disposeBag) + + } +} + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoTests/Info.plist b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoTests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoTests/Nem2SdkSwiftDemoTests.swift b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoTests/Nem2SdkSwiftDemoTests.swift new file mode 100644 index 0000000..61d8f0b --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoTests/Nem2SdkSwiftDemoTests.swift @@ -0,0 +1,30 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwiftDemo + +class Nem2SdkSwiftDemoTests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoUITests/Info.plist b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoUITests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoUITests/Nem2SdkSwiftDemoUITests.swift b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoUITests/Nem2SdkSwiftDemoUITests.swift new file mode 100644 index 0000000..bf8f751 --- /dev/null +++ b/Nem2SdkSwiftDemo/Nem2SdkSwiftDemoUITests/Nem2SdkSwiftDemoUITests.swift @@ -0,0 +1,30 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest + +class Nem2SdkSwiftDemoUITests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. + XCUIApplication().launch() + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + +} diff --git a/Nem2SdkSwiftTests/Info.plist b/Nem2SdkSwiftTests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/Nem2SdkSwiftTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Nem2SdkSwiftTests/Nem2SdkSwiftTests.swift b/Nem2SdkSwiftTests/Nem2SdkSwiftTests.swift new file mode 100644 index 0000000..b45c561 --- /dev/null +++ b/Nem2SdkSwiftTests/Nem2SdkSwiftTests.swift @@ -0,0 +1,39 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +extension Encodable { + func toString() -> String{ + let encoder = JSONEncoder() + let data = try! encoder.encode(self) + + return String(data: data, encoding: .utf8)! + } +} + +class Nem2SwiftTests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Nem2SdkSwiftTests/ParameterizedTest.swift b/Nem2SdkSwiftTests/ParameterizedTest.swift new file mode 100644 index 0000000..ef6aa70 --- /dev/null +++ b/Nem2SdkSwiftTests/ParameterizedTest.swift @@ -0,0 +1,64 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Parameterized Test Template +class ParameterizedTest: XCTestCase { + class func createTestCases() -> [ParameterizedTest] { + fatalError(""" +You must override createTestCases() in following way. + + override class func createTestCases() -> [ParameterizedTest] { + return self.testInvocations.map { YourParameterizedTestSubClass(invocation: $0) } + } +""" + ) + } + class var fixtures: [Any] { + get { + fatalError(""" +You must override fixtures. +e.g.: + override class var fixtures: [Any] { + get { + return [ + YourTestFixture(3, 9), + YourTestFixture(4, 16), + ] + } + } +""" + ) + } + } + + // Backing field of current fixture + private var _fixture: Any? = nil + + // Current fixture. Fixture must not be nil. + final private(set) var fixture : Any { + get { + return _fixture! + } + set { + _fixture = newValue + } + } + + override class var defaultTestSuite: XCTestSuite { + let testSuite = XCTestSuite(name: NSStringFromClass(self)) + guard self != ParameterizedTest.self else { + return testSuite + } + for fixture in self.fixtures { + let testCases = self.createTestCases() + for testCase in testCases { + testCase.fixture = fixture + testSuite.addTest(testCase) + } + } + return testSuite + } + +} + diff --git a/Nem2SdkSwiftTests/TestSettings.swift b/Nem2SdkSwiftTests/TestSettings.swift new file mode 100644 index 0000000..c58c3a3 --- /dev/null +++ b/Nem2SdkSwiftTests/TestSettings.swift @@ -0,0 +1,44 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import Nem2SdkSwift + +class TestSettings { + // NIS2 host address + //static let host = "http://localhost:3000" + static let url = URL(string: "http://192.168.10.9:3000")! + static let nemesisSigner = "SC2O7KMJVJBWU6MLVPBNNIVJ7YDLKVGGZ6ZZVALL" + + static let testAddress = "SBOKJ2CSEI5BNEZPCBUIJXB5BT6MQ3DPYGBGW5EO" + static let testPublicKey = "D13A7C3EEA5A3479CBCF029C39728AB33A569AF6CAAD06E16C9871B4C5685CB3" + + + + // signerA is cosigner of signerB + static let signerAAddress = "SD7LAI-7F4M4J-JNZLOJ-LWKJX5-A7RVIA-SS5F2L-VXOU" + // signerB is cosigner of signerC + static let signerBAddress = "SBAVUG-5LAPBP-SPWSC6-DSY56N-PGURUY-QNJVZC-VWBJ" + // signerC is cosigner of multisigD + static let signerCAddress = "SCRGUD-XW3I6G-ENE335-G6VYE5-EO3RRJ-Q2PNZV-J7YI" + // signerD is cosigner for nobody. + static let signerDAddress = "SAV3CA-WZXSND-JWAE4C-BXLIPH-ZKPVAS-YBO4P7-QC74" + + // existing transaction hash + static let transactionHash = "42F5AA8E5876CF746D78E209241F25C6C70F8595B808FC2F13DFA52C4BE6B673".toBytesFromHexString()! + + + static let accountPrivateKey = "7DC9CB2015E7E180E86F6037E79EEF98F347056ADF89324A97858D7628433652" + + // multisig account + static let multisigAddress = "SCVP43UXKXMPMWINL52RQIFG55YPEIPLXEXHR5FB" + static let multisigPublicKey = "B5C9CDEA5A4858EAE6452B454308691028E017C0272228A5A1A4A9876BB29FFA" + static let multisigPrivateKey = "AE8E76C7F1C75555E6FEC6F85494E98894DED157F0E75907B07F0A87A4B4821C" + + // need 10 xem over to use + static let cosignatory1PrivateKey = "424373EEF79A50907BC6D45C419A2500FC78E311FC1E0741AB135BF7FD38EF84" + + static let cosignatory2PrivateKey = "EE315AA74661FC13F1AF61319437A8F38C6994757E07830CAD708E361CDB26DF" + +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/TestUtils.swift b/Nem2SdkSwiftTests/TestUtils.swift new file mode 100644 index 0000000..ff29e8d --- /dev/null +++ b/Nem2SdkSwiftTests/TestUtils.swift @@ -0,0 +1,156 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import Security +import XCTest +import Nem2SdkSwift + +class TestUtils { + static let nemId: UInt64 = 0x84B3552D375FFA4B + static let xemId: UInt64 = 0xD525AD41D95FCF29 + static let subNamespaceId: UInt64 = 0xF0E71AA92827CF29 + + /** + * Generates a random public key. + * + * @return A random public key. + */ + //static func generateRandomPublicKey() -> PublicKey + + static func generateRandomId() -> UInt64 { + let randomBytes = generateRandomBytes(8) + var id: UInt64 = 0 + for i in 0..<8 { + id = id << 8 + UInt64(randomBytes[i]) + } + return id + } + + /** + * Generates a random signature. + * + * @return A random signature. + */ + //static func Signature generateRandomSignature() { + // final byte[] bytes = Utils.generateRandomBytes(64); + // return new Signature(bytes); + //} + + /** + * Generates a byte array containing random data. + * + * @param numBytes The number of bytes to generate. + * @return A byte array containing random data. + */ + static func generateRandomBytes(_ count: Int = 214) -> [UInt8] { + var randomBytes = [UInt8](repeating: 0, count: count) + let _ = SecRandomCopyBytes(kSecRandomDefault, count, &randomBytes) + return randomBytes + } + + + /** + * Increments a single character in the specified string. + * + * @param s The string + * @param index The index of the character to increment + * @return The resulting string + */ + static func increment(_ s: String, at index: Int) -> String { + + var characters: [Character] = Array(s) + + let scalars = characters[index].unicodeScalars + characters[index] = Character(UnicodeScalar(scalars.first!.value + 1)!) + + return String(characters) + } + + /** + * Changes a single character in the specified base 32 string. + * + * @param s A base 32 string + * @param index The index of the character to change + * @return The resulting base 32 string + */ + static func modifyBase32(_ s: String, at index: Int) -> String{ + var characters: [Character] = Array(s) + + let scalars = characters[index].unicodeScalars + var newChar = Character(UnicodeScalar(scalars.first!.value + 1)!) + + switch String(newChar) { + case "Z", "7": newChar = "A" + default: break + } + + characters[index] = newChar + return String(characters) + } + + /** + * Increments a single byte in the specified byte array. + * + * @param bytes The byte array + * @param index The index of the byte to increment + * @return The resulting byte array + */ + static func increment(_ bytes: [UInt8], at index: Int) -> [UInt8] { + var rt = bytes + rt[index] += 1 + return rt + } + + /** + * Creates a string initialized with a single character. + * + * @param ch The character used in the string. + * @param numChars The number of characters in hte string. + * @return A string of length numChars initialized to ch. + */ + static func createString(repeating char: String, count: Int) -> String { + return String([Character](repeating: char.first!, count: count)) + } + + + static func expectIllegalArgument(message: String? = nil, _ body: () throws -> Void) { + XCTAssertThrowsError(try body()) { error in + if case Nem2SdkSwiftError.illegalArgument(let resultMessage) = error { + if message != nil { + XCTAssertEqual(message, resultMessage) + } + } + else { + XCTFail("Unexpected Error") + } + } + } + static func expectNetworkError(_ body: () throws -> Void) { + XCTAssertThrowsError(try body()) { error in + if case Nem2SdkSwiftError.networkError = error { + } + else { + XCTFail("Unexpected Error") + } + } + } + + static func expectResponseError(code: Int? = nil, message: String? = nil, _ body: () throws -> Void) { + XCTAssertThrowsError(try body()) { error in + if case Nem2SdkSwiftError.responseError(let resultCode, let resultMessage) = error { + if code != nil { + XCTAssertEqual(code, resultCode) + } + if message != nil { + XCTAssertEqual(message, resultMessage) + } + } + else { + XCTFail("Unexpected Error") + } + } + } + +} diff --git a/Nem2SdkSwiftTests/core/crypto/HashesTest.swift b/Nem2SdkSwiftTests/core/crypto/HashesTest.swift new file mode 100644 index 0000000..94964f9 --- /dev/null +++ b/Nem2SdkSwiftTests/core/crypto/HashesTest.swift @@ -0,0 +1,145 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class HashesTest: XCTestCase { + + + private let SHA3_256_TESTER = HashTester(hashFunction: Hashes.sha3_256, expectedHashLength: 32) + private let SHA3_512_TESTER = HashTester(hashFunction: Hashes.sha3_512, expectedHashLength: 64) + private let RIPEMD160_TESTER = HashTester(hashFunction: Hashes.ripemd160, expectedHashLength: 20) + + + private class HashTester { + private let hashFunction: ([UInt8]) -> [UInt8] + private let expectedHashLength: Int + + init(hashFunction: @escaping ([UInt8]) -> [UInt8], expectedHashLength: Int) { + self.hashFunction = hashFunction + self.expectedHashLength = expectedHashLength + } + + func assertHashHasExpectedLength() { + // Arrange: + let input = TestUtils.generateRandomBytes() + + // Act: + let hash = self.hashFunction(input) + + // Assert: + XCTAssertEqual(hash.count, self.expectedHashLength) + } + + func assertHashIsSameForSameInputs() { + // Arrange: + let input = TestUtils.generateRandomBytes() + + // Act: + let hash1 = self.hashFunction(input) + let hash2 = self.hashFunction(input) + + // Assert: + XCTAssertEqual(hash2, hash1) + } + + + func assertHashIsDifferentForDifferentInputs() { + // Arrange: + let input1 = TestUtils.generateRandomBytes() + let input2 = TestUtils.generateRandomBytes() + + // Act: + let hash1 = self.hashFunction(input1) + let hash2 = self.hashFunction(input2) + + // Assert: + XCTAssertNotEqual(hash2, hash1) + } + } + + + static func assertHashesAreDifferent( + _ hashFunction1: ([UInt8]) -> [UInt8], + _ hashFunction2: ([UInt8]) -> [UInt8]) { + // Arrange: + let input = TestUtils.generateRandomBytes() + + // Act: + let hash1 = hashFunction1(input) + let hash2 = hashFunction2(input) + + // Assert: + XCTAssertNotEqual(hash2, hash1) + } + + + func testSha3_256HashHasExpectedByteLength() { + // Assert: + SHA3_256_TESTER.assertHashHasExpectedLength() + } + + + func testSha3_256GeneratesSameHashForSameInputs() { + // Assert: + SHA3_256_TESTER.assertHashIsSameForSameInputs() + } + + + func testSha3_256GeneratesDifferentHashForDifferentInputs() { + // Assert: + SHA3_256_TESTER.assertHashIsDifferentForDifferentInputs() + } + + func testSha3_512HashHasExpectedByteLength() { + // Assert: + SHA3_512_TESTER.assertHashHasExpectedLength() + } + + + func testSha3_512GeneratesSameHashForSameInputs() { + // Assert: + SHA3_512_TESTER.assertHashIsSameForSameInputs() + } + + + func testSha3_512GeneratesDifferentHashForDifferentInputs() { + // Assert: + SHA3_512_TESTER.assertHashIsDifferentForDifferentInputs() + } + + func testRipemd160HashHasExpectedByteLength() { + // Assert: + RIPEMD160_TESTER.assertHashHasExpectedLength() + } + + + func testRipemd160GeneratesSameHashForSameInputs() { + // Assert: + RIPEMD160_TESTER.assertHashIsSameForSameInputs() + } + + + func testRipemd160GeneratesDifferentHashForDifferentInputs() { + // Assert: + RIPEMD160_TESTER.assertHashIsDifferentForDifferentInputs() + } + + func testSha3_256AndRipemd160GenerateDifferentHashForSameInputs() { + // Assert: + HashesTest.assertHashesAreDifferent(Hashes.sha3_256, Hashes.ripemd160) + } + + func testSha3_256AndSha3_512GenerateDifferentHashForSameInputs() { + // Assert: + HashesTest.assertHashesAreDifferent(Hashes.sha3_256, Hashes.sha3_512) + } + + + func testSha3_512AndRipemd160GenerateDifferentHashForSameInputs() { + // Assert: + HashesTest.assertHashesAreDifferent(Hashes.sha3_512, Hashes.ripemd160) + } +} diff --git a/Nem2SdkSwiftTests/core/crypto/KeyPairTest.swift b/Nem2SdkSwiftTests/core/crypto/KeyPairTest.swift new file mode 100644 index 0000000..f5fddea --- /dev/null +++ b/Nem2SdkSwiftTests/core/crypto/KeyPairTest.swift @@ -0,0 +1,43 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class KeyPairTest: XCTestCase { + + func testCorCanCreateNewKeyPair() { + // Act: + let kp = KeyPair() + + // Assert: + XCTAssertTrue(kp.privateKey.bytes.count > 0) + XCTAssertTrue(kp.publicKey.bytes.count > 0) + } + + + func testCtorCanCreateKeyPairAroundPrivateKey() { + // Arrange: + let kp1 = KeyPair() + + // Act: + let kp2 = KeyPair(privateKey: kp1.privateKey) + + // Assert: + XCTAssertEqual(kp2.privateKey, kp1.privateKey) + XCTAssertEqual(kp2.publicKey, kp1.publicKey) + } + + + func testCtorCreatesDifferentInstancesWithDifferentKeys() { + // Act: + let kp1 = KeyPair() + let kp2 = KeyPair() + + // Assert: + XCTAssertNotEqual(kp2.privateKey, kp1.privateKey) + XCTAssertNotEqual(kp2.publicKey, kp1.publicKey) + } +} diff --git a/Nem2SdkSwiftTests/core/crypto/PrivateKeyTest.swift b/Nem2SdkSwiftTests/core/crypto/PrivateKeyTest.swift new file mode 100644 index 0000000..1c11a92 --- /dev/null +++ b/Nem2SdkSwiftTests/core/crypto/PrivateKeyTest.swift @@ -0,0 +1,89 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class PrivateKeyTest: XCTestCase { + func padBytes(_ count: Int) -> [UInt8] { + return [UInt8](repeating: 0, count: count) + } + + func padHex(_ count: Int) -> String { + return [String](repeating: "0", count: count).joined(separator: "") + } + + func testCanCreateFromBytes() { + // Arrange: + let key = try! PrivateKey(bytes: [0x02, 0xAB, 0x45, 0x90] + padBytes(28)) + + // Assert: + XCTAssertEqual(key.bytes, [0x02, 0xAB, 0x45, 0x90] + padBytes(28)) + } + + + func testCanCreateFromHexString() { + // Arrange: + let key = try! PrivateKey(hexString: "227F" + padHex(60)) + + // Assert: + XCTAssertEqual(key.bytes, [0x22, 0x7f] + padBytes(30)) + } + + + func testCanCreateFromOddLengthHexString() { + // Arrange: + let key = try! PrivateKey(hexString: "ABC" + padHex(60)) + + // Assert: + XCTAssertEqual(key.bytes, [0x0A, 0xBC] + padBytes(30)) + } + + func testCanCreateFromNegativeHexString() { + // Arrange: + let key = try! PrivateKey(hexString: "8000" + padHex(60)) + + // Assert: + XCTAssertEqual(key.bytes, [0x80, 0x00] + padBytes(30)) + } + + + func testCannotCreateAroundMalformedHexString() { + // Act: + XCTAssertThrowsError(try PrivateKey(hexString: "022G75" + padHex(58))) { error in + if case Nem2SdkSwiftError.illegalArgument(_) = error { + } else { + XCTFail("Unexpected Error.") + } + } + } + + func testCannotCreateAroundInvalidHexLength() { + // Act: + XCTAssertThrowsError(try PrivateKey(hexString: "01234567")) { error in + if case Nem2SdkSwiftError.illegalArgument(_) = error { + } else { + XCTFail("Unexpected Error.") + } + } + } + + + func testEqualsOnlyReturnsTrueForEquivalentObjects() { + // Arrange: + let key = try! PrivateKey(bytes: [0x02, 0xAB, 0x45, 0x90] + padBytes(28)) + + // Assert: + XCTAssertEqual(try! PrivateKey(bytes: [0x02, 0xAB, 0x45, 0x90] + padBytes(28)), key) + XCTAssertEqual(try! PrivateKey(hexString: "02AB4590" + padHex(56)), key) + XCTAssertNotEqual(try! PrivateKey(hexString: "02AB4591" + padHex(56)), key) + XCTAssertNotEqual(try! PrivateKey(bytes: [0x02, 0xAB, 0x45, 0x91] + padBytes(28)), key) + } + + func testDescriptionReturnsHexRepresentation() { + // Assert: + XCTAssertEqual((try! PrivateKey(hexString: "2275" + padHex(60))).description, "2275" + padHex(60)) + XCTAssertNotEqual((try! PrivateKey(hexString: "2275" + padHex(60))).description, "08e3" + padHex(60)) + } +} diff --git a/Nem2SdkSwiftTests/core/crypto/PublicKeyTest.swift b/Nem2SdkSwiftTests/core/crypto/PublicKeyTest.swift new file mode 100644 index 0000000..8641918 --- /dev/null +++ b/Nem2SdkSwiftTests/core/crypto/PublicKeyTest.swift @@ -0,0 +1,89 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class PublicKeyTest: XCTestCase { + func padBytes(_ count: Int) -> [UInt8] { + return [UInt8](repeating: 0, count: count) + } + + func padHex(_ count: Int) -> String { + return [String](repeating: "0", count: count).joined(separator: "") + } + + func testCanCreateFromBytes() { + // Arrange: + let key = try! PublicKey(bytes: [0x02, 0xAB, 0x45, 0x90] + padBytes(28)) + + // Assert: + XCTAssertEqual(key.bytes, [0x02, 0xAB, 0x45, 0x90] + padBytes(28)) + } + + + func testCanCreateFromHexString() { + // Arrange: + let key = try! PublicKey(hexString: "227F" + padHex(60)) + + // Assert: + XCTAssertEqual(key.bytes, [0x22, 0x7f] + padBytes(30)) + } + + + func testCanCreateFromOddLengthHexString() { + // Arrange: + let key = try! PublicKey(hexString: "ABC" + padHex(60)) + + // Assert: + XCTAssertEqual(key.bytes, [0x0A, 0xBC] + padBytes(30)) + } + + func testCanCreateFromNegativeHexString() { + // Arrange: + let key = try! PublicKey(hexString: "8000" + padHex(60)) + + // Assert: + XCTAssertEqual(key.bytes, [0x80, 0x00] + padBytes(30)) + } + + + func testCannotCreateAroundMalformedHexString() { + // Act: + XCTAssertThrowsError(try PublicKey(hexString: "022G75" + padHex(58))) { error in + if case Nem2SdkSwiftError.illegalArgument(_) = error { + } else { + XCTFail("Unexpected Error.") + } + } + } + + func testCannotCreateAroundInvalidHexLength() { + // Act: + XCTAssertThrowsError(try PublicKey(hexString: "01234567")) { error in + if case Nem2SdkSwiftError.illegalArgument(_) = error { + } else { + XCTFail("Unexpected Error.") + } + } + } + + + func testEqualsOnlyReturnsTrueForEquivalentObjects() { + // Arrange: + let key = try! PublicKey(bytes: [0x02, 0xAB, 0x45, 0x90] + padBytes(28)) + + // Assert: + XCTAssertEqual(try! PublicKey(bytes: [0x02, 0xAB, 0x45, 0x90] + padBytes(28)), key) + XCTAssertEqual(try! PublicKey(hexString: "02AB4590" + padHex(56)), key) + XCTAssertNotEqual(try! PublicKey(hexString: "02AB4591" + padHex(56)), key) + XCTAssertNotEqual(try! PublicKey(bytes: [0x02, 0xAB, 0x45, 0x91] + padBytes(28)), key) + } + + func testDescriptionReturnsHexRepresentation() { + // Assert: + XCTAssertEqual((try! PublicKey(hexString: "2275" + padHex(60))).description, "2275" + padHex(60)) + XCTAssertNotEqual((try! PublicKey(hexString: "2275" + padHex(60))).description, "08e3" + padHex(60)) + } +} diff --git a/Nem2SdkSwiftTests/core/crypto/SignerTest.swift b/Nem2SdkSwiftTests/core/crypto/SignerTest.swift new file mode 100644 index 0000000..0144f20 --- /dev/null +++ b/Nem2SdkSwiftTests/core/crypto/SignerTest.swift @@ -0,0 +1,22 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class SignerTest: XCTestCase { + + func testSign() { + let message = "039054410000000000000000010000000000000090E8FEBD671DD41BEE94EC3BA5831CB608A312C2F203BA84AC01000100672B0000CE5600006400000000000000".toBytesFromHexString()! + let expectedSignature = "773891AD01DD4CDF6E3A55C186C673E256D7DF9D471846F1943CC3529E4E02B38B9AF3F8D13784645FF5FAAFA94A321B94933C673D12DE60E4BC05ABA56F750E" + + let keyPair = KeyPair(privateKey: try! PrivateKey(hexString: "787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d")) + + let signer = Signer(keyPair: keyPair) + + let signature = signer.sign(message: message) + + XCTAssertEqual(expectedSignature, signature.hexString.uppercased()) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/core/utils/Base32EncoderTest.swift b/Nem2SdkSwiftTests/core/utils/Base32EncoderTest.swift new file mode 100644 index 0000000..4656080 --- /dev/null +++ b/Nem2SdkSwiftTests/core/utils/Base32EncoderTest.swift @@ -0,0 +1,40 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class Base32EncoderTest: XCTestCase { + private let ENCODED_SIGMA_BYTES: [UInt8] = [0x53, 0x69, 0x67, 0x6D, 0x61] + + private let ENCODED_CURRENCY_SYMBOLS_BYTES: [UInt8] = [0x24, 0xC2, 0xA2, 0xE2, 0x82, 0xAC] + + + func testStringCanBeConvertedToByteArray() { + XCTAssertEqual(try! Base32Encoder.bytes(from: "KNUWO3LB"), ENCODED_SIGMA_BYTES) + XCTAssertEqual(try! Base32Encoder.bytes(from: "ETBKFYUCVQ======"), ENCODED_CURRENCY_SYMBOLS_BYTES) + } + + + func testByteArrayCanBeConvertedToString() { + XCTAssertEqual(Base32Encoder.base32String(from: ENCODED_SIGMA_BYTES), "KNUWO3LB") + XCTAssertEqual(Base32Encoder.base32String(from: ENCODED_CURRENCY_SYMBOLS_BYTES), "ETBKFYUCVQ======") + } + + + func testMalformedStringCannotBeDecoded() { + XCTAssertThrowsError(try Base32Encoder.bytes(from: "BAD STRING)(*&^%$#@!")) { error in + if case Nem2SdkSwiftError.illegalArgument(_) = error { + } else { + XCTFail("Unexpected Error.") + } + } + + } + + func testStringCanContainPaddingAndWhitespace() { + XCTAssertEqual(try! Base32Encoder.bytes(from: " ETBKFYUCVQ====== "), ENCODED_CURRENCY_SYMBOLS_BYTES) + } + +} diff --git a/Nem2SdkSwiftTests/core/utils/HexEncoderTest.swift b/Nem2SdkSwiftTests/core/utils/HexEncoderTest.swift new file mode 100644 index 0000000..61ce25f --- /dev/null +++ b/Nem2SdkSwiftTests/core/utils/HexEncoderTest.swift @@ -0,0 +1,63 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class HexEncoderTest: XCTestCase { + + private static func assertGetBytesConversion(_ input: String, _ expectedOutput: [UInt8]) { + // Act: + let output = input.toBytesFromHexString()! + + // Assert: + XCTAssertEqual(output, expectedOutput) + } + + + private static func assertGetStringConversion(_ input: [UInt8], _ expectedOutput: String) { + // Act: + let output = input.hexString + + // Assert: + XCTAssertEqual(output, expectedOutput) + } + + func testGetBytesCanConvertValidStringToByteArray() { + // Assert: + HexEncoderTest.assertGetBytesConversion( + "4e454d465457", + [0x4e, 0x45, 0x4d, 0x46, 0x54, 0x57]) + } + + func testGetBytesCanConvertValidStringWithOddLengthToByteArray() { + // Assert: + HexEncoderTest.assertGetBytesConversion( + "e454d465457", + [0x0e, 0x45, 0x4d, 0x46, 0x54, 0x57]) + } + + func testGetBytesCanConvertValidStringWithLeadingZerosToByteArray() { + // Assert: + HexEncoderTest.assertGetBytesConversion( + "00000d465457", + [0x00, 0x00, 0x0d, 0x46, 0x54, 0x57]) + } + + + func testGetStringCanConvertBytesToHexString() { + // Assert: + HexEncoderTest.assertGetStringConversion( + [0x4e, 0x45, 0x4d, 0x46, 0x54, 0x57], + "4e454d465457") + } + + + func testGetStringCanConvertBytesWithLeadingZerosToHexString() { + // Assert: + HexEncoderTest.assertGetStringConversion( + [0x00, 0x00, 0x0d, 0x46, 0x54, 0x57], + "00000d465457") + } +} diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/AccountHttpTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/AccountHttpTest.swift new file mode 100644 index 0000000..8d81fd7 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/AccountHttpTest.swift @@ -0,0 +1,136 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import RxBlocking +import XCTest +//@testable import Nem2SdkSwift +import Nem2SdkSwift + +class AccountHttpTest: XCTestCase { + var accountHttp: AccountHttp! + let publicAccount = try! PublicAccount(publicKeyHexString: TestSettings.testPublicKey, networkType: .mijinTest) + + override func setUp() { + super.setUp() + accountHttp = AccountHttp(url: TestSettings.url) + } + + func testGetAccountInfo() { + let accountInfo: AccountInfo = try! accountHttp.getAccountInfo(address: try! Address(rawAddress: TestSettings.testAddress)).toBlocking().first()! + + XCTAssertEqual(TestSettings.testPublicKey, accountInfo.publicKey) + } + + + func testGetAccountsInfo() { + let accountInfos: [AccountInfo] = try! accountHttp.getAccountsInfo(addresses: [try! Address(rawAddress: TestSettings.testAddress)]).toBlocking().first()! + + + XCTAssertEqual(1, accountInfos.count) + XCTAssertEqual(TestSettings.testPublicKey, accountInfos[0].publicKey) + } + + func testGetMultisigAccountInfo() { + let multisigInfo: MultisigAccountInfo = try! accountHttp.getMultisigAccountInfo(address: try! Address(rawAddress: TestSettings.multisigAddress)).toBlocking().first()! + print(multisigInfo) + XCTAssertEqual(TestSettings.multisigPublicKey, multisigInfo.account.publicKey.description) + } + + + func testGetMultisigAccountGraphInfo() { + let signerDAddress = try! Address(rawAddress: TestSettings.signerDAddress) + let signerBAddress = try! Address(rawAddress: TestSettings.signerBAddress) + let signerCAddress = try! Address(rawAddress: TestSettings.signerCAddress) + let signerAAddress = try! Address(rawAddress: TestSettings.signerAAddress) + let signerDInfo: MultisigAccountGraphInfo = try! accountHttp.getMultisigAccountGraphInfo(address: signerDAddress).toBlocking().first()! + let signerCInfo: MultisigAccountGraphInfo = try! accountHttp.getMultisigAccountGraphInfo(address: signerCAddress).toBlocking().first()! + let signerBInfo: MultisigAccountGraphInfo = try! accountHttp.getMultisigAccountGraphInfo(address: signerBAddress).toBlocking().first()! + let signerAInfo: MultisigAccountGraphInfo = try! accountHttp.getMultisigAccountGraphInfo(address: signerAAddress).toBlocking().first()! + + + // signerA is cosigner of signerB + // A(0) -> B(-1) -> C(-2) -> D(-3) + XCTAssertEqual(Set([0, -1, -2, -3]) , signerAInfo.levelsNumber) + signerAInfo.multisigAccounts.forEach { key, value in XCTAssertEqual(1, value.count)} + XCTAssertEqual(signerAAddress.plain, signerAInfo.multisigAccounts[0]?[0].account.address.plain) + XCTAssertEqual(signerBAddress.plain, signerAInfo.multisigAccounts[-1]?[0].account.address.plain) + XCTAssertEqual(signerCAddress.plain, signerAInfo.multisigAccounts[-2]?[0].account.address.plain) + XCTAssertEqual(signerDAddress.plain, signerAInfo.multisigAccounts[-3]?[0].account.address.plain) + + // signerB is cosigner of signerC + // A(1) -> B(0) -> C(-1) -> D(-2) + XCTAssertEqual(Set([1, 0, -1, -2]) , signerBInfo.levelsNumber) + signerBInfo.multisigAccounts.forEach { key, value in XCTAssertEqual(1, value.count)} + XCTAssertEqual(signerAAddress.plain, signerBInfo.multisigAccounts[1]?[0].account.address.plain) + XCTAssertEqual(signerBAddress.plain, signerBInfo.multisigAccounts[0]?[0].account.address.plain) + XCTAssertEqual(signerCAddress.plain, signerBInfo.multisigAccounts[-1]?[0].account.address.plain) + XCTAssertEqual(signerDAddress.plain, signerBInfo.multisigAccounts[-2]?[0].account.address.plain) + + // signerC is cosigner of signerD + // A(2) -> B(1) -> C(0) -> D(-1) + XCTAssertEqual(Set([2, 1, 0, -1]) , signerCInfo.levelsNumber) + signerCInfo.multisigAccounts.forEach { key, value in XCTAssertEqual(1, value.count)} + XCTAssertEqual(signerAAddress.plain, signerCInfo.multisigAccounts[2]?[0].account.address.plain) + XCTAssertEqual(signerBAddress.plain, signerCInfo.multisigAccounts[1]?[0].account.address.plain) + XCTAssertEqual(signerCAddress.plain, signerCInfo.multisigAccounts[0]?[0].account.address.plain) + XCTAssertEqual(signerDAddress.plain, signerCInfo.multisigAccounts[-1]?[0].account.address.plain) + + // signerD is multisig address, and cosigner of nobody + // A(3) -> B(2) -> C(1) -> D(0) + XCTAssertEqual(Set([3, 2, 1, 0]) , signerDInfo.levelsNumber) + signerDInfo.multisigAccounts.forEach { key, value in XCTAssertEqual(1, value.count)} + XCTAssertEqual(signerAAddress.plain, signerDInfo.multisigAccounts[3]?[0].account.address.plain) + XCTAssertEqual(signerBAddress.plain, signerDInfo.multisigAccounts[2]?[0].account.address.plain) + XCTAssertEqual(signerCAddress.plain, signerDInfo.multisigAccounts[1]?[0].account.address.plain) + XCTAssertEqual(signerDAddress.plain, signerDInfo.multisigAccounts[0]?[0].account.address.plain) + } + + func testTransactions() { + let transactions = try! accountHttp.transactions(publicAccount: publicAccount).toBlocking().first()! + + XCTAssertEqual(10, transactions.count) + } + + func testTransactionsWithPagination() { + let transactions: [Transaction] = try! accountHttp.transactions(publicAccount: publicAccount).toBlocking().first()! + + XCTAssertEqual(10, transactions.count) + + let nextTransactions: [Transaction] = try! accountHttp.transactions(publicAccount: publicAccount, pageSize: 11, id: transactions[0].transactionInfo!.id!).toBlocking().first()! + + XCTAssertEqual(11, nextTransactions.count) + XCTAssertEqual(transactions[1].transactionInfo!.hash!, nextTransactions[0].transactionInfo!.hash!) + } + + + func testIncomingTransactions() { + let transactions = try! accountHttp.incomingTransactions(publicAccount: publicAccount).toBlocking().first()! + + XCTAssertEqual(10, transactions.count) + } + + func testOutgoingTransactions() { + let transactions = try! accountHttp.outgoingTransactions(publicAccount: publicAccount).toBlocking().first()! + + XCTAssertEqual(10, transactions.count) + } + + func testAggregateBondedTransactions() { + let transactions = try! accountHttp.aggregateBondedTransactions(publicAccount: publicAccount).toBlocking().first()! + XCTAssertEqual(0, transactions.count) + } + + func testUnconfirmedTransactions() { + let transactions = try! accountHttp.unconfirmedTransactions(publicAccount: publicAccount).toBlocking().first()! + XCTAssertEqual(0, transactions.count) + } + + func testThrowExceptionWhenBlockDoesNotExists() { + TestUtils.expectResponseError(code: 404) { + _ = try accountHttp.getAccountInfo(address: try Address(rawAddress: "SARDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY")).toBlocking().first() + } + } + +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/BlockchainHttpTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/BlockchainHttpTest.swift new file mode 100644 index 0000000..10bd7ac --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/BlockchainHttpTest.swift @@ -0,0 +1,63 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import XCTest +import RxBlocking +@testable import Nem2SdkSwift + +class BlockchainHttpTest: XCTestCase { + private var blockchainHttp: BlockchainHttp! + + override func setUp() { + super.setUp() + blockchainHttp = BlockchainHttp(url: TestSettings.url) + } + + + func testGetBlockByHeight() { + let blockInfo = try! blockchainHttp.getBlock(height: 1).toBlocking().first()! + + XCTAssertEqual(1, blockInfo.height) + XCTAssertEqual(0, blockInfo.timestamp) + } + + + func testGetBlockTransactions() { + let transactions: [Transaction] = try! blockchainHttp.getBlockTransactions(height: 1).toBlocking().first()! + + XCTAssertEqual(10, transactions.count) + + let nextTransactions: [Transaction] = try! blockchainHttp.getBlockTransactions(height: 1, pageSize: 15, id: transactions[0].transactionInfo!.id!).toBlocking().first()! + + XCTAssertEqual(15, nextTransactions.count) + XCTAssertEqual(transactions[1].transactionInfo?.hash!, nextTransactions[0].transactionInfo?.hash!) + } + + func testGetBlockchainHeight() { + let blockchainHeight = try! blockchainHttp.getBlockchainHeight().toBlocking().first()! + + XCTAssertGreaterThan(blockchainHeight, 0) + } + + func testGetBlockchainScore() { + let blockchainScore: BlockchainScore = try! blockchainHttp.getBlockchainScore().toBlocking().first()! + + XCTAssertTrue(blockchainScore.scoreLow != 0 || blockchainScore.scoreHigh != 0) + } + + func testGetBlockchainStorage() { + let blockchainStorage: BlockchainStorageInfo = try! blockchainHttp.getBlockchainStorage().toBlocking().first()! + + XCTAssertGreaterThan(blockchainStorage.numAccounts, 0) + XCTAssertGreaterThan(blockchainStorage.numTransactions, 0) + XCTAssertGreaterThan(blockchainStorage.numBlocks, 0) + } + + func testThrowExceptionWhenBlockDoesNotExists() { + TestUtils.expectResponseError(code: 404) { + _ = try blockchainHttp.getBlock(height: 10000000000).toBlocking().first() + } + } +} diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/E2ETest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/E2ETest.swift new file mode 100644 index 0000000..c3b1e9d --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/E2ETest.swift @@ -0,0 +1,516 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import XCTest +import RxSwift +import RxBlocking +import Nem2SdkSwift + +class E2ETest: XCTestCase { + private let transactionHttp = TransactionHttp(url: TestSettings.url) + private let accountHttp = AccountHttp(url: TestSettings.url) + private let account = try! Account(privateKeyHexString: TestSettings.accountPrivateKey, networkType: .mijinTest) + private let multisigAccount = try! Account(privateKeyHexString: TestSettings.multisigPrivateKey, networkType: .mijinTest) + private let cosignatoryAccount1 = try! Account(privateKeyHexString: TestSettings.cosignatory1PrivateKey, networkType: .mijinTest) + private let cosignatoryAccount2 = try! Account(privateKeyHexString: TestSettings.cosignatory2PrivateKey, networkType: .mijinTest) + + private let namespaceId = try! NamespaceId(fullName: "test-root-namespace") // This namespace is created in functional testing + private let namespaceName = "test-root-namespace" + private let mosaicId = try! MosaicId(fullName: "test-root-namespace:test-mosaic") // This mosaic is created in functional testing + private var listener: Listener! + + private var disposeBag: DisposeBag! + + override func setUp() { + super.setUp() + listener = Listener(url: TestSettings.url) + disposeBag = DisposeBag() + + listener.error().subscribe( + onNext: { error in + if case Nem2SdkSwiftError.parseError(let message) = error { + print(message) + } else { + print(error.localizedDescription) + } + } + ).disposed(by: disposeBag) + + _ = try! listener.open().toBlocking().first() + + watchTransactionError(account.address) + + } + + func testStandaloneTransferTransaction() { + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY"), + mosaics: [XEM.of(microXemAmount: 1)], + message: PlainMessage(text: "message"), + networkType: .mijinTest + ) + + let signedTransaction = account.sign(transaction: transferTransaction) + announceAndValidateTransaction(signedTransaction, account.address) + } + + func testAggregateTransferTransaction() { + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY"), + mosaics: [XEM.of(microXemAmount: 1)], + message: PlainMessage(text: "messageloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + + "oooooooong"), // Use long message to test if size of inner transaction is calculated correctly + networkType: .mijinTest) + + + let aggregateTransaction = try! AggregateTransaction.createComplete( + innerTransactions: [transferTransaction.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + func testStandaloneRootRegisterNamespaceTransaction() { + let namespaceName = "test-root-namespace-\(arc4random())" + + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createRootNamespace( + namespaceName: namespaceName, + duration: 100, + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: registerNamespaceTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + func testAggregateRootRegisterNamespaceTransaction() { + let namespaceName = "test-root-namespace-\(arc4random())" + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createRootNamespace( + namespaceName: namespaceName, + duration: 100, + networkType: .mijinTest) + + let aggregateTransaction = try! AggregateTransaction.createComplete( + innerTransactions: [registerNamespaceTransaction.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + func testStandaloneSubNamespaceRegisterNamespaceTransaction() { + let namespaceName = "test-sub-namespace-\(arc4random())" + + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createSubNamespace( + namespaceName: namespaceName, + parentId: namespaceId, + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: registerNamespaceTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + + func testAggregateSubNamespaceRegisterNamespaceTransaction() { + let namespaceName = "test-sub-namespace-\(arc4random())" + + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createSubNamespace( + namespaceName: namespaceName, + parentId: namespaceId, + networkType: .mijinTest) + + let aggregateTransaction = try! AggregateTransaction.createComplete( + innerTransactions: [registerNamespaceTransaction.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + + func testStandaloneMosaicDefinitionTransaction() { + let mosaicName = "test-mosaic-\(arc4random())" + + let mosaicDefinitionTransaction = try! MosaicDefinitionTransaction.create( + mosaicName: mosaicName, + namespaceFullName: namespaceName, + mosaicProperties: MosaicProperties( + isSupplyMutable: true, + isTransferable: true, + isLevyMutable: true, + divisibility: 4, + duration: 100), + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: mosaicDefinitionTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + func testAggregateMosaicDefinitionTransaction() { + let mosaicName = "test-mosaic-\(arc4random())" + + let mosaicDefinitionTransaction = try! MosaicDefinitionTransaction.create( + mosaicName: mosaicName, + namespaceFullName: namespaceName, + mosaicProperties: MosaicProperties( + isSupplyMutable: true, + isTransferable: true, + isLevyMutable: true, + divisibility: 4, + duration: 100), + networkType: .mijinTest) + + let aggregateTransaction = try! AggregateTransaction.createComplete( + innerTransactions: [mosaicDefinitionTransaction.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + + func testStandaloneMosaicSupplyChangeTransaction() { + let mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create( + mosaicId: mosaicId, + mosaicSupplyType: .increase, + delta: 10, + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: mosaicSupplyChangeTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + + func testAggregateMosaicSupplyChangeTransaction() { + let mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create( + mosaicId: mosaicId, + mosaicSupplyType: .increase, + delta: 10, + networkType: .mijinTest) + + let aggregateTransaction = try! AggregateTransaction.createComplete( + innerTransactions: [mosaicSupplyChangeTransaction.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + announceAndValidateTransaction(signedTransaction, account.address) + } + + func testShouldSignModifyMultisigAccountTransactionWithCosignatories() { + watchTransactionError(cosignatoryAccount1.address) + watchTransactionError(cosignatoryAccount2.address) + + let modifyMultisigAccountTransaction = ModifyMultisigAccountTransaction.create( + minApprovalDelta: 0, + minRemovalDelta: 0, + modifications: [MultisigCosignatoryModification( + type: .add, + cosignatory: Account(networkType: .mijinTest).publicAccount)], + networkType: .mijinTest) + + let aggregateTransaction = try! AggregateTransaction.createBonded( + innerTransactions: [modifyMultisigAccountTransaction.toAggregate(signer: multisigAccount.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = cosignatoryAccount1.sign(transaction: aggregateTransaction) + + let lockFundsTransaction = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest) + + let lockFundsSignedTransaction = cosignatoryAccount1.sign(transaction: lockFundsTransaction) + + announceAndValidateTransaction(lockFundsSignedTransaction, cosignatoryAccount1.address) + + let announcedAggregateTransaction = announceAndValidateAggregateBondedTransaction(signedTransaction, cosignatoryAccount1.address) + + // confirm to unlock funds + let cosignatureTransaction = try! CosignatureTransaction(transactionToCosign: announcedAggregateTransaction) + let cosignatureSignedTransaction = cosignatoryAccount2.sign(cosignatureTransaction: cosignatureTransaction) + _ = try! transactionHttp.announceAggregateBondedCosignature(cosignatureSignedTransaction: cosignatureSignedTransaction).toBlocking().first()! + + // waiting for confirmed for next test + _ = try! listener.confirmed(address: cosignatoryAccount2.address).toBlocking().first()! + + } + + func testCosignatureTransaction() { + let addresses = [multisigAccount.address, cosignatoryAccount1.address, cosignatoryAccount2.address] + addresses.forEach { + watchTransactionError($0) + watchBondedAdded($0) + watchConfirmed($0) + watchUnconfirmed($0) + } + + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY"), + mosaics: [XEM.of(microXemAmount: 1)], + message: PlainMessage(text: "message"), + networkType: .mijinTest + ) + + let aggregateTransaction = try! AggregateTransaction.createBonded( + innerTransactions: [transferTransaction.toAggregate(signer: multisigAccount.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = cosignatoryAccount1.sign(transaction: aggregateTransaction) + + let lockFundsTransaction = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest) + + let lockFundsSignedTransaction = cosignatoryAccount1.sign(transaction: lockFundsTransaction) + + announceAndValidateTransaction(lockFundsSignedTransaction, cosignatoryAccount1.address) + + let announcedAggregateTransaction = announceAndValidateAggregateBondedTransaction(signedTransaction, cosignatoryAccount1.address) + + let cosignatureTransaction = try! CosignatureTransaction(transactionToCosign: announcedAggregateTransaction) + let cosignatureSignedTransaction = cosignatoryAccount2.sign(cosignatureTransaction: cosignatureTransaction) + + announceAndValidateAggregateBondedCosignatureTransaction(cosignatureSignedTransaction, cosignatoryAccount1.address) + + // waiting for confirmed for next test + _ = try! listener.confirmed(address: cosignatoryAccount2.address).toBlocking().first()! + } + + + func testStandaloneLockFundsTransaction() { + let aggregateTransaction = try! AggregateTransaction.createBonded( + innerTransactions: [], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + let lockFundstx = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest) + + let lockFundsTransactionSigned = account.sign(transaction: lockFundstx) + + announceAndValidateTransaction(lockFundsTransactionSigned, account.address) + } + + func testAggregateLockFundsTransaction() { + let aggregateTransaction = try! AggregateTransaction.createBonded( + innerTransactions: [], + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: aggregateTransaction) + + let lockFundstx = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest) + + let lockFundsAggregatetx = try! AggregateTransaction.createComplete( + innerTransactions: [lockFundstx.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let lockFundsTransactionSigned = account.sign(transaction: lockFundsAggregatetx) + + announceAndValidateTransaction(lockFundsTransactionSigned, account.address) + } + + func testStandaloneSecretLockTransaction() { + var proof = [UInt8](repeating: 0, count: 20) + _ = SecRandomCopyBytes(kSecRandomDefault, 20, &proof) + + let secret = Hashes.sha3_512(proof) + + let secretLocktx = SecretLockTransaction.create( + mosaic: XEM.of(microXemAmount: 1), + duration: 1, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest) + + let secretLockTransactionSigned = account.sign(transaction: secretLocktx) + + announceAndValidateTransaction(secretLockTransactionSigned, account.address) + } + + func testAggregateSecretLockTransaction() { + var proof = [UInt8](repeating: 0, count: 20) + _ = SecRandomCopyBytes(kSecRandomDefault, 20, &proof) + + let secret = Hashes.sha3_512(proof) + + let secretLocktx = SecretLockTransaction.create( + mosaic: XEM.of(microXemAmount: 1), + duration: 1, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest) + + let secretLockAggregatetx = try! AggregateTransaction.createComplete( + innerTransactions: [secretLocktx.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let secretLockTransactionSigned = account.sign(transaction: secretLockAggregatetx) + + announceAndValidateTransaction(secretLockTransactionSigned, account.address) + } + + func testStandaloneSecretProofTransaction() { + var proof = [UInt8](repeating: 0, count: 20) + _ = SecRandomCopyBytes(kSecRandomDefault, 20, &proof) + + let secret = Hashes.sha3_512(proof) + + let secretLocktx = SecretLockTransaction.create( + mosaic: XEM.of(microXemAmount: 1), + duration: 10, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest) + + let lockFundsTransactionSigned = account.sign(transaction: secretLocktx) + + + announceAndValidateTransaction(lockFundsTransactionSigned, account.address) + + let secretProoftx = SecretProofTransaction.create( + hashType: .sha3_512, + secret: secret, + proof: proof, + networkType: .mijinTest) + + let secretProofTransactionSigned = account.sign(transaction: secretProoftx) + + announceAndValidateTransaction(secretProofTransactionSigned, account.address) + + } + + func testAggregateSecretProofTransaction() { + var proof = [UInt8](repeating: 0, count: 20) + _ = SecRandomCopyBytes(kSecRandomDefault, 20, &proof) + + let secret = Hashes.sha3_512(proof) + + let secretLocktx = SecretLockTransaction.create( + mosaic: XEM.of(microXemAmount: 1), + duration: 10, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest) + + let lockFundsTransactionSigned = account.sign(transaction: secretLocktx) + + + announceAndValidateTransaction(lockFundsTransactionSigned, account.address) + + let secretProoftx = SecretProofTransaction.create( + hashType: .sha3_512, + secret: secret, + proof: proof, + networkType: .mijinTest) + + let secretProofAggregatetx = try! AggregateTransaction.createComplete( + innerTransactions: [secretProoftx.toAggregate(signer: account.publicAccount)], + networkType: .mijinTest) + + let secretProofTransactionSigned = account.sign(transaction: secretProofAggregatetx) + + announceAndValidateTransaction(secretProofTransactionSigned, account.address) + } + + func announceAndValidateTransaction(_ signedTransaction: SignedTransaction, _ address: Address) { + let confirmedObservable = listener.confirmed(address: address) + + _ = try! transactionHttp.announce(signedTransaction: signedTransaction).toBlocking().first()! + + let transaction = try! confirmedObservable.toBlocking().first()! + + XCTAssertEqual(signedTransaction.hash, transaction.transactionInfo!.hash!) + } + + func announceAndValidateAggregateBondedTransaction(_ signedTransaction: SignedTransaction, _ address: Address) -> AggregateTransaction{ + let aggregateTransactionObservable = listener.aggregateBondedAdded(address: address) + + _ = try! transactionHttp.announceAggregateBonded(signedTransaction: signedTransaction).toBlocking().first()! + + let aggregateTransaction = try! aggregateTransactionObservable.toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, aggregateTransaction.transactionInfo!.hash!) + + return aggregateTransaction + } + + func announceAndValidateAggregateBondedCosignatureTransaction(_ cosignatureSignedTransaction: CosignatureSignedTransaction, _ address: Address) { + let cosignatureObservable = listener.cosignatureAdded(address: address) + + // wait monitoring + sleep(1) + + _ = try! transactionHttp.announceAggregateBondedCosignature(cosignatureSignedTransaction: cosignatureSignedTransaction).toBlocking().first()! + + let cosignature = try! cosignatureObservable.toBlocking().first()! + XCTAssertEqual(cosignature.parentHash, cosignatureSignedTransaction.parentHash) + + } + + + private func watchConfirmed(_ address: Address) { + listener.confirmed(address: address).subscribe( + onNext: { transaction in + print("Confirmed \(address.pretty) \(transaction.type)") + } + ).disposed(by: disposeBag) + } + + private func watchUnconfirmed(_ address: Address) { + listener.unconfirmedAdded(address: address).subscribe( + onNext: { transaction in + print("Unconfirmed \(address.pretty) \(transaction.type)") + } + ).disposed(by: disposeBag) + } + + + private func watchBondedAdded(_ address: Address) { + listener.aggregateBondedAdded(address: address).subscribe( + onNext: { transaction in + print("Bonded Added \(address.pretty) \(transaction.type)") + } + ).disposed(by: disposeBag) + } + + + private func watchTransactionError(_ address: Address) { + listener.status(address: address).subscribe( + onNext: { status in + print(status.status) + } + ).disposed(by: disposeBag) + } +} + + diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/ListenerTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/ListenerTest.swift new file mode 100644 index 0000000..2b99be6 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/ListenerTest.swift @@ -0,0 +1,237 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import XCTest +import RxSwift +import RxBlocking +@testable import Nem2SdkSwift + +class ListenerTest: XCTestCase { + private let transactionHttp = TransactionHttp(url: TestSettings.url) + private let accountHttp = AccountHttp(url: TestSettings.url) + private let account = try! Account(privateKeyHexString: TestSettings.accountPrivateKey, networkType: .mijinTest) + private let multisigAccount = try! Account(privateKeyHexString: TestSettings.multisigPrivateKey, networkType: .mijinTest) + private let cosignatoryAccount1 = try! Account(privateKeyHexString: TestSettings.cosignatory1PrivateKey, networkType: .mijinTest) + private let cosignatoryAccount2 = try! Account(privateKeyHexString: TestSettings.cosignatory2PrivateKey, networkType: .mijinTest) + + var listener: Listener! + var disposeBag: DisposeBag! + + override func setUp() { + super.setUp() + listener = Listener(url: TestSettings.url) + disposeBag = DisposeBag() + + listener.error().subscribe( + onNext: { error in + if case Nem2SdkSwiftError.parseError(let message) = error{ + print(message) + } else { + print(error.localizedDescription) + } + } + ).disposed(by: disposeBag) + _ = try! listener.open().toBlocking().first() + } + + func testShouldConnectToWebSocket() { + XCTAssertNotNil(listener.uid) + } + + func testShouldReturnNewBlockViaListener() { + _ = announceStandaloneTransferTransaction() + + let blockInfo = try! listener.newBlock().toBlocking().first()! + + XCTAssertTrue(blockInfo.height > 0) + } + + func testShouldReturnConfirmedTransactionAddressSignerViaListener() { + let signedTransaction = announceStandaloneTransferTransaction() + + let transaction = try! listener.confirmed(address: account.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, transaction.transactionInfo?.hash) + } + + func testShouldReturnConfirmedTransactionAddressRecipientViaListener() { + let signedTransaction = announceStandaloneTransferTransaction() + + let transaction = try! listener.confirmed(address: try! Address(rawAddress: "SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC")).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, transaction.transactionInfo?.hash) + } + + func testShouldReturnUnconfirmedAddedTransactionViaListener() { + let signedTransaction = announceStandaloneTransferTransaction() + + let transaction = try! listener.unconfirmedAdded(address: account.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, transaction.transactionInfo?.hash) + // Wait for removing unconfirmed transaction for next test + _ = try! listener.unconfirmedRemoved(address: account.address).toBlocking().first()! + } + + func testShouldReturnUnconfirmedRemovedTransactionViaListener() { + let signedTransaction = announceStandaloneTransferTransaction() + + let hash = try! listener.unconfirmedRemoved(address: account.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, hash) + } + + func testShouldReturnAggregateBondedAddedTransactionViaListener() { + watchTransactionError(cosignatoryAccount1.address) + + guard let signedTransaction = announceAggregateBondedTransaction() else { + XCTFail("Failed to send aggregate bonded transaction.") + return + } + + let aggregateTransaction = try! listener.aggregateBondedAdded(address: cosignatoryAccount1.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, aggregateTransaction.transactionInfo?.hash) + + // confirm to unlock funds + //announceCosignatureTransaction(transactionToCosign: aggregateTransaction, with: cosignatoryAccount1) + announceCosignatureTransaction(transactionToCosign: aggregateTransaction, with: cosignatoryAccount2) + } + + func testShouldReturnAggregateBondedRemovedTransactionViaListener() { + watchTransactionError(cosignatoryAccount1.address) + + guard let signedTransaction = announceAggregateBondedTransaction() else { + XCTFail("Failed to send aggregate bonded transaction.") + return + } + + let aggregateTransaction = try! listener.aggregateBondedAdded(address: cosignatoryAccount1.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, aggregateTransaction.transactionInfo?.hash) + + let aggregateRemoveObserver = try! listener.aggregateBondedRemoved(address: cosignatoryAccount1.address) + + // confirm + announceCosignatureTransaction(transactionToCosign: aggregateTransaction, with: cosignatoryAccount2) + + let hash = try! aggregateRemoveObserver.toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, hash) + } + + + func testShouldReturnCosignatureAddedViaListener() { + watchTransactionError(cosignatoryAccount1.address) + + guard let signedTransaction = announceAggregateBondedTransaction() else { + XCTFail("Failed to send aggregate bonded transaction.") + return + } + + let aggregateTransaction = try! listener.aggregateBondedAdded(address: cosignatoryAccount1.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, aggregateTransaction.transactionInfo?.hash) + + let cosignatureObserver = try! listener.cosignatureAdded(address: cosignatoryAccount1.address) + + // confirm + announceCosignatureTransaction(transactionToCosign: aggregateTransaction, with: cosignatoryAccount2) + + let cosignature = try! cosignatureObserver.toBlocking().first()! + + XCTAssertEqual(cosignature.signer, cosignatoryAccount2.publicKeyBytes) + } + + + func testShouldReturnTransactionStatusGivenAddedViaListener() { + let signedTransaction = announceStandaloneTransferTransactionWithInsufficientBalance() + + let status = try! listener.status(address: account.address).toBlocking().first()! + XCTAssertEqual(signedTransaction.hash, status.hash) + } + + private func watchTransactionError(_ address: Address) { + listener.status(address: address).subscribe( + onNext: { status in + print(status.status) + } + ).disposed(by: disposeBag) + } + + + private func announceStandaloneTransferTransaction() -> SignedTransaction { + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC"), + mosaics: [], + message: PlainMessage.empty, + networkType: .mijinTest + ) + + let signedTransaction = account.sign(transaction: transferTransaction) + _ = try! transactionHttp.announce(signedTransaction: signedTransaction).toBlocking().first()! + return signedTransaction + } + + + private func announceStandaloneTransferTransactionWithInsufficientBalance() -> SignedTransaction { + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC"), + mosaics: [XEM.of(xemAmount: 1000000)], + message: PlainMessage(text: "test-message"), + networkType: .mijinTest) + + let signedTransaction = account.sign(transaction: transferTransaction) + _ = try! transactionHttp.announce(signedTransaction: signedTransaction).toBlocking().first()! + return signedTransaction + } + + private func announceAggregateBondedTransaction() -> SignedTransaction? { + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC"), + mosaics: [], + networkType: .mijinTest) + + let aggregateTransaction = try! AggregateTransaction.createBonded( + innerTransactions: [transferTransaction.toAggregate(signer: multisigAccount.publicAccount)], + networkType: .mijinTest) + + let signedTransaction = cosignatoryAccount1.sign(transaction: aggregateTransaction) + + // Lock funds + let lockFundsTransaction = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest) + + let signedLockFundsTransaction = cosignatoryAccount1.sign(transaction: lockFundsTransaction) + // announce lock funds + _ = try! transactionHttp.announce(signedTransaction: signedLockFundsTransaction).toBlocking().first()! + + // wait confirmed + let disposeBag = DisposeBag() + let blockObserver = listener.newBlock().toBlocking() + for i in 0..<100 { + _ = try! blockObserver.first()! + + let transactionStatus = try! transactionHttp.getTransactionStatus(hash: signedLockFundsTransaction.hash).toBlocking().first()! + if transactionStatus.height != nil { + // confirmed + break + } + // unconfirmed + if transactionStatus.group == "failed" { + // error + return nil + } + } + + // announce aggregate bonded transaction + _ = try! transactionHttp.announceAggregateBonded(signedTransaction: signedTransaction).toBlocking().first()! + + return signedTransaction + } + + private func announceCosignatureTransaction(transactionToCosign: AggregateTransaction, with account: Account) -> CosignatureSignedTransaction { + let cosignatureTransaction = try! CosignatureTransaction(transactionToCosign: transactionToCosign) + + let cosignatureSignedTransaction = account.sign(cosignatureTransaction: cosignatureTransaction) + _ = try! transactionHttp.announceAggregateBondedCosignature(cosignatureSignedTransaction: cosignatureSignedTransaction).toBlocking().first()! + + return cosignatureSignedTransaction + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/MosaicHttpTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/MosaicHttpTest.swift new file mode 100644 index 0000000..8ac2c7c --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/MosaicHttpTest.swift @@ -0,0 +1,51 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +import RxBlocking +@testable import Nem2SdkSwift + + +class MosaicHttpTest: XCTestCase { + private var mosaicHttp: MosaicHttp! + + override func setUp() { + super.setUp() + mosaicHttp = MosaicHttp(url: TestSettings.url) + } + + func testGetMosaic() { + let mosaicInfo = try! mosaicHttp.getMosaic(mosaicId: XEM.mosaicId).toBlocking().first()! + XCTAssertEqual(1, mosaicInfo.height) + XCTAssertEqual(XEM.namespaceId, mosaicInfo.namespaceId) + XCTAssertEqual(XEM.mosaicId, mosaicInfo.mosaicId) + } + + func testGetMosaics() { + let mosaicInfo = try! mosaicHttp.getMosaics(mosaicIds: [XEM.mosaicId]).toBlocking().first()! + + XCTAssertEqual(XEM.namespaceId, mosaicInfo[0].namespaceId) + XCTAssertEqual(XEM.mosaicId, mosaicInfo[0].mosaicId) + } + + func testGetMosaicsFromNamespace() { + let mosaicInfo = try! mosaicHttp.getMosaicsFromNamespace(namespaceId: XEM.namespaceId).toBlocking().first()! + + XCTAssertEqual(XEM.namespaceId, mosaicInfo[0].namespaceId) + XCTAssertEqual(XEM.mosaicId, mosaicInfo[0].mosaicId) + } + + func testGetMosaicNames() { + let mosaicNames = try! mosaicHttp.getMosaicNames(mosaicIds: [XEM.mosaicId]).toBlocking().first()! + + XCTAssertEqual("xem", mosaicNames[0].name) + XCTAssertEqual(XEM.mosaicId, mosaicNames[0].mosaicId) + } + + func testThrowExceptionWhenMosaicDoesNotExists() { + TestUtils.expectResponseError(code: 404) { + _ = try mosaicHttp.getMosaic(mosaicId: try! MosaicId(fullName: "nem:nem")).toBlocking().first() + } + } +} diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/NamespaceHttpTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/NamespaceHttpTest.swift new file mode 100644 index 0000000..3f1e6b3 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/NamespaceHttpTest.swift @@ -0,0 +1,55 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +import RxBlocking +@testable import Nem2SdkSwift + +class NamespaceHttpTest: XCTestCase { + private var namespaceHttp: NamespaceHttp! + + override func setUp() { + super.setUp() + namespaceHttp = NamespaceHttp(url: TestSettings.url) + } + + func testGetNamespace() { + let namespaceInfo = try! namespaceHttp.getNamespace(namespaceId: XEM.namespaceId).toBlocking().first()! + XCTAssertEqual(1, namespaceInfo.startHeight) + XCTAssertEqual(UInt64.max, namespaceInfo.endHeight) + XCTAssertEqual(XEM.namespaceId, namespaceInfo.levels[0]) + } + + func testGetNamespacesFromAccount() { + let namespaceInfo = try! namespaceHttp.getNamespacesFromAccount(address: try! Address(rawAddress: TestSettings.nemesisSigner)).toBlocking().first()! + + XCTAssertEqual(1, namespaceInfo.count) + XCTAssertEqual(1, namespaceInfo[0].startHeight) + XCTAssertEqual(UInt64.max, namespaceInfo[0].endHeight) + XCTAssertEqual(XEM.namespaceId, namespaceInfo[0].levels[0]) + } + + func testGetNamespacesFromAccounts() { + let namespaceInfo = try! namespaceHttp.getNamespacesFromAccounts(addresses: [try! Address(rawAddress: TestSettings.nemesisSigner)]).toBlocking().first()! + + XCTAssertEqual(1, namespaceInfo.count) + XCTAssertEqual(1, namespaceInfo[0].startHeight) + XCTAssertEqual(UInt64.max, namespaceInfo[0].endHeight) + XCTAssertEqual(XEM.namespaceId, namespaceInfo[0].levels[0]) + } + + func testGetNamespaceNames() { + let namespaceNames = try! namespaceHttp.getNamespaceNames(namespaceIds: [XEM.namespaceId]).toBlocking().first()! + + XCTAssertEqual(1, namespaceNames.count) + XCTAssertEqual("nem", namespaceNames[0].name) + XCTAssertEqual(XEM.namespaceId, namespaceNames[0].namespaceId) + } + + func testThrowExceptionWhenNamespaceDoesNotExists() { + TestUtils.expectResponseError(code: 404) { + _ = try namespaceHttp.getNamespace(namespaceId: try! NamespaceId(fullName: "nonregisterednamespace")).toBlocking().first()! + } + } +} diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/NetworkHttpTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/NetworkHttpTest.swift new file mode 100644 index 0000000..5c5921a --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/NetworkHttpTest.swift @@ -0,0 +1,22 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +import RxBlocking +@testable import Nem2SdkSwift + +class NetworkHttpTest: XCTestCase { + private var networkHttp: NetworkHttp! + + override func setUp() { + super.setUp() + networkHttp = NetworkHttp(url: TestSettings.url) + } + + + func testGetNetworkType() { + let networkType = try! networkHttp.getNetworkType().toBlocking().first()! + XCTAssertEqual(NetworkType.mijinTest, networkType) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/infrastructure/TransactionHttpTest.swift b/Nem2SdkSwiftTests/sdk/infrastructure/TransactionHttpTest.swift new file mode 100644 index 0000000..1a1e8aa --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/infrastructure/TransactionHttpTest.swift @@ -0,0 +1,57 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +import XCTest +import RxBlocking +@testable import Nem2SdkSwift + +class TransactionHttpTest: XCTestCase { + private var transactionHttp: TransactionHttp! + + override func setUp() { + super.setUp() + transactionHttp = TransactionHttp(url: TestSettings.url) + } + + func testGetTransaction() { + let transaction: Transaction = try! transactionHttp.getTransaction(hash: TestSettings.transactionHash).toBlocking().first()! + + XCTAssertEqual(TransactionType.transfer, transaction.type) + XCTAssertEqual(TestSettings.transactionHash, transaction.transactionInfo?.hash) + } + + func testGetTransactions() { + let transactions: [Transaction] = try! transactionHttp.getTransactions(hashes: [TestSettings.transactionHash]).toBlocking().first()! + + XCTAssertEqual(1, transactions.count) + XCTAssertEqual(TransactionType.transfer, transactions[0].type) + XCTAssertEqual(TestSettings.transactionHash, transactions[0].transactionInfo?.hash) + } + + func testGetTransactionStatus() { + let transactionStatus: TransactionStatus = try! transactionHttp.getTransactionStatus(hash: TestSettings.transactionHash).toBlocking().first()! + + XCTAssertEqual(TestSettings.transactionHash, transactionStatus.hash) + } + + + func testGetTransactionsStatuses() { + let transactionStatuses: [TransactionStatus] = try! transactionHttp.getTransactionStatuses(hashes: [TestSettings.transactionHash]).toBlocking().first()! + + XCTAssertEqual(TestSettings.transactionHash, transactionStatuses[0].hash) + } + + func testThrowExceptionWhenTransactionStatusOfATransactionDoesNotExists() { + TestUtils.expectResponseError(code: 404) { + _ = try transactionHttp.getTransactionStatus(hash: [UInt8](repeating: 0, count: 32)).toBlocking().first() + } + } + + func testThrowExceptionWhenTransactionDoesNotExists() { + TestUtils.expectResponseError(code: 404) { + _ = try transactionHttp.getTransaction(hash: [UInt8](repeating: 0, count: 32)).toBlocking().first() + } + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/account/AccountTest.swift b/Nem2SdkSwiftTests/sdk/model/account/AccountTest.swift new file mode 100644 index 0000000..fb24198 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/account/AccountTest.swift @@ -0,0 +1,63 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class AccountTest: XCTestCase { + + func testShouldCreateAccountViaConstructor() { + let account = try! Account( + privateKeyHexString: "787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", + networkType: .mijinTest) + + XCTAssertEqual("SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY", account.address.plain); + XCTAssertEqual("1026D70E1954775749C6811084D6450A3184D977383F0E4282CD47118AF37755", account.publicKeyHexString) + XCTAssertEqual("787225AAFF3D2C71F4FFA32D4F19EC4922F3CD869747F267378F81F8E3FCB12D", account.privateKeyHexString) + } + + + func testShouldCreateAccountWithUppercasePrivateKey() { + let account = try! Account( + privateKeyHexString: "787225AAFF3D2C71F4FFA32D4F19EC4922F3CD869747F267378F81F8E3FCB12D", + networkType: .mijinTest) + + XCTAssertEqual("SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY", account.address.plain); + XCTAssertEqual("1026D70E1954775749C6811084D6450A3184D977383F0E4282CD47118AF37755", account.publicKeyHexString) + XCTAssertEqual("787225AAFF3D2C71F4FFA32D4F19EC4922F3CD869747F267378F81F8E3FCB12D", account.privateKeyHexString) + } + + + func testShouldCreateAccountViaConstructor2() { + let account = try! Account( + privateKeyHexString: "5098D500390934F81EA416D9A2F50F276DE446E28488E1801212931E3470DA31", + networkType: .mijinTest) + XCTAssertEqual("5098D500390934F81EA416D9A2F50F276DE446E28488E1801212931E3470DA31", account.privateKeyHexString) + XCTAssertEqual("9B800145F7228CE0014FC6FB44AD899BFCAD7B0CDF48DB63A7CC7299E373D734", account.publicKeyHexString) + XCTAssertEqual("SAQC5A-K6X2K6-YYAI4L-2TQI2T-4ZRWAO-URYDYT-UO77", account.address.pretty) + } + + func testShouldCreateAccountViaConstructor3() { + let account = try! Account( + privateKeyHexString: "B8AFAE6F4AD13A1B8AAD047B488E0738A437C7389D4FF30C359AC068910C1D59", + networkType: .mijinTest) + XCTAssertEqual("B8AFAE6F4AD13A1B8AAD047B488E0738A437C7389D4FF30C359AC068910C1D59", account.privateKeyHexString) + XCTAssertEqual("68B3FBB18729C1FDE225C57F8CE080FA828F0067E451A3FD81FA628842B0B763", account.publicKeyHexString) + XCTAssertEqual("SBE6CS7LZKJXLDVTNAC3VZ3AUVZDTF3PACNFIXFN", account.address.plain) + } + + func testShouldSignTransaction() { + let account = try! Account(privateKeyHexString: "787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", networkType: .mijinTest) + let transferTransaction = TransferTransaction.create( + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + mosaics: [Mosaic(id: MosaicId(id: 95442763262823), amount: 100)], + message: PlainMessage.empty, + networkType: .mijinTest, + deadline: FakeDeadline()) + + let signedTransaction = account.sign(transaction: transferTransaction) + XCTAssertEqual("A5000000773891AD01DD4CDF6E3A55C186C673E256D7DF9D471846F1943CC3529E4E02B38B9AF3F8D13784645FF5FAAFA94A321B94933C673D12DE60E4BC05ABA56F750E1026D70E1954775749C6811084D6450A3184D977383F0E4282CD47118AF37755039054410000000000000000010000000000000090E8FEBD671DD41BEE94EC3BA5831CB608A312C2F203BA84AC01000100672B0000CE5600006400000000000000", signedTransaction.payload.hexString.uppercased()) + XCTAssertEqual("350AE56BC97DB805E2098AB2C596FA4C6B37EF974BF24DFD61CD9F77C7687424", signedTransaction.hash.hexString.uppercased()) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/account/AddressTest.swift b/Nem2SdkSwiftTests/sdk/model/account/AddressTest.swift new file mode 100644 index 0000000..2fc4989 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/account/AddressTest.swift @@ -0,0 +1,130 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class AddressTest: XCTestCase { + func testAddressCreation() { + let address = try! Address(address: "SDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", networkType: .mijinTest) + XCTAssertEqual("SDGLFWDSHILTIUHGIBH5UGX2VYF5VNJEKCCDBR26", address.plain) + } + + + func testAddressWithSpacesCreation() { + let address = try! Address(address: " SDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26 ", networkType: .mijinTest) + XCTAssertEqual("SDGLFWDSHILTIUHGIBH5UGX2VYF5VNJEKCCDBR26", address.plain) + } + + + func testLowerCaseAddressCreation() { + let address = try! Address(address: "sdglfw-dshilt-iuhgib-h5ugx2-vyf5vn-jekccd-br26", networkType: .mijinTest) + XCTAssertEqual("SDGLFWDSHILTIUHGIBH5UGX2VYF5VNJEKCCDBR26", address.plain) + } + + func testAddressInPrettyFormat() { + let address = try! Address(address: "SDRDGF-TDLLCB-67D4HP-GIMIHP-NSRYRJ-RT7DOB-GWZY", networkType: .mijinTest) + XCTAssertEqual("SDRDGF-TDLLCB-67D4HP-GIMIHP-NSRYRJ-RT7DOB-GWZY", address.pretty) + } + + + func testEquality() { + let address1 = try! Address(address: "SDRDGF-TDLLCB-67D4HP-GIMIHP-NSRYRJ-RT7DOB-GWZY", networkType: .mijinTest) + let address2 = try! Address(address: "SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY", networkType: .mijinTest) + XCTAssertEqual(address1, address2) + } + + func testNoEquality() { + let address1 = try! Address(address: "SRRRRR-TTTTTT-555555-GIMIHP-NSRYRJ-RT7DOB-GWZY", networkType: .mijinTest) + let address2 = try! Address(address: "SDRDGF-TDLLCB-67D4HP-GIMIHP-NSRYRJ-RT7DOB-GWZY", networkType: .mijinTest) + XCTAssertNotEqual(address1, address2); + } +} + + + +struct AddressTestFixture { + let address: String + let network: NetworkType +} + + +class AddressValidTest : ParameterizedTest { + override class func createTestCases() -> [ParameterizedTest] { + return self.testInvocations.map { AddressValidTest(invocation: $0) } + } + + override class var fixtures: [Any] { + get { + return [ + AddressTestFixture(address: "SDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .mijinTest), + AddressTestFixture(address: "MDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .mijin), + AddressTestFixture(address: "TDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .testNet), + AddressTestFixture(address: "NDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .mainNet) + ] + } + } + + func testAddress() { + let fixture = self.fixture as! AddressTestFixture + let address = try! Address(address: fixture.address, networkType: fixture.network) + XCTAssertEqual(fixture.network, address.networkType) + } +} + +class AddressExceptionTest : ParameterizedTest { + override class func createTestCases() -> [ParameterizedTest] { + return self.testInvocations.map { AddressExceptionTest(invocation: $0) } + } + + override class var fixtures: [Any] { + get { + return [ + AddressTestFixture(address: "SDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .mijin), + AddressTestFixture(address: "MDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .mainNet), + AddressTestFixture(address: "TDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .mainNet), + AddressTestFixture(address: "NDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", network: .testNet) + ] + } + } + + func testAddress() { + let fixture = self.fixture as! AddressTestFixture + TestUtils.expectIllegalArgument { + _ = try Address(address: fixture.address, networkType: fixture.network) + } + } +} + + + +struct AddressPublicKeyTestFixture { + let publicKey: String + let network: NetworkType + let address: String +} + +class AddressPublicKeyTest : ParameterizedTest { + override class func createTestCases() -> [ParameterizedTest] { + return self.testInvocations.map { AddressPublicKeyTest(invocation: $0) } + } + + override class var fixtures: [Any] { + get { + return [ + AddressPublicKeyTestFixture(publicKey: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf", network: .mijinTest, address: "SARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJETM3ZSP"), + AddressPublicKeyTestFixture(publicKey: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf", network: .mijin, address: "MARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJE5K5RYU"), + AddressPublicKeyTestFixture(publicKey: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf", network: .testNet, address: "TARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJE47FYR3"), + AddressPublicKeyTestFixture(publicKey: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf", network: .mainNet, address: "NARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJFJKUV32"), + ] + } + } + + func testAddress() { + let fixture = self.fixture as! AddressPublicKeyTestFixture + let address = try! Address(publicKeyHexString: fixture.publicKey, networkType: fixture.network) + XCTAssertEqual(fixture.address, address.plain) + } +} + diff --git a/Nem2SdkSwiftTests/sdk/model/account/MultisigAccountGraphInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/account/MultisigAccountGraphInfoTest.swift new file mode 100644 index 0000000..d4e1a10 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/account/MultisigAccountGraphInfoTest.swift @@ -0,0 +1,31 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MultisigAccountGraphInfoTest: XCTestCase { + + func testReturnTheLevels() { + var info: [Int: [MultisigAccountInfo]] = [:] + let multisigAccountInfo = MultisigAccountInfo( + account: try! PublicAccount( + publicKeyHexString: "5D58EC16F07BF00BDE9B040E7451A37F9908C59E143A01438C04345D8E9DDF39", + networkType: .mijinTest), + minApproval: 1, + minRemoval: 1, + cosignatories: [ + try! PublicAccount( + publicKeyHexString: "1674016C27FE2C2EB5DFA73996FA54A183B38AED0AA64F756A3918BAF08E061B", + networkType: .mijinTest) + ], + multisigAccounts: []) + info[-3] = [multisigAccountInfo] + + let multisigAccountGraphInfo = MultisigAccountGraphInfo(multisigAccounts: info) + + XCTAssertEqual([-3] as Set, multisigAccountGraphInfo.levelsNumber) + XCTAssertEqual(multisigAccountInfo, multisigAccountGraphInfo.multisigAccounts[-3]![0]) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/account/MultisigAccountInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/account/MultisigAccountInfoTest.swift new file mode 100644 index 0000000..cce901e --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/account/MultisigAccountInfoTest.swift @@ -0,0 +1,133 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MultisigAccountInfoTest: XCTestCase { + private let account1 = try! PublicAccount(publicKeyHexString: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf", networkType: .mijinTest) + private let account2 = try! PublicAccount(publicKeyHexString: "846b4439154579a5903b1459c9cf69cb8153f6d0110a7a0ed61de29ae4810bf2", networkType: .mijinTest) + private let account3 = try! PublicAccount(publicKeyHexString: "cf893ffcc47c33e7f68ab1db56365c156b0736824a0c1e273f9e00b8df8f01eb", networkType: .mijinTest) + private let account4 = try! PublicAccount(publicKeyHexString: "68b3fbb18729c1fde225c57f8ce080fa828f0067e451a3fd81fa628842b0b763", networkType: .mijinTest) + + + func testShouldBeCreated() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [account2], + multisigAccounts: [] + ) + XCTAssertEqual(account1, multisigAccountInfo.account) + XCTAssertEqual(2, multisigAccountInfo.minApproval) + XCTAssertEqual(1, multisigAccountInfo.minRemoval) + XCTAssertEqual(1, multisigAccountInfo.cosignatories.count) + } + + func testIsCosignerShouldReturnTrueWhenTheAccountIsInTheCosignatoriesList() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [account2, account3], + multisigAccounts: [] + ) + + XCTAssertTrue(multisigAccountInfo.hasCosigner(account: account2)) + } + + func testIsCosignatoryShouldReturnFalseWhenTheAccountIsNotInTHeCosignatoriesList() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [account2, account3], + multisigAccounts: [] + ) + XCTAssertFalse(multisigAccountInfo.hasCosigner(account: account4)) + } + + + func testIsCosignerOfMultisigAccountShouldReturnTrueWhenItContainsThatAccountInMultisigList() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [], + multisigAccounts: [account2, account3] + ) + + XCTAssertTrue(multisigAccountInfo.isCosignerOf(account: account2)) + } + + + func testIsCosignerOfMultisigAccountShouldReturnFalseWhenItDoesNotContainsThatAccountInMultisigList() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [], + multisigAccounts: [account2, account3] + ) + + XCTAssertFalse(multisigAccountInfo.isCosignerOf(account: account4)) + } + + func testReturnCosignersList() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [account2, account3], + multisigAccounts: [] + ) + XCTAssertEqual([account2, account3], multisigAccountInfo.cosignatories) + } + + + func testReturnMultisigList() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 2, + minRemoval: 1, + cosignatories: [], + multisigAccounts: [account2, account3] + ) + XCTAssertEqual([account2, account3], multisigAccountInfo.multisigAccounts) + } + + func testIsMultisigShouldReturnFalseWhenMinApprovalIs0() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 0, + minRemoval: 1, + cosignatories: [], + multisigAccounts: [account2, account3] + ) + XCTAssertFalse(multisigAccountInfo.isMultisig) + } + + func testIsMultisigShouldReturnFalseWhenMinRemovalIs0() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 1, + minRemoval: 0, + cosignatories: [], + multisigAccounts: [account2, account3] + ) + XCTAssertFalse(multisigAccountInfo.isMultisig) + } + + func testIsMultisigShouldReturnTrueWhenMinRemovalAndMinApprovalIsNot0() { + let multisigAccountInfo = MultisigAccountInfo( + account: account1, + minApproval: 1, + minRemoval: 1, + cosignatories: [], + multisigAccounts: [account2, account3] + ) + XCTAssertTrue(multisigAccountInfo.isMultisig) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/account/PublicAccountTest.swift b/Nem2SdkSwiftTests/sdk/model/account/PublicAccountTest.swift new file mode 100644 index 0000000..570b737 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/account/PublicAccountTest.swift @@ -0,0 +1,30 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class PublicAccountTest: XCTestCase { + private let publicKey = try! PublicKey(hexString: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf") + private let address = "SARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJETM3ZSP" + + func testShouldCreatePublicAccountViaConstructor() { + let publicAccount = PublicAccount(publicKey: publicKey, networkType: .mijinTest) + XCTAssertEqual(publicKey.description, publicAccount.publicKey.description) + XCTAssertEqual(address, publicAccount.address.plain) + } + + func testEqualityIsBasedOnPublicKeyAndNetwork() { + let publicAccount = PublicAccount(publicKey: publicKey, networkType: .mijinTest) + let publicAccount2 = PublicAccount(publicKey: publicKey, networkType: .mijinTest) + XCTAssertEqual(publicAccount, publicAccount2) + } + + func testEqualityReturnsFalseIfNetworkIsDifferent() { + let publicAccount = PublicAccount(publicKey: publicKey, networkType: .mijinTest) + let publicAccount2 = PublicAccount(publicKey: publicKey, networkType: .mainNet) + XCTAssertNotEqual(publicAccount, publicAccount2) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/blockchain/BlockInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/blockchain/BlockInfoTest.swift new file mode 100644 index 0000000..9729cab --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/blockchain/BlockInfoTest.swift @@ -0,0 +1,47 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class BlockInfoTest: XCTestCase { + + func testCreateANewBlockInfo() { + let blockInfo = BlockInfo( + hash: "24E92B511B54EDB48A4850F9B42485FDD1A30589D92C775632DDDD71D7D1D691", + generationHash: "57F7DA205008026C776CB6AED843393F04CD458E0AA2D9F1D5F31A402072B2D6", + totalFee: 0, + numTransactions: 25, + signature: "37351C8244AC166BE6664E3FA954E99A3239AC46E51E2B32CEA1C72DD0851100A7731868E932E1A9BEF8A27D48E1" + "FFEE401E933EB801824373E7537E51733E0F", + signer: try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), + networkType: .mijinTest, + version: 3, + type: 32768, + height: 1, + timestamp: 0, + difficulty: 0x23283276447232, + previousBlockHash: "702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0", + blockTransactionHash: "0000000000000000000000000000000000000000000000000000000000000000") + + XCTAssertEqual("24E92B511B54EDB48A4850F9B42485FDD1A30589D92C775632DDDD71D7D1D691", blockInfo.hash) + XCTAssertEqual("57F7DA205008026C776CB6AED843393F04CD458E0AA2D9F1D5F31A402072B2D6", blockInfo.generationHash) + XCTAssertEqual(0, blockInfo.totalFee) + XCTAssertEqual(25, blockInfo.numTransactions) + XCTAssertEqual("37351C8244AC166BE6664E3FA954E99A3239AC46E51E2B32CEA1C72DD0851100A7731868E932E1A9BEF8A27D48E1" + + "FFEE401E933EB801824373E7537E51733E0F", blockInfo.signature) + XCTAssertEqual(try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), + blockInfo.signer) + + XCTAssertEqual(NetworkType.mijinTest, blockInfo.networkType) + XCTAssertEqual(3, blockInfo.version) + XCTAssertEqual(32768, blockInfo.type) + XCTAssertEqual(1, blockInfo.height) + XCTAssertEqual(0, blockInfo.timestamp) + XCTAssertEqual(0x23283276447232, blockInfo.difficulty) + XCTAssertEqual("702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0", blockInfo.previousBlockHash) + XCTAssertEqual("0000000000000000000000000000000000000000000000000000000000000000", blockInfo.blockTransactionHash) + } +} + diff --git a/Nem2SdkSwiftTests/sdk/model/blockchain/BlockchainScore.swift b/Nem2SdkSwiftTests/sdk/model/blockchain/BlockchainScore.swift new file mode 100644 index 0000000..017d6a3 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/blockchain/BlockchainScore.swift @@ -0,0 +1,13 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation + +/// The blockchain score structure describes blockchain difficulty. +public struct BlockchainScore { + /// Low part of the blockchain score. + public let scoreLow: UInt64 + /// High part of the blockchain score. + public let scoreHigh: UInt64 +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/blockchain/BlockchainStorageInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/blockchain/BlockchainStorageInfoTest.swift new file mode 100644 index 0000000..92eea47 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/blockchain/BlockchainStorageInfoTest.swift @@ -0,0 +1,17 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class BlockchainStorageInfoTest: XCTestCase { + + func testCreateANewBlockchainStorageInfo() { + let blockchainStorageInfo = BlockchainStorageInfo(numAccounts: 1, numBlocks: 2, numTransactions: 3) + + XCTAssertEqual(blockchainStorageInfo.numAccounts, 1) + XCTAssertEqual(blockchainStorageInfo.numBlocks, 2) + XCTAssertEqual(blockchainStorageInfo.numTransactions, 3) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/blockchain/NetworkTypeTest.swift b/Nem2SdkSwiftTests/sdk/model/blockchain/NetworkTypeTest.swift new file mode 100644 index 0000000..6a418f4 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/blockchain/NetworkTypeTest.swift @@ -0,0 +1,29 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class NetworkTypeTest: XCTestCase { + + func testMAIN_NETIs0x68() { + XCTAssertEqual(0x68, NetworkType.mainNet.rawValue) + XCTAssertEqual(104, NetworkType.mainNet.rawValue) + } + + func testTEST_NETIs0x98() { + XCTAssertEqual(0x98, NetworkType.testNet.rawValue) + XCTAssertEqual(152, NetworkType.testNet.rawValue) + } + + func testMIJINIs0x60() { + XCTAssertEqual(0x60, NetworkType.mijin.rawValue) + XCTAssertEqual(96, NetworkType.mijin.rawValue) + } + + func testMIJIN_TESTIs0x90() { + XCTAssertEqual(0x90, NetworkType.mijinTest.rawValue) + XCTAssertEqual(144, NetworkType.mijinTest.rawValue) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicIdTest.swift b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicIdTest.swift new file mode 100644 index 0000000..c92813b --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicIdTest.swift @@ -0,0 +1,53 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MosaicIdTest: XCTestCase { + func testCreateAMosaicIdFromMosaicNameViaConstructor() { + let mosaicId = try! MosaicId(fullName: "nem:xem") + XCTAssertEqual(mosaicId.id, TestUtils.xemId) + XCTAssertEqual(mosaicId.fullName, "nem:xem") + } + + func testCreateAMosaicIdFromIdViaConstructor() { + let mosaicId = MosaicId(id: TestUtils.nemId) + XCTAssertEqual(mosaicId.id, TestUtils.nemId) + XCTAssertNil(mosaicId.fullName) + } + + func testShouldCompareMosaicIdsForEquality() { + let mosaicId = MosaicId(id: TestUtils.nemId) + let mosaicId2 = MosaicId(id: TestUtils.nemId) + XCTAssertEqual(mosaicId, mosaicId2) + } +} + + +class MosaicIdExceptionTest : ParameterizedTest { + override class func createTestCases() -> [ParameterizedTest] { + return self.testInvocations.map { MosaicIdExceptionTest(invocation: $0) } + } + + override class var fixtures: [Any] { + get { + return [ + "nem", + "nem.xem", + ":nem", + "nem.xem:", + "", + "nem:xem:nem" + ] + } + } + + func testThrowIllegalMosaicIdentifierExceptionWhenMosaicIsNotValid() { + let fixture = self.fixture as! String + TestUtils.expectIllegalArgument { + _ = try MosaicId(fullName: fixture) + } + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicInfoTest.swift new file mode 100644 index 0000000..a3344b8 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicInfoTest.swift @@ -0,0 +1,64 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MosaicInfoTest: XCTestCase { + func createMosaicInfo( + isActive: Bool = true, + index: Int = 0, + metaId: String = "5A3CD9B09CD1E8000159249B", + namespaceId: NamespaceId = NamespaceId(id: TestUtils.nemId), + mosaicId: MosaicId = MosaicId(id: TestUtils.xemId), + supply: UInt64 = 100, + height: UInt64 = 0, + owner: PublicAccount = try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), + properties: MosaicProperties = MosaicProperties(isSupplyMutable: true, isTransferable: true, isLevyMutable: true, divisibility: 3, duration: 10) + ) -> MosaicInfo { + + return MosaicInfo(isActive: isActive, index: index, metaId: metaId, namespaceId: namespaceId, mosaicId: mosaicId, supply: supply, height: height, owner: owner, properties: properties ) + } + + + func testCreateAMosaicInfoViaConstructor() { + let mosaicInfo = createMosaicInfo() + + XCTAssertEqual(true, mosaicInfo.isActive) + XCTAssertEqual(0, mosaicInfo.index) + XCTAssertEqual("5A3CD9B09CD1E8000159249B", mosaicInfo.metaId) + XCTAssertEqual(NamespaceId(id: TestUtils.nemId),mosaicInfo.namespaceId) + XCTAssertEqual(MosaicId(id: TestUtils.xemId), mosaicInfo.mosaicId) + XCTAssertEqual(100, mosaicInfo.supply) + XCTAssertEqual(0, mosaicInfo.height) + XCTAssertEqual(try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), mosaicInfo.owner) + XCTAssertTrue(mosaicInfo.isSupplyMutable) + XCTAssertTrue(mosaicInfo.isTransferable) + XCTAssertTrue(mosaicInfo.isLevyMutable) + XCTAssertEqual(3, mosaicInfo.divisibility) + XCTAssertEqual(10, mosaicInfo.duration) + } + + func testShouldReturnIsSupplyMutableWhenIsImmutable() { + let mosaicProperties = MosaicProperties(isSupplyMutable: false, isTransferable: true, isLevyMutable: true, divisibility: 3, duration: 10) + let mosaicInfo = createMosaicInfo(properties: mosaicProperties) + + XCTAssertFalse(mosaicInfo.isSupplyMutable) + } + + + func testShouldReturnIsTransferableWhenItsNotTransferable() { + let mosaicProperties = MosaicProperties(isSupplyMutable: true, isTransferable: false, isLevyMutable: true, divisibility: 3, duration: 10) + let mosaicInfo = createMosaicInfo(properties: mosaicProperties) + + XCTAssertFalse(mosaicInfo.isTransferable) + } + + func testShouldReturnIsLevyMutableWhenLevyIsImmutable() { + let mosaicProperties = MosaicProperties(isSupplyMutable: true, isTransferable: true, isLevyMutable: false, divisibility: 3, duration: 10) + let mosaicInfo = createMosaicInfo(properties: mosaicProperties) + + XCTAssertFalse(mosaicInfo.isLevyMutable) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicNameTest.swift b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicNameTest.swift new file mode 100644 index 0000000..a8a246f --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicNameTest.swift @@ -0,0 +1,19 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MosaicNameTest: XCTestCase { + + func testCreateAMosaicName() { + let namespaceId = NamespaceId(id: TestUtils.nemId) + let mosaicId = MosaicId(id: TestUtils.xemId) + let mosaicName = MosaicName(mosaicId: mosaicId, name: "xem", parentId: namespaceId) + + XCTAssertEqual(mosaicId, mosaicName.mosaicId) + XCTAssertEqual("xem", mosaicName.name) + XCTAssertEqual(namespaceId, mosaicName.parentId) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicPropertiesTest.swift b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicPropertiesTest.swift new file mode 100644 index 0000000..a3ecaed --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicPropertiesTest.swift @@ -0,0 +1,19 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MosaicPropertiesTest: XCTestCase { + + func testShouldCreateMosaicPropertiesViaConstructor() { + let mosaicProperties = MosaicProperties(isSupplyMutable: true, isTransferable: true, isLevyMutable: true, divisibility: 1, duration: 1000) + + XCTAssertTrue(mosaicProperties.isSupplyMutable) + XCTAssertTrue(mosaicProperties.isTransferable) + XCTAssertTrue(mosaicProperties.isLevyMutable) + XCTAssertEqual(1, mosaicProperties.divisibility) + XCTAssertEqual(1000, mosaicProperties.duration) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicTest.swift b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicTest.swift new file mode 100644 index 0000000..069f8cd --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/mosaic/MosaicTest.swift @@ -0,0 +1,16 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class MosaicTest: XCTestCase { + + func testCreateANewMosaicViaConstructor() { + let mosaicId = MosaicId(id: 0xD525AD41D95FCF29) + let mosaic = Mosaic(id: mosaicId, amount: 24) + XCTAssertEqual(mosaic.id, mosaicId) + XCTAssertEqual(mosaic.amount, 24) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceIdTest.swift b/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceIdTest.swift new file mode 100644 index 0000000..c07f051 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceIdTest.swift @@ -0,0 +1,36 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class NamespaceIdTest: XCTestCase { + + func testCreateANamespaceIdFromRootNamespaceNameViaConstructor() { + let namespaceId = try! NamespaceId(fullName: "nem") + + XCTAssertEqual(namespaceId.id, TestUtils.nemId) + XCTAssertEqual(namespaceId.fullName, "nem") + } + + func testCreateANamespaceIdFromSubNamespaceNameViaConstructor() { + let namespaceId = try! NamespaceId(fullName: "nem.xem") + + XCTAssertEqual(namespaceId.id, TestUtils.xemId) + XCTAssertEqual(namespaceId.fullName, "nem.xem") + } + + func testCreateANamespaceIdFromIdViaConstructor() { + let namespaceId = NamespaceId(id: TestUtils.nemId) + XCTAssertEqual(namespaceId.id, TestUtils.nemId) + XCTAssertNil(namespaceId.fullName) + } + + + func testShouldCompareNamespaceIdsForEquality() { + let namespaceId1 = NamespaceId(id: TestUtils.nemId) + let namespaceId2 = try! NamespaceId(fullName: "nem") + XCTAssertEqual(namespaceId1, namespaceId2) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceInfoTest.swift new file mode 100644 index 0000000..a88827c --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceInfoTest.swift @@ -0,0 +1,104 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class NamespaceInfoTest: XCTestCase { + + func testCreateANamespaceInfoViaConstructor() { + let namespaceId = NamespaceId(id: TestUtils.nemId) + let namespaceInfo = NamespaceInfo( + isActive: true, + index: 0, + metaId: "5A3CD9B09CD1E8000159249B", + type: .rootNamespace, + depth: 1, + levels: [namespaceId], + parentId: NamespaceId(id: 0), + owner: try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), + startHeight: 1, + endHeight: 100) + + XCTAssertEqual(namespaceInfo.isActive, true) + XCTAssertEqual(namespaceInfo.index, 0) + XCTAssertEqual("5A3CD9B09CD1E8000159249B", namespaceInfo.metaId) + XCTAssertEqual(namespaceInfo.type, .rootNamespace) + XCTAssertEqual(namespaceInfo.depth, 1) + XCTAssertEqual(namespaceInfo.levels[0], namespaceId) + + XCTAssertEqual(try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), namespaceInfo.owner) + XCTAssertEqual(1, namespaceInfo.startHeight) + XCTAssertEqual(100, namespaceInfo.endHeight) + } + + func testShouldReturnRootNamespaceId() { + let namespaceInfo = createRootNamespaceInfo() + XCTAssertEqual(TestUtils.nemId, namespaceInfo.id.id) + } + + func testShouldReturnSubNamespaceId() { + let namespaceInfo = createSubNamespaceInfo() + XCTAssertEqual(TestUtils.subNamespaceId, namespaceInfo.id.id) + } + + func testShouldReturnRootTrueWhenNamespaceInfoIsFromRootNamespace() { + let namespaceInfo = createRootNamespaceInfo() + XCTAssertTrue(namespaceInfo.isRoot) + } + + func testShouldReturnRootFalseWhenNamespaceInfoIsFromSubNamespace() { + let namespaceInfo = createSubNamespaceInfo() + XCTAssertFalse(namespaceInfo.isRoot) + } + + func testShouldReturnSubNamespaceFalseWhenNamespaceInfoIsFromRootNamespace() { + let namespaceInfo = createRootNamespaceInfo() + XCTAssertFalse(namespaceInfo.isSubNamespace) + } + + func testShouldReturnSubNamespaceTrueWhenNamespaceInfoIsFromSubNamespace() { + let namespaceInfo = createSubNamespaceInfo() + XCTAssertTrue(namespaceInfo.isSubNamespace) + } + + func testShouldReturnParentNamespaceIdWhenNamespaceInfoIsFromSubNamespace() { + let namespaceInfo = createSubNamespaceInfo() + XCTAssertEqual(TestUtils.xemId, namespaceInfo.parentId?.id) + } + + func testShouldParentNamespaceIdThrowErrorWhenNamespaceInfoIsFromRootNamespace() { + let namespaceInfo = createRootNamespaceInfo(); + XCTAssertNil(namespaceInfo.parentId) + } + + + func createRootNamespaceInfo() -> NamespaceInfo { + return NamespaceInfo( + isActive: true, + index: 0, + metaId: "5A3CD9B09CD1E8000159249B", + type: .rootNamespace, + depth: 1, + levels: [NamespaceId(id: TestUtils.nemId)], + parentId: nil, + owner: try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), + startHeight: 1, + endHeight: 100) + } + + func createSubNamespaceInfo() -> NamespaceInfo { + return NamespaceInfo( + isActive: true, + index: 0, + metaId: "5A3CD9B09CD1E8000159249B", + type: .subNamespace, + depth: 1, + levels: [NamespaceId(id: TestUtils.xemId), NamespaceId(id: TestUtils.subNamespaceId)], + parentId: NamespaceId(id: TestUtils.xemId), + owner: try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest), + startHeight: 1, + endHeight: 100) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceNameTest.swift b/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceNameTest.swift new file mode 100644 index 0000000..aa5767f --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/namespace/NamespaceNameTest.swift @@ -0,0 +1,29 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class NamespaceNameTest: XCTestCase { + + func testCreateANamespaceName() { + let namespaceId = NamespaceId(id: TestUtils.nemId) + let namespaceName = NamespaceName(namespaceId: namespaceId, name: "nem", parentId: nil) + + XCTAssertEqual(namespaceId, namespaceName.namespaceId) + XCTAssertEqual("nem", namespaceName.name) + XCTAssertNil(namespaceName.parentId) + } + + func testCreateANamespaceNameWithParentId() { + let namespaceId = NamespaceId(id: TestUtils.nemId) + let parentId = NamespaceId(id: TestUtils.xemId) + let namespaceName = NamespaceName(namespaceId: namespaceId, name: "nem", parentId: parentId) + + XCTAssertEqual(namespaceId, namespaceName.namespaceId) + XCTAssertEqual("nem", namespaceName.name) + XCTAssertEqual(parentId, namespaceName.parentId) + } +} + diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/AggregateTransactionCosignatureTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/AggregateTransactionCosignatureTest.swift new file mode 100644 index 0000000..c72b20e --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/AggregateTransactionCosignatureTest.swift @@ -0,0 +1,19 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +public class AggregateTransactionCosignatureTest: XCTestCase { + + func testCreateAnAggregateCosignatureViaConstructor() { + let signature = Array("signature".utf8) + + let aggregateTransactionCosignature = AggregateTransactionCosignature(signature: signature, signer: try! PublicAccount(publicKeyHexString: "9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType: .mijinTest)) + + XCTAssertEqual(signature, aggregateTransactionCosignature.signature) + XCTAssertEqual(try! PublicAccount(publicKeyHexString: "9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType: .mijinTest), aggregateTransactionCosignature.signer) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/AggregateTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/AggregateTransactionTest.swift new file mode 100644 index 0000000..659130a --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/AggregateTransactionTest.swift @@ -0,0 +1,107 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class AggregateTransactionTest: XCTestCase { + + func testCreateAAggregateTransactionViaStaticConstructor() { + let transferTx = TransferTransaction.create( + recipient: try! Address(rawAddress: "SDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26"), + mosaics: [], + message: PlainMessage.empty, + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + .toAggregate(signer: try! PublicAccount(publicKeyHexString: "9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType: .mijinTest)) + + let aggregateTx = try! AggregateTransaction.createComplete( + innerTransactions: [transferTx], + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + + XCTAssertEqual(NetworkType.mijinTest, aggregateTx.networkType) + XCTAssertEqual(2, aggregateTx.version) + XCTAssertTrue(Date() < aggregateTx.deadline.date) + XCTAssertEqual(0, aggregateTx.fee) + XCTAssertEqual(1, aggregateTx.innerTransactions.count) + } + + func testSerialization() { + // Generated at nem2-library-js/test/transactions/RegisterNamespaceTransaction.spec.js + let expected: [UInt8] = [209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 144, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 85, 0, 0, 0, 85, 0, 0, 0, 132, 107, 68, 57, 21, 69, 121, 165, 144, 59, 20, 89, + 201, 207, 105, 203, 129, 83, 246, 208, 17, 10, 122, 14, 214, 29, 226, 154, + 228, 129, 11, 242, 3, 144, 84, 65, 144, 80, 185, 131, 126, 250, 180, + 187, 232, 164, 185, 187, 50, 216, 18, 249, 136, 92, 0, 216, 252, + 22, 80, 225, 66, 1, 0, 1, 0, 41, 207, 95, 217, 65, 173, 37, 213, 128, 150, 152, 0, 0, 0, 0, 0] + + let transferTx = TransferTransaction.create( + recipient: try! Address(rawAddress: "SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC"), + mosaics: [XEM.of(microXemAmount: 10000000)], + message: PlainMessage.empty, + networkType: .mijinTest, + deadline: FakeDeadline()) + + .toAggregate(signer: try! PublicAccount(publicKeyHexString: "846B4439154579A5903B1459C9CF69CB8153F6D0110A7A0ED61DE29AE4810BF2", networkType: .mijinTest)) + + let aggregateTx = try! AggregateTransaction.createComplete( + innerTransactions: [transferTx], + networkType: .mijinTest, + deadline: FakeDeadline()) + + var actual = aggregateTx.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } + + func testShouldCreateAggregateTransactionAndSignWithMultipleCosignatories() { + let transferTx = TransferTransaction.create( + recipient: try! Address(rawAddress: "SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC"), + mosaics: [], + message: PlainMessage(text: "test-message"), + networkType: .mijinTest, + deadline: FakeDeadline()) + .toAggregate(signer: try! PublicAccount(publicKeyHexString: "B694186EE4AB0558CA4AFCFDD43B42114AE71094F5A1FC4A913FE9971CACD21D", networkType: .mijinTest)) + + let aggregateTx = try! AggregateTransaction.createComplete( + innerTransactions: [transferTx], + networkType: .mijinTest, + deadline: FakeDeadline()) + + let cosignatoryAccount = try! Account(privateKeyHexString: "2a2b1f5d366a5dd5dc56c3c757cf4fe6c66e2787087692cf329d7a49a594658b", networkType: .mijinTest) + let cosignatoryAccount2 = try! Account(privateKeyHexString: "b8afae6f4ad13a1b8aad047b488e0738a437c7389d4ff30c359ac068910c1d59", networkType: .mijinTest) + + let signedTransaction = cosignatoryAccount.sign(aggregateTransaction: aggregateTx, with: [cosignatoryAccount2]) + + XCTAssertEqual("2d010000", Array(signedTransaction.payload[0..<4]).hexString) + XCTAssertEqual("5100000051000000", Array(signedTransaction.payload[120..<128]).hexString) + //assertEquals("039054419050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E1420D000000746573742D6D65737361676568B3FBB18729C1FDE225C57F8CE080FA828F0067E451A3FD81FA628842B0B763", signedTransaction.getPayload().substring(320, 474)); + } + + func testShouldFindAccountInAsASignerOfTheTransaction() { + let dtoString = "{\"meta\":{\"hash\":\"671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96\",\"height\":[18160,0],\"id\":\"5A0069D83F17CF0001777E55\",\"index\":0,\"merkleComponentHash\":\"81E5E7AE49998802DABC816EC10158D3A7879702FF29084C2C992CD1289877A7\"},\"transaction\":{\"cosignatures\":[{\"signature\":\"5780C8DF9D46BA2BCF029DCC5D3BF55FE1CB5BE7ABCF30387C4637DDEDFC2152703CA0AD95F21BB9B942F3CC52FCFC2064C7B84CF60D1A9E69195F1943156C07\",\"signer\":\"A5F82EC8EBB341427B6785C8111906CD0DF18838FB11B51CE0E18B5E79DFF630\"}],\"deadline\":[3266625578,11],\"fee\":[0,0],\"signature\":\"939673209A13FF82397578D22CC96EB8516A6760C894D9B7535E3A1E068007B9255CFA9A914C97142A7AE18533E381C846B69D2AE0D60D1DC8A55AD120E2B606\",\"signer\":\"7681ED5023141D9CDCF184E5A7B60B7D466739918ED5DA30F7E71EA7B86EFF2D\",\"transactions\":[{\"meta\":{\"aggregateHash\":\"3D28C804EDD07D5A728E5C5FFEC01AB07AFA5766AE6997B38526D36015A4D006\",\"aggregateId\":\"5A0069D83F17CF0001777E55\",\"height\":[18160,0],\"id\":\"5A0069D83F17CF0001777E56\",\"index\":0},\"transaction\":{\"message\":{\"payload\":\"746573742D6D657373616765\",\"type\":0},\"mosaics\":[{\"amount\":[3863990592,95248],\"id\":[3646934825,3576016193]}],\"recipient\":\"9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142\",\"signer\":\"B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF\",\"type\":16724,\"version\":36867}}],\"type\":16705,\"version\":36867}}" + + let decoder = JSONDecoder() + + let decoded = try! decoder.decode(AnyObjectDictionary.self, from: dtoString.data(using: .utf8)!) + + let aggregateTransferTransaction = try! TransactionMapping.apply(decoded) as! AggregateTransaction + + XCTAssertTrue(aggregateTransferTransaction.signedByAccount( + publicAccount: try! PublicAccount(publicKeyHexString: "A5F82EC8EBB341427B6785C8111906CD0DF18838FB11B51CE0E18B5E79DFF630", networkType: .mijinTest))) + + XCTAssertTrue(aggregateTransferTransaction.signedByAccount( + publicAccount: try! PublicAccount(publicKeyHexString: "7681ED5023141D9CDCF184E5A7B60B7D466739918ED5DA30F7E71EA7B86EFF2D", networkType: .mijinTest))) + + XCTAssertFalse(aggregateTransferTransaction.signedByAccount( + publicAccount: try! PublicAccount(publicKeyHexString: "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType: .mijinTest))) + } + +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/CosignatureSignedTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/CosignatureSignedTransactionTest.swift new file mode 100644 index 0000000..cb24dbc --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/CosignatureSignedTransactionTest.swift @@ -0,0 +1,22 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +public class CosignatureSignedTransactionTest: XCTestCase { + + func testCreateACosignatureSignedTransactionViaConstructor() { + let parentHash = Array("parentHash".utf8) + let signature = Array("signature".utf8) + let signer = Array("signer".utf8) + + let cosignatureSignedTransaction = CosignatureSignedTransaction(parentHash: parentHash, signature: signature, signer: signer) + + XCTAssertEqual(parentHash, cosignatureSignedTransaction.parentHash) + XCTAssertEqual(signature, cosignatureSignedTransaction.signature) + XCTAssertEqual(signer, cosignatureSignedTransaction.signer) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/CosignatureTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/CosignatureTransactionTest.swift new file mode 100644 index 0000000..4c1841b --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/CosignatureTransactionTest.swift @@ -0,0 +1,40 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class CosignatureTransactionTest: XCTestCase { + let account = try! Account(privateKeyHexString: "26b64cb10f005e5988a36744ca19e20d835ccc7c105aaa5f3b212da593180930", networkType: .mijinTest) + + func testCreateACosignatureTransactionViaConstructor() { + let dtoString = "{\"meta\":{\"hash\":\"671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96\",\"height\":[18160,0],\"id\":\"5A0069D83F17CF0001777E55\",\"index\":0,\"merkleComponentHash\":\"81E5E7AE49998802DABC816EC10158D3A7879702FF29084C2C992CD1289877A7\"},\"transaction\":{\"cosignatures\":[{\"signature\":\"5780C8DF9D46BA2BCF029DCC5D3BF55FE1CB5BE7ABCF30387C4637DDEDFC2152703CA0AD95F21BB9B942F3CC52FCFC2064C7B84CF60D1A9E69195F1943156C07\",\"signer\":\"A5F82EC8EBB341427B6785C8111906CD0DF18838FB11B51CE0E18B5E79DFF630\"}],\"deadline\":[3266625578,11],\"fee\":[0,0],\"signature\":\"939673209A13FF82397578D22CC96EB8516A6760C894D9B7535E3A1E068007B9255CFA9A914C97142A7AE18533E381C846B69D2AE0D60D1DC8A55AD120E2B606\",\"signer\":\"7681ED5023141D9CDCF184E5A7B60B7D466739918ED5DA30F7E71EA7B86EFF2D\",\"transactions\":[{\"meta\":{\"aggregateHash\":\"3D28C804EDD07D5A728E5C5FFEC01AB07AFA5766AE6997B38526D36015A4D006\",\"aggregateId\":\"5A0069D83F17CF0001777E55\",\"height\":[18160,0],\"id\":\"5A0069D83F17CF0001777E56\",\"index\":0},\"transaction\":{\"message\":{\"payload\":\"746573742D6D657373616765\",\"type\":0},\"mosaics\":[{\"amount\":[3863990592,95248],\"id\":[3646934825,3576016193]}],\"recipient\":\"9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142\",\"signer\":\"B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF\",\"type\":16724,\"version\":36867}}],\"type\":16705,\"version\":36867}}" + + let decoder = JSONDecoder() + + let decoded = try! decoder.decode(AnyObjectDictionary.self, from: dtoString.data(using: .utf8)!) + + let aggregateTransaction = try! TransactionMapping.apply(decoded) as! AggregateTransaction + + let cosignatureTransaction = try! CosignatureTransaction(transactionToCosign: aggregateTransaction) + + let cosignatureSignedTransaction = account.sign(cosignatureTransaction: cosignatureTransaction) + + XCTAssertNotNil(aggregateTransaction.transactionInfo?.hash) + XCTAssertEqual(aggregateTransaction.transactionInfo?.hash, cosignatureSignedTransaction.parentHash) + XCTAssertEqual("bf3bc39f2292c028cb0ffa438a9f567a7c4d793d2f8522c8deac74befbcb61af6414adf27b2176d6a24fef612aa6db2f562176a11c46ba6d5e05430042cb5705".toBytesFromHexString()!, cosignatureSignedTransaction.signature) + XCTAssertEqual("671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96".toBytesFromHexString()!, cosignatureTransaction.transactionToCosign.transactionInfo?.hash) + } + + func testShouldThrowExceptionWhenTransactionToCosignHasNotBeenAnnounced() { + let aggregateTransaction = try! AggregateTransaction.createComplete( + innerTransactions: [], + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + + TestUtils.expectIllegalArgument(message: "Transaction to cosign should be announced before being able to cosign it") { + _ = try CosignatureTransaction(transactionToCosign: aggregateTransaction) + } + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/DeadlineTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/DeadlineTest.swift new file mode 100644 index 0000000..bf32665 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/DeadlineTest.swift @@ -0,0 +1,38 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class DeadlineTest: XCTestCase { + func testShouldCreateADeadlineForTwoHoursFromNow() { + let now = Date() + let deadline = Deadline(fromNow: 2 * 60 * 60) + + + XCTAssertTrue(now < deadline.date) + XCTAssertTrue(Date(timeInterval: 2 * 60 * 60 - 1, since: now) < deadline.date) + XCTAssertTrue(Date(timeInterval: 2 * 60 * 60 + 2, since: now) > deadline.date) + } + + func testNemesisDateIsCorrect() { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy/MM/dd HH:mm:ss" + dateFormatter.timeZone = TimeZone(identifier: "UTC") + + let expectedNemesisDate = dateFormatter.date(from: "2016/04/01 00:00:00")! + + XCTAssertEqual(expectedNemesisDate, Deadline.dateOfNemesisBlock) + } + + func testTimestampIsDurationSecondFromNemesisBlock() { + let deadline = Deadline(fromNow: 0) + + let calculatedDate = Date(timeInterval: TimeInterval(deadline.timestamp / 1000 ), since: Deadline.dateOfNemesisBlock) + + // timestamp's unit is milli second so the calculated date has lower precision. + XCTAssertGreaterThanOrEqual(deadline.date.timeIntervalSince(calculatedDate), 0) + XCTAssertLessThan(deadline.date.timeIntervalSince(calculatedDate), 1) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/FakeDeadline.swift b/Nem2SdkSwiftTests/sdk/model/transaction/FakeDeadline.swift new file mode 100644 index 0000000..81344de --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/FakeDeadline.swift @@ -0,0 +1,16 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +@testable import Nem2SdkSwift + +class FakeDeadline: Deadline { + init() { + super.init(fromNow: 60 * 60) + } + + override var timestamp: UInt64 { + return 1 + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/FakeTransferTransaction.swift b/Nem2SdkSwiftTests/sdk/model/transaction/FakeTransferTransaction.swift new file mode 100644 index 0000000..203dd27 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/FakeTransferTransaction.swift @@ -0,0 +1,24 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import Foundation +@testable import Nem2SdkSwift + +class FakeTransferTransaction: Transaction { + + init(networkType: NetworkType, version: UInt8, deadline: Deadline, fee: UInt64, signature: String? = nil, signer: PublicAccount? = nil, transactionInfo: TransactionInfo? = nil) { + super.init(type: .transfer, + networkType: networkType, + version: version, + deadline: deadline, + fee: fee, + signature: signature, + signer: signer, + transactionInfo: transactionInfo) + } + + override func getTransactionBodyBytes() -> [UInt8] { + fatalError("Method no implemented") + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/HashTypeTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/HashTypeTest.swift new file mode 100644 index 0000000..84ebd84 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/HashTypeTest.swift @@ -0,0 +1,11 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class HashTypeTest: XCTestCase { +} + diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/IdGeneratorTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/IdGeneratorTest.swift new file mode 100644 index 0000000..69645e5 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/IdGeneratorTest.swift @@ -0,0 +1,100 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class IdGeneratorTest: XCTestCase { + + let nemId: UInt64 = 0x84B3552D375FFA4B + let xemId: UInt64 = 0xD525AD41D95FCF29 + + func testNamespacePathGeneratesCorrectWellKnownRootPath() { + let ids = try! IdGenerator.generateNamespacePath(name: "nem") + XCTAssertEqual(ids.count, 1) + XCTAssertEqual(nemId, ids[0]) + } + + func testNamespacePathGeneratesCorrectWellKnownChildPath() { + let ids = try! IdGenerator.generateNamespacePath(name: "nem.xem") + + XCTAssertEqual(ids.count, 2) + XCTAssertEqual(nemId, ids[0]) + XCTAssertEqual(xemId, ids[1]) + } + + func testNamespacePathSupportsMultiLevelNamespaces() { + var ids: [UInt64] = [] + ids.append(IdGenerator.generateId(name: "foo", parentId: 0)) + ids.append(IdGenerator.generateId(name: "bar", parentId: ids[0])) + ids.append(IdGenerator.generateId(name: "baz", parentId: ids[1])) + + XCTAssertEqual(try! IdGenerator.generateNamespacePath(name: "foo.bar.baz"), ids) + } + + + func testNamespacePathRejectsNamesWithTooManyParts() { + TestUtils.expectIllegalArgument(message: "too many parts") { + _ = try IdGenerator.generateNamespacePath(name: "a.b.c.d") + } + TestUtils.expectIllegalArgument(message: "too many parts") { + _ = try IdGenerator.generateNamespacePath(name: "a.b.c.d.e") + } + } + + func testMosaicIdGeneratesCorrectWellKnowId() { + let id = try! IdGenerator.generateMosaicId(namespaceFullName: "nem", mosaicName: "xem") + XCTAssertEqual(xemId, id) + } + + func testMosaicIdSupportMultiLevelMosaics() { + var ids: [UInt64] = [] + ids.append(IdGenerator.generateId(name: "foo", parentId: 0)) + ids.append(IdGenerator.generateId(name: "bar", parentId: ids[0])) + ids.append(IdGenerator.generateId(name: "baz", parentId: ids[1])) + ids.append(IdGenerator.generateId(name: "tokens", parentId: ids[2])) + + XCTAssertEqual(try! IdGenerator.generateMosaicId(namespaceFullName: "foo.bar.baz", mosaicName: "tokens"), ids[3]) + } + + func testNamespaceInvalid() { + let invalidPatterns = [ + "", + "alpha.bet@.zeta", + "a!pha.beta.zeta", + "alpha.beta.ze^a", + ".", + ".a", + "a..a", + "A" + ] + for pattern in invalidPatterns { + TestUtils.expectIllegalArgument(message: "invalid namespace name") { + _ = try IdGenerator.generateNamespacePath(name: pattern) + } + } + } + + func testMosaicInvalid() { + TestUtils.expectIllegalArgument(message: "having zero length") { + _ = try IdGenerator.generateMosaicId(namespaceFullName: "a", mosaicName: "") + } + + let invalidMosaics = [ + "A", + "a..a", + ".", + "@lpha", + "a!pha", + "alph*", + "alp^a", + ] + for mosaicName in invalidMosaics { + TestUtils.expectIllegalArgument(message: "invalid mosaic name") { + _ = try IdGenerator.generateMosaicId(namespaceFullName: "a", mosaicName: mosaicName) + } + } + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/LockFundsTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/LockFundsTransactionTest.swift new file mode 100644 index 0000000..ea35be5 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/LockFundsTransactionTest.swift @@ -0,0 +1,110 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class LockFundsTransactionTest: XCTestCase { + private let account = try! Account(privateKeyHexString: "787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", networkType: .mijinTest) + + + func testSerialization() { + // Generated at nem2-library-js/test/transactions/LockFundsTransaction.spec.js + let expected: [UInt8] = [176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,3,144,76,65,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,41,207,95, + 217,65,173,37,213,128,150,152,0,0,0,0,0,100,0,0,0,0,0,0,0,132, + 152,179,141,137,193,220,138,68,142,165,130,73, + 56,255,130,137,38,205,159,119,71,177,132,75,89,180,182, + 128,126,135,139] + + let signedTransaction = SignedTransaction( + payload: Array("payload".utf8), + hash: "8498B38D89C1DC8A448EA5824938FF828926CD9F7747B1844B59B4B6807E878B".toBytesFromHexString()!, + type: .aggregateBonded) + let lockFunds = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: Decimal(10)), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + var actual = lockFunds.signWith(account: account).payload + // clear signature and signer + for i in 4..<100 { actual[i] = 0 } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } + + func testToAggregate() { + let expected: [UInt8] = [96,0,0,0,-102,73,54,100,6,-84,-87,82,-72,-117,-83,-11,-15,-23,-66,108,-28,-106,-127, + 65,3,90,96,-66,80,50,115,-22,101,69,107,36,3,144,76,65,41,207,95, + 217,65,173,37,213,128,150,152,0,0,0,0,0,100,0,0,0,0,0,0,0,132, + 152,179,141,137,193,220,138,68,142,165,130,73, + 56,255,130,137,38,205,159,119,71,177,132,75,89,180,182, + 128,126,135,139].map { + if $0 < 0 { + return UInt8(bitPattern: Int8($0)) + } else { + return UInt8($0) + } + } + + let signedTransaction = SignedTransaction( + payload: Array("payload".utf8), + hash: "8498B38D89C1DC8A448EA5824938FF828926CD9F7747B1844B59B4B6807E878B".toBytesFromHexString()!, + type: .aggregateBonded) + + let lockFunds = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: Decimal(10)), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + let actual = try! lockFunds.toAggregate(signer: try! PublicAccount(publicKeyHexString: "9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType: .mijinTest)).toAggregateTransactionBytes() + XCTAssertEqual(expected, actual) + } + + func testSerializeAndSignTransaction() { + let signedTransaction = SignedTransaction( + payload: Array("payload".utf8), + hash: "8498B38D89C1DC8A448EA5824938FF828926CD9F7747B1844B59B4B6807E878B".toBytesFromHexString()!, + type: .aggregateBonded) + + let lockFunds = try! LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: Decimal(10)), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + let lockFundsTransactionSigned = lockFunds.signWith(account: account) + XCTAssertEqual("B0000000D079047B87DCEDA0DE68558C1322A453D55D52BDA2778D66C5344BF79EE9E946C731F9ED565E5A854AFC0A1E1476B571940F920F33ADD9BAC245DB46A59794051026D70E1954775749C6811084D6450A3184D977383F0E4282CD47118AF3775503904C410000000000000000010000000000000029CF5FD941AD25D5809698000000000064000000000000008498B38D89C1DC8A448EA5824938FF828926CD9F7747B1844B59B4B6807E878B", lockFundsTransactionSigned.payload.hexString.uppercased()) + XCTAssertEqual("1F8A695B23F595646D43307DE0C6487AC642520FD31ACC6E6F8163AD2DD98B5A", lockFundsTransactionSigned.hash.hexString.uppercased()) + } + + + func testShouldThrowExceptionWhenSignedTransactionIsNotTypeAggregateBonded() { + let signedTransaction = SignedTransaction( + payload: Array("payload".utf8), + hash: "8498B38D89C1DC8A448EA5824938FF828926CD9F7747B1844B59B4B6807E878B".toBytesFromHexString()!, + type: .transfer) + + TestUtils.expectIllegalArgument(message: "Signed transaction must be Aggregate Bonded Transaction") { + _ = try LockFundsTransaction.create( + mosaic: XEM.of(xemAmount: Decimal(10)), + duration: 100, + signedTransaction: signedTransaction, + networkType: .mijinTest, + deadline: FakeDeadline() + ) + } + } +} + diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/ModifyMultisigAccountTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/ModifyMultisigAccountTransactionTest.swift new file mode 100644 index 0000000..6f947e9 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/ModifyMultisigAccountTransactionTest.swift @@ -0,0 +1,55 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class ModifyMultisigAccountTransactionTest: XCTestCase { + + func testCreateAMultisigModificationTransactionViaConstructor() { + let modifyMultisigAccountTransaction = ModifyMultisigAccountTransaction.create( + minApprovalDelta: 2, + minRemovalDelta: 1, + modifications: [MultisigCosignatoryModification(type: .add, cosignatory: try! PublicAccount(publicKeyHexString: "68b3fbb18729c1fde225c57f8ce080fa828f0067e451a3fd81fa628842b0b763", networkType: .mijinTest))], + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + + XCTAssertEqual(NetworkType.mijinTest, modifyMultisigAccountTransaction.networkType) + XCTAssertEqual(3, modifyMultisigAccountTransaction.version) + XCTAssertTrue(Date() < modifyMultisigAccountTransaction.deadline.date) + XCTAssertEqual(0, modifyMultisigAccountTransaction.fee) + + XCTAssertEqual(2, modifyMultisigAccountTransaction.minApprovalDelta) + XCTAssertEqual(1, modifyMultisigAccountTransaction.minRemovalDelta) + + XCTAssertEqual("68b3fbb18729c1fde225c57f8ce080fa828f0067e451a3fd81fa628842b0b763".uppercased(), modifyMultisigAccountTransaction.modifications[0].cosignatory.publicKey.description) + XCTAssertEqual(MultisigCosignatoryModificationType.add, modifyMultisigAccountTransaction.modifications[0].type) + } + + func testSerialization() { + // Generated at nem2-library-js/test/transactions/ModifyMultisigAccountTransaction.spec.js + let expected: [UInt8] = [ 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 144, 85, 65, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 104, 179, 251, 177, 135, 41, 193, 253, 226, 37, 197, 127, 140, 224, 128, 250, 130, 143, 0, 103, 228, 81, 163, 253, 129, 250, 98, 136, 66, 176, 183, 99, 0, 207, 137, 63, 252, 196, 124, 51, 231, 246, 138, 177, 219, 86, 54, 92, 21, 107, 7, 54, 130, 74, 12, 30, 39, 63, 158, 0, 184, 223, 143, 1, 235] + + let modifyMultisigAccountTransaction = ModifyMultisigAccountTransaction.create( + minApprovalDelta: 2, + minRemovalDelta: 1, + modifications: [ + MultisigCosignatoryModification(type: .add, cosignatory: try! PublicAccount(publicKeyHexString: "68b3fbb18729c1fde225c57f8ce080fa828f0067e451a3fd81fa628842b0b763", networkType: .mijinTest)), + MultisigCosignatoryModification(type: .add, cosignatory: try! PublicAccount(publicKeyHexString: "cf893ffcc47c33e7f68ab1db56365c156b0736824a0c1e273f9e00b8df8f01eb", networkType: .mijinTest)) + ], + networkType: .mijinTest, + deadline: FakeDeadline()) + + var actual = modifyMultisigAccountTransaction.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) +} +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/MosaicDefinitionTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/MosaicDefinitionTransactionTest.swift new file mode 100644 index 0000000..3ac60b6 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/MosaicDefinitionTransactionTest.swift @@ -0,0 +1,57 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class MosaicDefinitionTransactionTest: XCTestCase { + + func testCreateAMosaicCreationTransactionViaStaticConstructor() { + let mosaicCreation = try! MosaicDefinitionTransaction.create( + mosaicName: "mosaicname", + namespaceFullName: "namespacename", + mosaicProperties: MosaicProperties(isSupplyMutable: true, isTransferable: false, isLevyMutable: true, divisibility: 3, duration: 10), + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60) + ) + + XCTAssertEqual(NetworkType.mijinTest, mosaicCreation.networkType) + XCTAssertEqual(2, mosaicCreation.version) + XCTAssertEqual("mosaicname", mosaicCreation.mosaicName) + XCTAssertTrue(Date() < mosaicCreation.deadline.date) + XCTAssertEqual(0, mosaicCreation.fee) + XCTAssertEqual(0, mosaicCreation.fee) + XCTAssertEqual(6396233739721801544, mosaicCreation.namespaceId.id) + XCTAssertEqual(UInt64(bitPattern: -5158169874280477899), mosaicCreation.mosaicId.id) + + XCTAssertEqual(true, mosaicCreation.mosaicProperties.isSupplyMutable) + XCTAssertEqual(false, mosaicCreation.mosaicProperties.isTransferable) + XCTAssertEqual(true, mosaicCreation.mosaicProperties.isLevyMutable) + XCTAssertEqual(3, mosaicCreation.mosaicProperties.divisibility) + XCTAssertEqual(10, mosaicCreation.mosaicProperties.duration) + } + + func testSerialization() { + let expected: [UInt8] = [ 156, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 144, 77, 65, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 155, 138, 22, 28, 245, 9, 35, 144, 21, 153, 17, 174, 167, 46, 189, 60, 7, 1, 7, 4, 109, 111, 115, 97, 105, 99, 115, 2, 16, 39, 0, 0, 0, 0, 0, 0] + + let mosaicCreation = try! MosaicDefinitionTransaction.create( + mosaicName: "mosaics", + namespaceFullName: "sname", + mosaicProperties: MosaicProperties(isSupplyMutable: true, isTransferable: true, isLevyMutable: true, divisibility: 4, duration: 10000), + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + + var actual = mosaicCreation.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/MosaicSupplyChangeTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/MosaicSupplyChangeTransactionTest.swift new file mode 100644 index 0000000..d6ece39 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/MosaicSupplyChangeTransactionTest.swift @@ -0,0 +1,49 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +class MosaicSupplyChangeTransactionTest: XCTestCase { + + func testCreateAMosaicSupplyChangeTransactionViaConstructor() { + let mosaicSupplyChangeTx = MosaicSupplyChangeTransaction.create( + mosaicId: MosaicId(id: 6300565133566699912), + mosaicSupplyType: .increase, + delta: 10, + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + + XCTAssertEqual(NetworkType.mijinTest, mosaicSupplyChangeTx.networkType) + XCTAssertEqual(2, mosaicSupplyChangeTx.version) + XCTAssertTrue(Date() < mosaicSupplyChangeTx.deadline.date) + XCTAssertEqual(0, mosaicSupplyChangeTx.fee) + + XCTAssertEqual(6300565133566699912, mosaicSupplyChangeTx.mosaicId.id) + XCTAssertEqual(MosaicSupplyType.increase, mosaicSupplyChangeTx.mosaicSupplyType) + XCTAssertEqual(10, mosaicSupplyChangeTx.delta) + } + + func testSerialization() { + // Generated at nem2-library-js/test/transactions/MosaicSupplyChangeTransaction.spec.js + let expected: [UInt8] = [137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 2,144,77,66,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,136,105,116,110,155,26,112,87,1,10,0,0,0,0,0,0,0] + + let mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create( + mosaicId: MosaicId(id: 6300565133566699912), + mosaicSupplyType: .increase, + delta: 10, + networkType: .mijinTest, + deadline: FakeDeadline()) + + var actual = mosaicSupplyChangeTransaction.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/RegisterNamespaceTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/RegisterNamespaceTransactionTest.swift new file mode 100644 index 0000000..dde9e57 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/RegisterNamespaceTransactionTest.swift @@ -0,0 +1,85 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +class RegisterNamespaceTransactionTest: XCTestCase { + + func testCreateANamespaceCreationRootNamespaceTransactionViaStaticConstructor() { + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createRootNamespace( + namespaceName: "newnamespace", + duration: 2000, + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + + XCTAssertEqual(NetworkType.mijinTest, registerNamespaceTransaction.networkType) + XCTAssertEqual(2, registerNamespaceTransaction.version) + XCTAssertTrue(Date() < registerNamespaceTransaction.deadline.date) + XCTAssertEqual(0, registerNamespaceTransaction.fee) + XCTAssertEqual("newnamespace", registerNamespaceTransaction.namespaceName) + XCTAssertEqual(NamespaceType.rootNamespace, registerNamespaceTransaction.namespaceType) + XCTAssertEqual(4635294387305441662, registerNamespaceTransaction.namespaceId.id) + XCTAssertEqual(2000, registerNamespaceTransaction.duration) + } + + func testCreateANamespaceCreationSubNamespaceTransactionViaStaticConstructor() { + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createSubNamespace( + namespaceName: "newnamespace", + parentId: NamespaceId(id: 4635294387305441662), + networkType: .mijinTest, + deadline: Deadline(fromNow: 2 * 60 * 60)) + + + XCTAssertEqual(NetworkType.mijinTest, registerNamespaceTransaction.networkType) + XCTAssertEqual(2, registerNamespaceTransaction.version) + XCTAssertTrue(Date() < registerNamespaceTransaction.deadline.date) + XCTAssertEqual(0, registerNamespaceTransaction.fee) + XCTAssertEqual("newnamespace", registerNamespaceTransaction.namespaceName) + XCTAssertEqual(NamespaceType.subNamespace, registerNamespaceTransaction.namespaceType) + XCTAssertEqual(UInt64(bitPattern: -7487193294859220686), registerNamespaceTransaction.namespaceId.id) + XCTAssertEqual(4635294387305441662, registerNamespaceTransaction.parentId?.id) + } + + func testSerializationRootNamespace() { + // Generated at nem2-library-js/test/transactions/RegisterNamespaceTransaction.spec.js + let expected: [UInt8] = [150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 2, 144, 78, 65, 0, 0, 0, 0, 0, 0, 0, 0,1,0,0,0,0,0,0,0,0,16,39,0,0,0,0,0,0,126,233,179,184,175,223,83,64,12,110,101,119,110,97,109,101,115,112,97,99,101] + + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createRootNamespace( + namespaceName: "newnamespace", + duration: 10000, + networkType: .mijinTest, + deadline: FakeDeadline()) + + var actual = registerNamespaceTransaction.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } + + func testSerializationSubNamespace() { + // Generated at nem2-library-js/test/transactions/RegisterNamespaceTransaction.spec.js + let expected: [UInt8] = [150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 2,144,78,65,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,126,233,179,184,175,223,83,64,3,18,152,27,120,121,163,113,12,115,117,98,110,97,109,101,115,112,97,99,101] + + let registerNamespaceTransaction = try! RegisterNamespaceTransaction.createSubNamespace( + namespaceName: "subnamespace", + parentId: NamespaceId(id: 4635294387305441662), + networkType: .mijinTest, + deadline: FakeDeadline()) + + var actual = registerNamespaceTransaction.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + +} +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/SecretLockTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/SecretLockTransactionTest.swift new file mode 100644 index 0000000..467d25e --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/SecretLockTransactionTest.swift @@ -0,0 +1,94 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class SecretLockTransactionTest: XCTestCase { + let account = try! Account(privateKeyHexString: "787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", networkType: .mijinTest) + + + func testSerialization() { + // Generated at nem2-library-js/test/transactions/SecretLockTransaction.spec.js + let expected: [UInt8] = [234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,3,144,76,66,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,41,207, + 95,217,65,173,37,213,128,150,152,0,0,0,0,0,100,0,0,0,0,0,0,0,0,183,120, + 163,154,54,99,113,157,252,94,72,201,215,132,49,177,228,92,42,249,223,83,135,130,191,25,156,24, + 157,171,234,199,104,10,218,87,220,236,142,238,145,196,227,191,59,250,154,246,255, + 222,144,205,29,36,157,28,97,33,215,183,89,160,1,177,144,232,254,189,103,29,212,27,238,148, + 236,59,165,131,28,182,8,163,18,194,242,3,186,132,172] + + let secret = "b778a39a3663719dfc5e48c9d78431b1e45c2af9df538782bf199c189dabeac7680ada57dcec8eee91c4e3bf3bfa9af6ffde90cd1d249d1c6121d7b759a001b1".toBytesFromHexString()! + let secretLock = SecretLockTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + var actual = secretLock.signWith(account: Account(networkType: .mijinTest)).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } + + func testToAggregate() { + let expected: [UInt8] = [-102,0,0,0,-102,73,54,100,6,-84,-87,82,-72,-117,-83,-11,-15,-23,-66,108,-28,-106,-127, + 65,3,90,96,-66,80,50,115,-22,101,69,107,36,3,144,76,66,41,207, + 95,217,65,173,37,213,128,150,152,0,0,0,0,0,100,0,0,0,0,0,0,0,0,183,120, + 163,154,54,99,113,157,252,94,72,201,215,132,49,177,228,92,42,249,223,83,135,130,191,25,156,24, + 157,171,234,199,104,10,218,87,220,236,142,238,145,196,227,191,59,250,154,246,255, + 222,144,205,29,36,157,28,97,33,215,183,89,160,1,177,144,232,254,189,103,29,212,27,238,148, + 236,59,165,131,28,182,8,163,18,194,242,3,186,132,172].map { + if $0 < 0 { + return UInt8(bitPattern: Int8($0)) + } else { + return UInt8($0) + } + } + + let secret = "b778a39a3663719dfc5e48c9d78431b1e45c2af9df538782bf199c189dabeac7680ada57dcec8eee91c4e3bf3bfa9af6ffde90cd1d249d1c6121d7b759a001b1".toBytesFromHexString()! + let secretLock = SecretLockTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + + let actual = try! secretLock.toAggregate(signer: try! PublicAccount(publicKeyHexString: "9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType: .mijinTest)).toAggregateTransactionBytes() + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } + + func testSerializeAndSignTransaction() { + let secret = "b778a39a3663719dfc5e48c9d78431b1e45c2af9df538782bf199c189dabeac7680ada57dcec8eee91c4e3bf3bfa9af6ffde90cd1d249d1c6121d7b759a001b1".toBytesFromHexString()! + let secretLock = SecretLockTransaction.create( + mosaic: XEM.of(xemAmount: 10), + duration: 100, + hashType: .sha3_512, + secret: secret, + recipient: try! Address(rawAddress: "SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM"), + networkType: .mijinTest, + deadline: FakeDeadline() + ) + + + let signedTransaction = secretLock.signWith(account: account); + XCTAssertEqual("EA0000005A3B75AE172855381353250EA9A1DFEB86E9280C0006B8FD997C2FCECF211C9A260E76CB704A22EAD4648F18E6931381921A4EDC7D309C32275D0147E9BAD3051026D70E1954775749C6811084D6450A3184D977383F0E4282CD47118AF3775503904C420000000000000000010000000000000029CF5FD941AD25D58096980000000000640000000000000000B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7680ADA57DCEC8EEE91C4E3BF3BFA9AF6FFDE90CD1D249D1C6121D7B759A001B190E8FEBD671DD41BEE94EC3BA5831CB608A312C2F203BA84AC", signedTransaction.payload.hexString.uppercased()) + XCTAssertEqual("B3AF46027909CD24204AF4E7B5B43C3116307D90A1F83A5DE6DBDF1F7759ABC5", signedTransaction.hash.hexString.uppercased()) + } +} + + diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/SecretProofTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/SecretProofTransactionTest.swift new file mode 100644 index 0000000..72d64f4 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/SecretProofTransactionTest.swift @@ -0,0 +1,84 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + + +public class SecretProofTransactionTest: XCTestCase { + let account = try! Account(privateKeyHexString: "787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", networkType: .mijinTest) + + func testSerialization() { + // Generated at nem2-library-js/test/transactions/SecretProofTransaction.spec.js + let expected: [UInt8] = [191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, 144, 76, 67, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 183, 120, 163, 154, 54, + 99, 113, 157, 252, 94, 72, 201, 215, 132, 49, 177, 228, 92, 42, 249, + 223, 83, 135, 130, 191, 25, 156, 24, 157, 171, 234, 199, 104, + 10, 218, 87, 220, 236, 142, 238, 145, 196, 227, 191, 59, 250, + 154, 246, 255, 222, 144, 205, 29, 36, 157, 28, 97, 33, 215, 183, 89, + 160, 1, 177, 4, 0, 154, 73, 54, 100] + + let secret = "b778a39a3663719dfc5e48c9d78431b1e45c2af9df538782bf199c189dabeac7680ada57dcec8eee91c4e3bf3bfa9af6ffde90cd1d249d1c6121d7b759a001b1".toBytesFromHexString()! + let secretSeed = "9a493664".toBytesFromHexString()! + let secretProof = SecretProofTransaction.create(hashType: .sha3_512, + secret: secret, + proof: secretSeed, + networkType: .mijinTest, + deadline: FakeDeadline()) + + var actual = secretProof.signWith(account: account).payload + // clear signature and signer + for i in 4..<100 { + actual[i] = 0 + } + XCTAssertEqual(expected.count, actual.count) + XCTAssertEqual(expected, actual) + } + + func testToAggregate() { + let expected: [UInt8] = [111,0,0,0,-102,73,54,100,6,-84,-87,82,-72,-117,-83,-11,-15,-23,-66,108,-28,-106,-127, + 65,3,90,96,-66,80,50,115,-22,101,69,107,36,3,144,76,67,0,183,120,163,154,54, + 99,113,157,252,94,72,201,215,132,49,177,228,92,42,249, + 223,83,135,130,191,25,156,24,157,171,234,199,104, + 10,218,87,220,236,142,238,145,196,227,191,59,250, + 154,246,255,222,144,205,29,36,157,28,97,33,215,183,89, + 160,1,177,4,0,154,73,54,100].map { + if $0 < 0 { + return UInt8(bitPattern: Int8($0)) + } else { + return UInt8($0) + } + } + let secret = "b778a39a3663719dfc5e48c9d78431b1e45c2af9df538782bf199c189dabeac7680ada57dcec8eee91c4e3bf3bfa9af6ffde90cd1d249d1c6121d7b759a001b1".toBytesFromHexString()! + let secretSeed = "9a493664".toBytesFromHexString()! + + let secretProof = SecretProofTransaction.create( + hashType: .sha3_512, + secret: secret, + proof: secretSeed, + networkType: .mijinTest, + deadline: FakeDeadline()) + + let actual = try! secretProof.toAggregate(signer:try! PublicAccount(publicKeyHexString: "9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType: .mijinTest)).toAggregateTransactionBytes() + XCTAssertEqual(expected, actual) + } + + func testSerializeAndSignTransaction() { + let secret = "b778a39a3663719dfc5e48c9d78431b1e45c2af9df538782bf199c189dabeac7680ada57dcec8eee91c4e3bf3bfa9af6ffde90cd1d249d1c6121d7b759a001b1".toBytesFromHexString()! + let secretSeed = "9a493664".toBytesFromHexString()! + let secretProof = SecretProofTransaction.create( + hashType: .sha3_512, + secret: secret, + proof: secretSeed, + networkType: .mijinTest, + deadline: FakeDeadline()) + + let signedTransaction = secretProof.signWith(account: account) + + XCTAssertEqual("BF000000147827E5FDAB2201ABD3663964B0493166DA7DD18497718F53DF09AAFC55271B57A9E81B4E2F627FD19E9E9B77283D1620FB8E9E32BAC5AC265EB0B43C75B4071026D70E1954775749C6811084D6450A3184D977383F0E4282CD47118AF3775503904C430000000000000000010000000000000000B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7680ADA57DCEC8EEE91C4E3BF3BFA9AF6FFDE90CD1D249D1C6121D7B759A001B104009A493664", signedTransaction.payload.hexString.uppercased()) + XCTAssertEqual("1169864A7290940854D87C8818625A7A498E6550D19F9BFAF5BA7BEFEB9206D0", signedTransaction.hash.hexString.uppercased()) + } +} + diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/SignedTransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/SignedTransactionTest.swift new file mode 100644 index 0000000..1f88d9d --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/SignedTransactionTest.swift @@ -0,0 +1,19 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class SignedTransactionTest: XCTestCase { + + func testCreateASignedTransactionViaConstructor() { + let payload = Array("payload".utf8) + let hash = Array("hash".utf8) + let signedTransaction = SignedTransaction(payload: payload, hash: hash, type: .transfer) + + XCTAssertEqual(payload, signedTransaction.payload) + XCTAssertEqual(hash, signedTransaction.hash) + XCTAssertEqual(TransactionType.transfer, signedTransaction.type) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/TransactionInfoTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/TransactionInfoTest.swift new file mode 100644 index 0000000..6362abe --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/TransactionInfoTest.swift @@ -0,0 +1,57 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class TransactionInfoTest: XCTestCase { + func testCreateATransactionInfoWithStaticConstructorCreateForTransactionsGetUsingListener() { + let transactionInfo = TransactionInfo.create( + height: 121855, + hash: "B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2F".toBytesFromHexString()!, + merkleComponentHash: "B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2E".toBytesFromHexString()!) + + XCTAssertEqual(121855, transactionInfo.height) + XCTAssertNil(transactionInfo.index) + XCTAssertNil(transactionInfo.id) + XCTAssertEqual("B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2F".toBytesFromHexString()!, transactionInfo.hash) + XCTAssertEqual("B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2E".toBytesFromHexString()!, transactionInfo.merkleComponentHash) + XCTAssertNil(transactionInfo.aggregateHash) + XCTAssertNil(transactionInfo.aggregateId) + } + + func testCreateATransactionInfoWithStaticConstructorCreateForStandaloneTransactions() { + let transactionInfo = TransactionInfo.create( + height: 121855, + index: 1, + id: "5A3D23889CD1E800015929A9", + hash: "B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2F".toBytesFromHexString()!, + merkleComponentHash: "B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2E".toBytesFromHexString()!) + + XCTAssertEqual(121855, transactionInfo.height) + XCTAssertEqual(1, transactionInfo.index) + XCTAssertEqual("5A3D23889CD1E800015929A9", transactionInfo.id) + XCTAssertEqual("B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2F".toBytesFromHexString()!, transactionInfo.hash) + XCTAssertEqual("B6C7648A3DDF71415650805E9E7801424FE03BBEE7D21F9C57B60220D3E95B2E".toBytesFromHexString()!, transactionInfo.merkleComponentHash) + XCTAssertNil(transactionInfo.aggregateHash) + XCTAssertNil(transactionInfo.aggregateId) + } + + func testCreateATransactionInfoWithStaticConstructorCreateForAggregateInnerTransactions() { + let transactionInfo = TransactionInfo.createAggregate( + height: 121855, + index: 1, + id: "5A3D23889CD1E800015929A9", + aggregateHash: "3D28C804EDD07D5A728E5C5FFEC01AB07AFA5766AE6997B38526D36015A4D006".toBytesFromHexString()!, + aggregateId: "5A0069D83F17CF0001777E55") + + XCTAssertEqual(121855, transactionInfo.height) + XCTAssertEqual(1, transactionInfo.index) + XCTAssertEqual("5A3D23889CD1E800015929A9", transactionInfo.id) + XCTAssertNil(transactionInfo.hash) + XCTAssertNil(transactionInfo.merkleComponentHash) + XCTAssertEqual("3D28C804EDD07D5A728E5C5FFEC01AB07AFA5766AE6997B38526D36015A4D006".toBytesFromHexString(), transactionInfo.aggregateHash) + XCTAssertEqual("5A0069D83F17CF0001777E55", transactionInfo.aggregateId) + } +} \ No newline at end of file diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/TransactionMappingTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/TransactionMappingTest.swift new file mode 100644 index 0000000..7516a76 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/TransactionMappingTest.swift @@ -0,0 +1,468 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +private extension UInt64 { + var separated: String { + return "[\(self & 0xFFFFFFFF),\((self >> 32) & 0xFFFFFFFF)]" + } +} + +public class TransactionMappingTest: XCTestCase { + let commonHash = "18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219".toBytesFromHexString()! + let commonHeight: UInt64 = 0x01 + let commonId = "59FDA0733F17CF0001772CA7" + let commonIndex = 19 + let commonMerkleComponentHash = "18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219".toBytesFromHexString()! + let commonDeadline: UInt64 = 10000 + let commonFee: UInt64 = 0 + let commonSignature = "553E696EB4A54E43A11D180EBA57E4B89D0048C9DD2604A9E0608120018B9E02F6EE63025FEEBCED3293B622AF8581334D0BDAB7541A9E7411E7EE4EF0BC5D0E" + let commonSigner = "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF" + let commonVersion: UInt16 = 36867 + + let innerAggregateHash = "3D28C804EDD07D5A728E5C5FFEC01AB07AFA5766AE6997B38526D36015A4D006".toBytesFromHexString()! + let innerAggregateId = "5A0069D83F17CF0001777E55" + let innerHeight: UInt64 = 18160 + let innerId = "5A0069D83F17CF0001777E56" + let innerIndex = 0 + let innerSigner = "B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF" + let innerVersion: UInt16 = 36867 + + func createDto(_ type: UInt16, _ customFields: String) -> String{ + return """ + { + "meta": { + "hash":"\(commonHash.hexString.uppercased())", + "height":\(commonHeight.separated), + "id":"\(commonId)", + "index":\(commonIndex), + "merkleComponentHash":"\(commonMerkleComponentHash.hexString.uppercased())" + }, + "transaction": { + "deadline":\(commonDeadline.separated), + "fee": \(commonFee.separated), + "signature": "\(commonSignature)", + "signer": "\(commonSigner)", + "type": \(type), + "version": \(commonVersion), + \(customFields) + } + } +""" + } + + + func decode (_ dtoString: String) -> T{ + let decoder = JSONDecoder() + let dto = try! decoder.decode(AnyObjectDictionary.self, from: dtoString.data(using: .utf8)!) + let transaction = try! TransactionMapping.apply(dto) + return transaction as! T + } + + func validateCommonFields(_ type: UInt16, _ transaction: Transaction) { + XCTAssertEqual(commonHash, transaction.transactionInfo?.hash) + XCTAssertEqual(commonHeight, transaction.transactionInfo?.height) + XCTAssertEqual(commonId, transaction.transactionInfo?.id) + XCTAssertEqual(commonIndex, transaction.transactionInfo?.index) + XCTAssertEqual(commonMerkleComponentHash, transaction.transactionInfo?.merkleComponentHash) + XCTAssertEqual(commonDeadline, transaction.deadline.timestamp) + XCTAssertEqual(commonFee, transaction.fee) + XCTAssertEqual(commonSignature, transaction.signature!) + XCTAssertEqual(commonSigner, transaction.signer!.publicKey.description) + XCTAssertEqual(type, transaction.type.rawValue) + XCTAssertEqual(commonVersion, UInt16(transaction.networkType.rawValue) << 8 + UInt16(transaction.version)) + } + + func createAggregateDto(_ type: UInt16, _ customFields: String) -> String { + return """ + { + "meta": { + "hash":"\(commonHash.hexString.uppercased())", + "height":\(commonHeight.separated), + "id":"\(commonId)", + "index":\(commonIndex), + "merkleComponentHash":"\(commonMerkleComponentHash.hexString.uppercased())" + }, + "transaction": { + "cosignatures": [ + { + "signature":"5780C8DF9D46BA2BCF029DCC5D3BF55FE1CB5BE7ABCF30387C4637DDEDFC2152703CA0AD95F21BB9B942F3CC52FCFC2064C7B84CF60D1A9E69195F1943156C07", + "signer":"A5F82EC8EBB341427B6785C8111906CD0DF18838FB11B51CE0E18B5E79DFF630" + } + ], + "deadline":\(commonDeadline.separated), + "fee": \(commonFee.separated), + "signature": "\(commonSignature)", + "signer": "\(commonSigner)", + "transactions": [ + { + "meta": { + "aggregateHash":"\(innerAggregateHash.hexString.uppercased())", + "aggregateId":"\(innerAggregateId)", + "height":\(innerHeight.separated), + "id":"\(innerId)", + "index": \(innerIndex) + }, + "transaction": { + "signer":"\(innerSigner)", + "type":\(type), + "version": \(innerVersion), + \(customFields) + } + } + ], + "type":16705, + "version": \(commonVersion), + } + } +""" + } + + func validateAggregateFields(_ type: UInt16, _ transaction: AggregateTransaction) { + XCTAssertEqual(commonHash, transaction.transactionInfo?.hash) + XCTAssertEqual(commonHeight, transaction.transactionInfo?.height) + XCTAssertEqual(commonId, transaction.transactionInfo?.id) + XCTAssertEqual(commonIndex, transaction.transactionInfo?.index) + XCTAssertEqual(commonMerkleComponentHash, transaction.transactionInfo?.merkleComponentHash) + XCTAssertEqual(commonDeadline, transaction.deadline.timestamp) + XCTAssertEqual(commonFee, transaction.fee) + XCTAssertEqual(commonSignature, transaction.signature!) + XCTAssertEqual(commonSigner, transaction.signer!.publicKey.description) + XCTAssertEqual(TransactionType.aggregateComplete, transaction.type) + XCTAssertEqual(commonVersion, UInt16(transaction.networkType.rawValue) << 8 + UInt16(transaction.version)) + + XCTAssertEqual(1, transaction.innerTransactions.count) + + let innerTransaction = transaction.innerTransactions[0] + + XCTAssertEqual(innerAggregateHash, innerTransaction.transactionInfo!.aggregateHash) + XCTAssertEqual(innerAggregateId, innerTransaction.transactionInfo!.aggregateId) + XCTAssertEqual(innerHeight, innerTransaction.transactionInfo!.height) + XCTAssertEqual(innerId, innerTransaction.transactionInfo!.id) + XCTAssertEqual(innerSigner, innerTransaction.signer?.publicKey.description) + XCTAssertEqual(innerVersion, UInt16(innerTransaction.networkType.rawValue) << 8 + UInt16(innerTransaction.version)) + XCTAssertEqual(type, innerTransaction.type.rawValue) + } + + func testShouldCreateStandaloneTransferTransaction() { + let messagePayload = "746573742D6D657373616765" + let messageType: UInt8 = 0 + let amount = "[3863990592,95248]" + let mosaicId = "[3646934825,3576016193]" + let recipient = "9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142" + let type: UInt16 = 16724 + let customFields = """ + "message": { + "payload": "\(messagePayload)", + "type": \(messageType) + }, + "mosaics": [ + { + "amount": \(amount), + "id": \(mosaicId) + } + ], + "recipient": "\(recipient)" +""" + let dtoString = createDto(type, customFields) + let transaction: TransferTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + XCTAssertEqual(messagePayload, transaction.message!.payload.hexString.uppercased()) + XCTAssertEqual(messageType, transaction.message!.type) + XCTAssertEqual(amount, transaction.mosaics[0].amount.separated) + XCTAssertEqual(mosaicId, transaction.mosaics[0].id.id.separated) + XCTAssertEqual(recipient, transaction.recipient.bytes.hexString.uppercased()) + } + + + func testShouldCreateAggregateTransferTransaction() { + let messagePayload = "746573742D6D657373616765" + let messageType: UInt8 = 0 + let amount = "[3863990592,95248]" + let mosaicId = "[3646934825,3576016193]" + let recipient = "9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142" + let type: UInt16 = 16724 + let customFields = """ + "message": { + "payload": "\(messagePayload)", + "type": \(messageType) + }, + "mosaics": [ + { + "amount": \(amount), + "id": \(mosaicId) + } + ], + "recipient": "\(recipient)" +""" + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! TransferTransaction + + validateAggregateFields(type, aggregate) + XCTAssertEqual(messagePayload, transaction.message!.payload.hexString.uppercased()) + XCTAssertEqual(messageType, transaction.message!.type) + XCTAssertEqual(amount, transaction.mosaics[0].amount.separated) + XCTAssertEqual(mosaicId, transaction.mosaics[0].id.id.separated) + XCTAssertEqual(recipient, transaction.recipient.bytes.hexString.uppercased()) + } + + func testShouldCreateStandaloneRootNamespaceCreationTransaction() { + let type: UInt16 = 16718 + let customFields = "\"duration\":[1000,0],\"name\":\"a2p1mg\",\"namespaceId\":[437145074,4152736179],\"namespaceType\":0" + let dtoString = createDto(type, customFields) + let transaction: RegisterNamespaceTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual(1000, transaction.duration!) + XCTAssertEqual("a2p1mg", transaction.namespaceName) + XCTAssertEqual("[437145074,4152736179]", transaction.namespaceId.id.separated) + XCTAssertEqual(0, transaction.namespaceType.rawValue) + } + + func testShouldCreateAggregateRootNamespaceCreationTransaction() { + let type: UInt16 = 16718 + let customFields = "\"duration\":[1000,0],\"name\":\"a2p1mg\",\"namespaceId\":[437145074,4152736179],\"namespaceType\":0" + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! RegisterNamespaceTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual(1000, transaction.duration!) + XCTAssertEqual("a2p1mg", transaction.namespaceName) + XCTAssertEqual("[437145074,4152736179]", transaction.namespaceId.id.separated) + XCTAssertEqual(0, transaction.namespaceType.rawValue) + } + + + func testShouldCreateStandaloneSubNamespaceCreationTransaction() { + let type: UInt16 = 16718 + let customFields = "\"name\":\"0unius\",\"namespaceId\":[1970060410,3289875941],\"namespaceType\":1,\"parentId\":[3316183705,3829351378]" + let dtoString = createDto(type, customFields) + let transaction: RegisterNamespaceTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual("[3316183705,3829351378]", transaction.parentId!.id.separated) + XCTAssertEqual("0unius", transaction.namespaceName) + XCTAssertEqual("[1970060410,3289875941]", transaction.namespaceId.id.separated) + XCTAssertEqual(1, transaction.namespaceType.rawValue) + } + + func testShouldCreateAggregateSubNamespaceCreationTransaction() { + let type: UInt16 = 16718 + let customFields = "\"name\":\"0unius\",\"namespaceId\":[1970060410,3289875941],\"namespaceType\":1,\"parentId\":[3316183705,3829351378]" + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! RegisterNamespaceTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual("[3316183705,3829351378]", transaction.parentId!.id.separated) + XCTAssertEqual("0unius", transaction.namespaceName) + XCTAssertEqual("[1970060410,3289875941]", transaction.namespaceId.id.separated) + XCTAssertEqual(1, transaction.namespaceType.rawValue) + } + + func testShouldCreateStandaloneMosaicCreationTransaction() { + let type: UInt16 = 16717 + let customFields = "\"mosaicId\":[3248159581,740240531],\"name\":\"ie7rfaqxiorum1jor\",\"parentId\":[3316183705,3829351378],\"properties\":[{\"id\":0,\"value\":[7,0]},{\"id\":1,\"value\":[6,0]},{\"id\":2,\"value\":[1000,0]}]" + let dtoString = createDto(type, customFields) + let transaction: MosaicDefinitionTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual("[3248159581,740240531]", transaction.mosaicId.id.separated) + XCTAssertEqual("ie7rfaqxiorum1jor", transaction.mosaicName) + XCTAssertEqual("[3316183705,3829351378]", transaction.namespaceId.id.separated) + XCTAssertEqual(true, transaction.mosaicProperties.isLevyMutable) + XCTAssertEqual(true, transaction.mosaicProperties.isTransferable) + XCTAssertEqual(true, transaction.mosaicProperties.isSupplyMutable) + XCTAssertEqual(6, transaction.mosaicProperties.divisibility) + XCTAssertEqual(1000, transaction.mosaicProperties.duration) + } + + func testShouldCreateAggregateMosaicCreationTransaction() { + let type: UInt16 = 16717 + let customFields = "\"mosaicId\":[3248159581,740240531],\"name\":\"ie7rfaqxiorum1jor\",\"parentId\":[3316183705,3829351378],\"properties\":[{\"id\":0,\"value\":[7,0]},{\"id\":1,\"value\":[6,0]},{\"id\":2,\"value\":[1000,0]}]" + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! MosaicDefinitionTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual("[3248159581,740240531]", transaction.mosaicId.id.separated) + XCTAssertEqual("ie7rfaqxiorum1jor", transaction.mosaicName) + XCTAssertEqual("[3316183705,3829351378]", transaction.namespaceId.id.separated) + XCTAssertEqual(true, transaction.mosaicProperties.isLevyMutable) + XCTAssertEqual(true, transaction.mosaicProperties.isTransferable) + XCTAssertEqual(true, transaction.mosaicProperties.isSupplyMutable) + XCTAssertEqual(6, transaction.mosaicProperties.divisibility) + XCTAssertEqual(1000, transaction.mosaicProperties.duration) + + } + + func testShouldCreateStandaloneMosaicSupplyChangeTransaction() { + let type: UInt16 = 16973 + let customFields = "\"delta\":[100000,0],\"direction\":1,\"mosaicId\":[3070467832,2688515262]" + let dtoString = createDto(type, customFields) + let transaction: MosaicSupplyChangeTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual(100000, transaction.delta) + XCTAssertEqual(1, transaction.mosaicSupplyType.rawValue) + XCTAssertEqual("[3070467832,2688515262]", transaction.mosaicId.id.separated) + } + + func testShouldCreateAggregateMosaicSupplyChangeTransaction() { + let type: UInt16 = 16973 + let customFields = "\"delta\":[100000,0],\"direction\":1,\"mosaicId\":[3070467832,2688515262]" + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! MosaicSupplyChangeTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual(100000, transaction.delta) + XCTAssertEqual(1, transaction.mosaicSupplyType.rawValue) + XCTAssertEqual("[3070467832,2688515262]", transaction.mosaicId.id.separated) + + } + + func testShouldCreateStandaloneMultisigModificationTransaction() { + let type: UInt16 = 16725 + let customFields = "\"minApprovalDelta\":1,\"minRemovalDelta\":1,\"modifications\":[{\"cosignatoryPublicKey\":\"589B73FBC22063E9AE6FBAC67CB9C6EA865EF556E5FB8B7310D45F77C1250B97\",\"type\":0}]" + let dtoString = createDto(type, customFields) + let transaction: ModifyMultisigAccountTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual(1, transaction.minApprovalDelta) + XCTAssertEqual(1, transaction.minRemovalDelta) + XCTAssertEqual(1, transaction.modifications.count) + XCTAssertEqual(0, transaction.modifications[0].type.rawValue) + XCTAssertEqual("589B73FBC22063E9AE6FBAC67CB9C6EA865EF556E5FB8B7310D45F77C1250B97", transaction.modifications[0].cosignatory.publicKey.description.uppercased()) + } + + func testShouldCreateAggregateMultisigModificationTransaction() { + let type: UInt16 = 16725 + let customFields = "\"minApprovalDelta\":1,\"minRemovalDelta\":1,\"modifications\":[{\"cosignatoryPublicKey\":\"589B73FBC22063E9AE6FBAC67CB9C6EA865EF556E5FB8B7310D45F77C1250B97\",\"type\":0}]" + let dtoString = createAggregateDto(type, customFields) + + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! ModifyMultisigAccountTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual(1, transaction.minApprovalDelta) + XCTAssertEqual(1, transaction.minRemovalDelta) + XCTAssertEqual(1, transaction.modifications.count) + XCTAssertEqual(0, transaction.modifications[0].type.rawValue) + XCTAssertEqual("589B73FBC22063E9AE6FBAC67CB9C6EA865EF556E5FB8B7310D45F77C1250B97", transaction.modifications[0].cosignatory.publicKey.description.uppercased()) + } + + func testShouldCreateStandaloneLockFundsTransaction() { + let type: UInt16 = 16716 + + let customFields = "\"duration\": [100,0],\"mosaicId\": [3646934825,3576016193],\"amount\": [10000000,0], \"hash\": \"49E9F58867FB9399F32316B99CCBC301A5790E5E0605E25F127D28CEF99740A3\"" + let dtoString = createDto(type, customFields) + let transaction: LockFundsTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual("[3646934825,3576016193]", transaction.mosaic.id.id.separated) + XCTAssertEqual("49E9F58867FB9399F32316B99CCBC301A5790E5E0605E25F127D28CEF99740A3", transaction.signedTransaction.hash.hexString.uppercased()) + XCTAssertEqual(10000000, transaction.mosaic.amount) + XCTAssertEqual(100, transaction.duration) + } + + func testShouldCreateAggregateLockFundsTransaction() { + let type: UInt16 = 16716 + + let customFields = "\"duration\": [100,0],\"mosaicId\": [3646934825,3576016193],\"amount\": [10000000,0], \"hash\": \"49E9F58867FB9399F32316B99CCBC301A5790E5E0605E25F127D28CEF99740A3\"" + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! LockFundsTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual("[3646934825,3576016193]", transaction.mosaic.id.id.separated) + XCTAssertEqual("49E9F58867FB9399F32316B99CCBC301A5790E5E0605E25F127D28CEF99740A3", transaction.signedTransaction.hash.hexString.uppercased()) + XCTAssertEqual(10000000, transaction.mosaic.amount) + XCTAssertEqual(100, transaction.duration) + + } + + func testShouldCreateStandaloneSecretLockTransaction() { + let type: UInt16 = 16972 + let customFields = "\"duration\": [100,0],\"mosaicId\": [3646934825,3576016193],\"amount\": [10000000,0],\"hashAlgorithm\": 0,\"secret\": \"428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4\",\"recipient\": \"90C9B099BAEBB743A4D2D8D3B1520F6DD0A0E9D6C9D968C155\"" + + let dtoString = createDto(type, customFields) + let transaction: SecretLockTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual("[3646934825,3576016193]", transaction.mosaic.id.id.separated) + XCTAssertEqual(10000000, transaction.mosaic.amount) + XCTAssertEqual(0, transaction.hashType.rawValue) + XCTAssertEqual(100, transaction.duration) + XCTAssertEqual("428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4", transaction.secret.hexString.uppercased()) + XCTAssertEqual("90C9B099BAEBB743A4D2D8D3B1520F6DD0A0E9D6C9D968C155", transaction.recipient.bytes.hexString.uppercased()) + } + + func testShouldCreateAggregateSecretLockTransaction() { + let type: UInt16 = 16972 + let customFields = "\"duration\": [100,0],\"mosaicId\": [3646934825,3576016193],\"amount\": [10000000,0],\"hashAlgorithm\": 0,\"secret\": \"428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4\",\"recipient\": \"90C9B099BAEBB743A4D2D8D3B1520F6DD0A0E9D6C9D968C155\"" + + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! SecretLockTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual("[3646934825,3576016193]", transaction.mosaic.id.id.separated) + XCTAssertEqual(10000000, transaction.mosaic.amount) + XCTAssertEqual(0, transaction.hashType.rawValue) + XCTAssertEqual(100, transaction.duration) + XCTAssertEqual("428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4", transaction.secret.hexString.uppercased()) + XCTAssertEqual("90C9B099BAEBB743A4D2D8D3B1520F6DD0A0E9D6C9D968C155", transaction.recipient.bytes.hexString.uppercased()) + + } + + func testShouldCreateStandaloneSecretProofTransaction() { + let type: UInt16 = 17228 + let customFields = "\"hashAlgorithm\": 0,\"secret\": \"428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4\",\"proof\": \"E08664BF179B064D9E3B\"" + + let dtoString = createDto(type, customFields) + let transaction: SecretProofTransaction = decode(dtoString) + + validateCommonFields(type, transaction) + + XCTAssertEqual("428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4", transaction.secret.hexString.uppercased()) + XCTAssertEqual("E08664BF179B064D9E3B", transaction.proof.hexString.uppercased()) + XCTAssertEqual(0, transaction.hashType.rawValue) + } + + + func testShouldCreateAggregateSecretProofTransaction() { + let type: UInt16 = 17228 + let customFields = "\"hashAlgorithm\": 0,\"secret\": \"428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4\",\"proof\": \"E08664BF179B064D9E3B\"" + + let dtoString = createAggregateDto(type, customFields) + let aggregate: AggregateTransaction = decode(dtoString) + let transaction = aggregate.innerTransactions[0] as! SecretProofTransaction + + validateAggregateFields(type, aggregate) + + XCTAssertEqual("428A9DEB1DC6B938AD7C83617E4A558D5316489ADE176AE0C821568A2AD6F700470901532716F83D43F2A7240FBB2C34BDD9536BCF6CC7601904782C385CD8B4", transaction.secret.hexString.uppercased()) + XCTAssertEqual("E08664BF179B064D9E3B", transaction.proof.hexString.uppercased()) + XCTAssertEqual(0, transaction.hashType.rawValue) + } +} diff --git a/Nem2SdkSwiftTests/sdk/model/transaction/TransactionTest.swift b/Nem2SdkSwiftTests/sdk/model/transaction/TransactionTest.swift new file mode 100644 index 0000000..4675ab0 --- /dev/null +++ b/Nem2SdkSwiftTests/sdk/model/transaction/TransactionTest.swift @@ -0,0 +1,70 @@ +// Copyright 2018 ProximaX Limited. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +import XCTest +@testable import Nem2SdkSwift + +public class TransactionTest: XCTestCase { + private let signer = try! PublicAccount(publicKeyHexString: "b4f12e7c9f6946091e2cb8b6d3a12b50d17ccbbf646386ea27ce2946a7423dcf", networkType: .mijinTest) + + + func separatePayload(_ payload: String) -> (signature: [UInt8], signer: [UInt8], message: [UInt8]) { + let bytes = payload.toBytesFromHexString()! + return (signature: Array(bytes[4..<68]), signer: Array(bytes[68..<100]), message: Array(bytes[100.. Click "+" -> New Run Script Phase + * Shell: /bin/sh + * Script: /usr/local/bin/carthage copy-frameworks + * Input Files: The following frameworks in Carthage/Build/iOS + * Alamofire.framework + * CryptoSwift.framework + * Nem2SdkSwift.framework + * RxSwift.framework + * Starscream.framework + +### Manual + +1. Clone this repository with submodules using "--recursive" switch. + + ``` + $ git clone --recursive https://github.com/proximax-storage/nem2-sdk-swift.git + ``` + +2. Run carthage to download depending libraries. + ``` + $ cd nem2-sdk-swift + $ carthage update --platform ios + ``` +3. Add Nem2SwiftSdk.xcodeproj to your application project. + Right click on Navigator in Xcode, select "Add Files to ..." and select Nem2SwiftSdk.xcodeproj. + +4. Add Nem2SwiftSdk.framework. + 4-1. Select your application project in the Project navigator. + 4-2. Click on the + button under the "Embedded Binaries" section in General tab. + 4-3. Select Nem2SwiftSdk.framework + +5. Add depeneded frameworks. + Add the following frameworks in "nem2-sdk-swift/Carthage/Build/iOS" directory to "Embedded Binaries" + * RxSwift.framework + + If you don't check "Copy items if needed", add "nem2-sdk-swift/Carthage/Build/iOS" directory to "Framework Search Paths" of your application. + +## How to use + +### Account Generation + +`Account` generates a NEM account. Network version is required. + +```swift +let account = Account(networkType: .mijinTest) +``` + +If you have private key already, retrieve the account from the key. + +```swift +let account = Account(privateKeyHexString: privateKey, network: .mijinTest) +``` + +### Sending XEM or Mosaics + +First, create `TransferTransaction` object. + +```swift +let transaction = TransferTransaction.create( + recipient: try Address(rawAddress: "SC7A4H-7CYCSH-4CP4XI-ZS4G2G-CDZ7JP-PR5FRG-2VBU"), + mosaics: [XEM.of(xemAmount: 10)], + networkType: .mijinTest) +``` +In this example, a sender sends 10 XEM to "SC7A4H-7CYCSH-4CP4XI-ZS4G2G-CDZ7JP-PR5FRG-2VBU" . + +Next, sign the transaction with the sender account. + +```swift +let signedTransaction = account.sign(transaction: transaction) +``` + +Then send the transaction with `TransactionHttp`. + +```swift +import RxSwift +... + +let transactionHttp = TransactionHttp(url: URL(string:"http://localhost:3000")!) +transactionHttp.announce(signedTransaction: signedTransaction).subscribe( + onSuccess: { announceResult in + ... + }, + onError: { error in + ... + }).disposed(by: disposeBag) +``` + +The response is `Single` of RxSwift. + +### Monitoring Transactions + +`Listener` monitors block generations and the transactions you are insterested in. + +First, create `Listener` instance and call `open` +```swift +let listener = Listener(url: URL(string:"http://localhost:3000")!) + +listener.open().subscribe( + onCompleted: { + ... + }, + onError: { error in + ... + }).disposed(by: disposeBag) +``` +The response of `open` is `Completable` of RxSwift. + +After `onCompleted` is notified, call `confirmed` or a function corresponding to the item you want to monitor. +```swift +listener.confirmed(address: address) + .subscribe(onNext: { transaction in + ... + }).disposed(by: disposeBag) +``` + +The response of `confirmed` is Observable. +Each time a transaction is confirmed, `onNext` is notified. + +## Other NEM2 APIs + +You can use [REST API](https://nemtech.github.io/api.html) of NEM2 with AccountHttp, BlockchainHttp, MosaicHttp, NamespaceHttp, NetworkHttp and TransactionHttp. + +See [REST API](https://nemtech.github.io/api.html) reference for detail. + +## API Reference + +You can see API Reference of Nem2SdkSwift in nem2-sdk-swift/docs. +Open nem2-sdk-swift/docs/index.html with your browser. + +## Core Contributors ## + + + [@ryuta46](https://github.com/ryuta46) + + [@brambear](https://github.com/alvin-reyes) + +## Contribution ## +We'd love to get more people involved in the project. Please feel free to raise any issues or PR and we'll review your contribution. + +Copyright (c) 2018 ProximaX Limited diff --git a/docs/Classes.html b/docs/Classes.html new file mode 100644 index 0000000..51f6047 --- /dev/null +++ b/docs/Classes.html @@ -0,0 +1,1116 @@ + + + + Classes Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Classes

+

The following classes are available globally.

+ +
+
+
+
    +
  • +
    + + + + Hashes + +
    +
    +
    +
    +
    +
    +

    Static class that exposes hash functions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Hashes
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + KeyPair + +
    +
    +
    +
    +
    +
    +

    Key pair of a private key and the public key

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class KeyPair
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + HexEncoder + +
    +
    +
    +
    +
    +
    +

    Static class that contains utility functions for converting hex strings to and from bytes.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class HexEncoder
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+ +
+
+
    +
  • +
    + + + + Listener + +
    +
    +
    +
    +
    +
    +

    WebSocket Listener

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Listener
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicHttp + +
    +
    +
    +
    +
    +
    +

    Mosaic http repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class MosaicHttp : Http, MosaicRepository
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+ +
+
+ +
+
+
    +
  • +
    + + + + Account + +
    +
    +
    +
    +
    +
    +

    The account structure describes an account private key, public key, address and allows signing transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Account
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + XEM + +
    +
    +
    +
    +
    +
    +

    XEM Mosaic

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class XEM
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + AggregateTransaction + +
    +
    +
    +
    +
    +
    +

    The aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class AggregateTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The cosignature transaction is used to sign an aggregate transactions with missing cosignatures.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class CosignatureTransaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Deadline + +
    +
    +
    +
    +
    +
    +

    The deadline of the transaction. The deadline is given as the number of seconds elapsed since the creation of the nemesis block.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Deadline
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + LockFundsTransaction + +
    +
    +
    +
    +
    +
    +

    Lock funds transaction is used before sending an Aggregate bonded transaction, as a deposit to announce the transaction. + When aggregate bonded transaction is confirmed funds are returned to LockFundsTransaction signer.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class LockFundsTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Message + +
    +
    +
    +
    +
    +
    +

    An abstract message class that serves as the base class of all message types.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Message
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Modify multisig account transactions are part of the NEM’s multisig account system. +A modify multisig account transaction holds an array of multisig cosignatory modifications, min number of signatures to approve a transaction and a min number of signatures to remove a cosignatory.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class ModifyMultisigAccountTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Before a mosaic can be created or transferred, a corresponding definition of the mosaic has to be created and published to the network. +This is done via a mosaic definition transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class MosaicDefinitionTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    In case a mosaic has the flag ‘supplyMutable’ set to true, the creator of the mosaic can change the supply, +i.e. increase or decrease the supply.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class MosaicSupplyChangeTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + PlainMessage + +
    +
    +
    +
    +
    +
    +

    The plain message model defines a plain string. When sending it to the network we transform the payload to hex-string.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class PlainMessage : Message
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Accounts can rent a namespace for an amount of blocks and after a this renew the contract. +This is done via a RegisterNamespaceTransaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class RegisterNamespaceTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+ +
+
+
    +
  • +
    + + + + Transaction + +
    +
    +
    +
    +
    +
    +

    An abstract transaction class that serves as the base class of all NEM transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docs/Classes/Account.html b/docs/Classes/Account.html new file mode 100644 index 0000000..9189558 --- /dev/null +++ b/docs/Classes/Account.html @@ -0,0 +1,794 @@ + + + + Account Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Account

+
+
+
public class Account
+ +
+
+

The account structure describes an account private key, public key, address and allows signing transactions.

+ +
+
+
+ +
    +
  • +
    + + + + keyPair + +
    +
    +
    +
    +
    +
    +

    Account keyPair containing public and private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let keyPair: KeyPair
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicAccount + +
    +
    +
    +
    +
    +
    +

    Public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicAccount: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + address + +
    +
    +
    +
    +
    +
    +

    Account address

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var address: Address { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKeyHexString + +
    +
    +
    +
    +
    +
    +

    Account public key hex string

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var publicKeyHexString: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKeyBytes + +
    +
    +
    +
    +
    +
    +

    Account public key bytes

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var publicKeyBytes: [UInt8] { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + privateKeyHexString + +
    +
    +
    +
    +
    +
    +

    Account private key hex string

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var privateKeyHexString: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create an Account from a given private key hex string.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the private key hex string is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(privateKeyHexString: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + privateKeyHexString + + +
    +

    Private key hex string

    +
    +
    + + networkType + + +
    +

    NetworkType

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create an Account from a given private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(keyPair: KeyPair, networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + keyPair + + +
    +

    Key pair

    +
    +
    + + networkType + + +
    +

    NetworkType

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(networkType:) + +
    +
    +
    +
    +
    +
    +

    Create an Account with random generated private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + networkType + + +
    +

    NetworkType

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + sign(transaction:) + +
    +
    +
    +
    +
    +
    +

    Sign a transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func sign(transaction: Transaction) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + transaction + + +
    +

    The transaction to be signed.

    +
    +
    +
    +
    +

    Return Value

    +

    SignedTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Sign aggregate signature transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func sign(cosignatureTransaction: CosignatureTransaction) -> CosignatureSignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + cosignatureTransaction + + +
    +

    The aggregate signature transaction.

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Sign transaction with cosignatories creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func sign(aggregateTransaction: AggregateTransaction, with cosignatories: [Account]) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + transaction + + +
    +

    The aggregate transaction to be signed.

    +
    +
    + + cosignatories + + +
    +

    The list of accounts that will cosign the transaction

    +
    +
    +
    +
    +

    Return Value

    +

    SignedTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/AccountHttp.html b/docs/Classes/AccountHttp.html new file mode 100644 index 0000000..9ef2ba3 --- /dev/null +++ b/docs/Classes/AccountHttp.html @@ -0,0 +1,335 @@ + + + + AccountHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AccountHttp

+
+
+
public class AccountHttp : Http, AccountRepository
+ +
+
+

Account http repository

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/AggregateTransaction.html b/docs/Classes/AggregateTransaction.html new file mode 100644 index 0000000..bf76168 --- /dev/null +++ b/docs/Classes/AggregateTransaction.html @@ -0,0 +1,627 @@ + + + + AggregateTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AggregateTransaction

+
+
+
public class AggregateTransaction : Transaction
+ +
+
+

The aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts.

+ +
+
+
+ +
    +
  • +
    + + + + innerTransactions + +
    +
    +
    +
    +
    +
    +

    List of innerTransactions included in the aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let innerTransactions: [Transaction]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + cosignatures + +
    +
    +
    +
    +
    +
    +

    List of transaction cosigners signatures.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let cosignatures: [AggregateTransactionCosignature]
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create an aggregate complete transaction object

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createComplete(
    +        innerTransactions: [Transaction],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60) ) throws -> AggregateTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + deadline + + +
    +

    The deadline to include the transaction.

    +
    +
    + + innerTransactions + + +
    +

    The list of inner innerTransactions.

    +
    +
    + + networkType + + +
    +

    The network type.

    +
    +
    +
    +
    +

    Return Value

    +

    AggregateTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create an aggregate bonded transaction object

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createBonded(
    +        innerTransactions: [Transaction],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60 ) ) throws -> AggregateTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + innerTransactions + + +
    +

    The list of inner innerTransactions.

    +
    +
    + + networkType + + +
    +

    The network type.

    +
    +
    + + deadline + + +
    +

    The deadline to include the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    AggregateTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Sign transaction with cosignatories creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signWith(initiatorAccount: Account, cosignatories: [Account]) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + initiatorAccount + + +
    +

    Initiator account

    +
    +
    + + cosignatories + + +
    +

    The list of accounts that will cosign the transaction

    +
    +
    +
    +
    +

    Return Value

    +

    Signed transaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Check if account has signed transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signedByAccount(publicAccount: PublicAccount) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + publicAccount + + +
    +

    Signer public account

    +
    +
    +
    +
    +

    Return Value

    +

    boolean

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/BlockchainHttp.html b/docs/Classes/BlockchainHttp.html new file mode 100644 index 0000000..339c947 --- /dev/null +++ b/docs/Classes/BlockchainHttp.html @@ -0,0 +1,335 @@ + + + + BlockchainHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainHttp

+
+
+
public class BlockchainHttp : Http, BlockchainRepository
+ +
+
+

Blockchain http repository

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/CosignatureTransaction.html b/docs/Classes/CosignatureTransaction.html new file mode 100644 index 0000000..a95a32d --- /dev/null +++ b/docs/Classes/CosignatureTransaction.html @@ -0,0 +1,430 @@ + + + + CosignatureTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

CosignatureTransaction

+
+
+
public class CosignatureTransaction
+ +
+
+

The cosignature transaction is used to sign an aggregate transactions with missing cosignatures.

+ +
+
+
+ + +
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(transactionToCosign: AggregateTransaction) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + transactionToCosign + + +
    +

    Aggregate transaction that will be cosigned.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + signWith(account:) + +
    +
    +
    +
    +
    +
    +

    Serialize and sign transaction creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signWith(account: Account) -> CosignatureSignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    Account

    +
    +
    +
    +
    +

    Return Value

    +

    CosignatureSignedTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/Deadline.html b/docs/Classes/Deadline.html new file mode 100644 index 0000000..04dfc40 --- /dev/null +++ b/docs/Classes/Deadline.html @@ -0,0 +1,462 @@ + + + + Deadline Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Deadline

+
+
+
public class Deadline
+ +
+
+

The deadline of the transaction. The deadline is given as the number of seconds elapsed since the creation of the nemesis block.

+ +
+
+
+
    +
  • +
    + + + + dateOfNemesisBlock + +
    +
    +
    +
    +
    +
    +

    Nemesis block date. The date is 2016/04/01 00:00:00 UTC.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let dateOfNemesisBlock: Date
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + date + +
    +
    +
    +
    +
    +
    +

    Deadline date

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let date: Date
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + timestamp + +
    +
    +
    +
    +
    +
    +

    Number of milli seconds elapsed since the creation of the nemesis block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var timestamp: UInt64 { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(fromNow:) + +
    +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fromNow interval: TimeInterval)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fromNow + + +
    +

    Duration time from now

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(fromNemesis:) + +
    +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fromNemesis interval: TimeInterval)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fromNemesis + + +
    +

    Duration time from nemesis block

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/Hashes.html b/docs/Classes/Hashes.html new file mode 100644 index 0000000..047f071 --- /dev/null +++ b/docs/Classes/Hashes.html @@ -0,0 +1,446 @@ + + + + Hashes Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Hashes

+
+
+
public class Hashes
+ +
+
+

Static class that exposes hash functions.

+ +
+
+
+ +
    +
  • +
    + + + + sha3_256(_:) + +
    +
    +
    +
    +
    +
    +

    Performs a SHA3-256 hash of the inputs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func sha3_256(_ inputs: [UInt8]) -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + inputs + + +
    +

    The byte arrays to hash.

    +
    +
    +
    +
    +

    Return Value

    +

    The hash of the inputs.

    +
    +
    +
    +
  • +
  • +
    + + + + sha3_512(_:) + +
    +
    +
    +
    +
    +
    +

    Performs a SHA3-512 hash of the inputs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func sha3_512(_ inputs: [UInt8]) -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + inputs + + +
    +

    The byte arrays to hash.

    +
    +
    +
    +
    +

    Return Value

    +

    The hash of the inputs.

    +
    +
    +
    +
  • +
  • +
    + + + + ripemd160(_:) + +
    +
    +
    +
    +
    +
    +

    Performs a RIPEMD160 hash of the inputs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func ripemd160(_ inputs: [UInt8]) -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + inputs + + +
    +

    The byte arrays to hash.

    +
    +
    +
    +
    +

    Return Value

    +

    The hash of the inputs.

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/HexEncoder.html b/docs/Classes/HexEncoder.html new file mode 100644 index 0000000..b0b1866 --- /dev/null +++ b/docs/Classes/HexEncoder.html @@ -0,0 +1,401 @@ + + + + HexEncoder Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

HexEncoder

+
+
+
public class HexEncoder
+ +
+
+

Static class that contains utility functions for converting hex strings to and from bytes.

+ +
+
+
+ +
    +
  • +
    + + + + toHexString(_:) + +
    +
    +
    +
    +
    +
    +

    Converts bytes to hex string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func toHexString(_ bytes: [UInt8]) -> String
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bytes + + +
    +

    Bytes

    +
    +
    +
    +
    +

    Return Value

    +

    Hex string

    +
    +
    +
    +
  • +
  • +
    + + + + toBytes(_:) + +
    +
    +
    +
    +
    +
    +

    Converts bytes to hex string

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the input is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func toBytes(_ input: String) throws -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + input + + +
    +

    Hex string

    +
    +
    +
    +
    +

    Return Value

    +

    Bytes

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/KeyPair.html b/docs/Classes/KeyPair.html new file mode 100644 index 0000000..769d4b5 --- /dev/null +++ b/docs/Classes/KeyPair.html @@ -0,0 +1,435 @@ + + + + KeyPair Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

KeyPair

+
+
+
public class KeyPair
+ +
+
+

Key pair of a private key and the public key

+ +
+
+
+ +
    +
  • +
    + + + + privateKey + +
    +
    +
    +
    +
    +
    +

    Private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let privateKey: PrivateKey
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKey + +
    +
    +
    +
    +
    +
    +

    Public key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKey: PublicKey
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    Creates a random key pair.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init()
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(privateKey:) + +
    +
    +
    +
    +
    +
    +

    Creates a key pair around a private key. + The public key is calculated from the private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(privateKey: PrivateKey)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + privateKey + + +
    +

    The private key.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/Listener.html b/docs/Classes/Listener.html new file mode 100644 index 0000000..1ffc8d4 --- /dev/null +++ b/docs/Classes/Listener.html @@ -0,0 +1,828 @@ + + + + Listener Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Listener

+
+
+
public class Listener
+ +
+
+

WebSocket Listener

+ +
+
+
+ +
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Creates WebSocket Listener.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + open() + +
    +
    +
    +
    +
    +
    +

    Opens WebSocket connection.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func open() -> Completable
    + +
    +
    +
    +

    Return Value

    +

    Completable that resolves when the WebSocket connection is opened

    +
    +
    +
    +
  • +
  • +
    + + + + close() + +
    +
    +
    +
    +
    +
    +

    Close webSocket connection

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func close()
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + newBlock() + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of BlockInfo. + Each time a new Block is added into the blockchain, + it emits a new BlockInfo in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func newBlock() -> Observable<BlockInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable stream of BlockInfo

    +
    +
    +
    +
  • +
  • +
    + + + + confirmed(address:) + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction for a specific address. + Each time a transaction is in confirmed state an it involves the address, + it emits a new Transaction in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func confirmed(address: Address) -> Observable<Transaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is in confirmed state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Transaction with state confirmed

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction for a specific address. + Each time a transaction is in unconfirmed state an it involves the address, + it emits a new Transaction in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func unconfirmedAdded(address: Address) -> Observable<Transaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is in unconfirmed state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Transaction with state unconfirmed

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction Hashes for specific address. + Each time a transaction with state unconfirmed changes its state, + it emits a new message with the transaction hash in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func unconfirmedRemoved(address: Address) -> Observable<[UInt8]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is removed from unconfirmed state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Strings with the transaction hash

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Return an observable of AggregateTransaction for specific address. + Each time an aggregate bonded transaction is announced, + it emits a new AggregateTransaction in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func aggregateBondedAdded(address: Address) -> Observable<AggregateTransaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    address we listen when a transaction with missing signatures state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of AggregateTransaction with missing signatures state

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction Hashes for specific address. + Each time an aggregate bonded transaction is announced, + it emits a new message with the transaction hash in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func aggregateBondedRemoved(address: Address) -> Observable<[UInt8]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is confirmed or rejected

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Strings with the transaction hash

    +
    +
    +
    +
  • +
  • +
    + + + + status(address:) + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of {@link TransactionStatusError} for specific address. + Each time a transaction contains an error, + it emits a new message with the transaction status error in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func status(address: Address) -> Observable<TransactionStatusError>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen to be notified when some error happened

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of TransactionStatusError

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of CosignatureSignedTransaction for specific address. + Each time a cosigner signs a transaction the address initialized, + it emits a new message with the cosignatory signed transaction in the even stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func cosignatureAdded(address: Address) -> Observable<CosignatureSignedTransaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a cosignatory is added to some transaction address sent

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of CosignatureSignedTransaction

    +
    +
    +
    +
  • +
  • +
    + + + + error() + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of Error.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func error() -> Observable<Error>
    + +
    +
    +
    +

    Return Value

    +

    Observable stream of Error.

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/LockFundsTransaction.html b/docs/Classes/LockFundsTransaction.html new file mode 100644 index 0000000..c54f36c --- /dev/null +++ b/docs/Classes/LockFundsTransaction.html @@ -0,0 +1,474 @@ + + + + LockFundsTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

LockFundsTransaction

+
+
+
public class LockFundsTransaction : Transaction
+ +
+
+

Lock funds transaction is used before sending an Aggregate bonded transaction, as a deposit to announce the transaction. + When aggregate bonded transaction is confirmed funds are returned to LockFundsTransaction signer.

+ +
+
+
+
    +
  • +
    + + + + mosaic + +
    +
    +
    +
    +
    +
    +

    Locked mosaic.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaic: Mosaic
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Funds lock duration in number of blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signedTransaction + +
    +
    +
    +
    +
    +
    +

    Signed transaction for which funds are locked.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signedTransaction: SignedTransaction
    + +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a lock funds transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaic: Mosaic,
    +        duration: UInt64,
    +        signedTransaction: SignedTransaction,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> LockFundsTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaic + + +
    +

    Locked mosaic.

    +
    +
    + + duration + + +
    +

    Funds lock duration in number of blocks.

    +
    +
    + + signedTransaction + + +
    +

    Signed transaction for which funds are locked.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    LockFundsTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/Message.html b/docs/Classes/Message.html new file mode 100644 index 0000000..8cb4661 --- /dev/null +++ b/docs/Classes/Message.html @@ -0,0 +1,350 @@ + + + + Message Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Message

+
+
+
public class Message
+ +
+
+

An abstract message class that serves as the base class of all message types.

+ +
+
+
+ +
    +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Message type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: UInt8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + payload + +
    +
    +
    +
    +
    +
    +

    Returns message payload.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let payload: [UInt8]
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/ModifyMultisigAccountTransaction.html b/docs/Classes/ModifyMultisigAccountTransaction.html new file mode 100644 index 0000000..05de591 --- /dev/null +++ b/docs/Classes/ModifyMultisigAccountTransaction.html @@ -0,0 +1,494 @@ + + + + ModifyMultisigAccountTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

ModifyMultisigAccountTransaction

+
+
+
public class ModifyMultisigAccountTransaction : Transaction
+ +
+
+

Modify multisig account transactions are part of the NEM’s multisig account system. +A modify multisig account transaction holds an array of multisig cosignatory modifications, min number of signatures to approve a transaction and a min number of signatures to remove a cosignatory.

+ +
+
+
+ +
    +
  • +
    + + + + minApprovalDelta + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to approve a transaction. +If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minApprovalDelta: Int8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + minRemovalDelta + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to remove a cosignatory. +If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minRemovalDelta: Int8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + modifications + +
    +
    +
    +
    +
    +
    +

    List of cosigner accounts added or removed from the multi-signature account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let modifications: [MultisigCosignatoryModification]
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a modify multisig account transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        minApprovalDelta: Int8,
    +        minRemovalDelta: Int8,
    +        modifications: [MultisigCosignatoryModification],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> ModifyMultisigAccountTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + minApprovalDelta + + +
    +

    Min approval relative change.

    +
    +
    + + minRemovalDelta + + +
    +

    Min removal relative change.

    +
    +
    + + modifications + + +
    +

    List of modifications.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    ModifyMultisigAccountTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/MosaicDefinitionTransaction.html b/docs/Classes/MosaicDefinitionTransaction.html new file mode 100644 index 0000000..efa423a --- /dev/null +++ b/docs/Classes/MosaicDefinitionTransaction.html @@ -0,0 +1,519 @@ + + + + MosaicDefinitionTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicDefinitionTransaction

+
+
+
public class MosaicDefinitionTransaction : Transaction
+ +
+
+

Before a mosaic can be created or transferred, a corresponding definition of the mosaic has to be created and published to the network. +This is done via a mosaic definition transaction.

+ +
+
+
+ +
    +
  • +
    + + + + mosaicName + +
    +
    +
    +
    +
    +
    +

    Mosaic name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicName: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id generated from namespace name and mosaic name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    Namespace id generated from namespace name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicProperties + +
    +
    +
    +
    +
    +
    +

    Mosaic properties defining mosaic.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicProperties: MosaicProperties
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a mosaic creation transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaicName: String,
    +        namespaceFullName: String,
    +        mosaicProperties: MosaicProperties,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> MosaicDefinitionTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaicName + + +
    +

    Mosaic name ex: xem.

    +
    +
    + + namespaceFullName + + +
    +

    Namespace where mosaic will be included ex: nem.

    +
    +
    + + mosaicProperties + + +
    +

    Mosaic properties.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    MosaicDefinitionTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/MosaicHttp.html b/docs/Classes/MosaicHttp.html new file mode 100644 index 0000000..f66aeda --- /dev/null +++ b/docs/Classes/MosaicHttp.html @@ -0,0 +1,335 @@ + + + + MosaicHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicHttp

+
+
+
public class MosaicHttp : Http, MosaicRepository
+ +
+
+

Mosaic http repository.

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/MosaicSupplyChangeTransaction.html b/docs/Classes/MosaicSupplyChangeTransaction.html new file mode 100644 index 0000000..dee93d9 --- /dev/null +++ b/docs/Classes/MosaicSupplyChangeTransaction.html @@ -0,0 +1,492 @@ + + + + MosaicSupplyChangeTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicSupplyChangeTransaction

+
+
+
public class MosaicSupplyChangeTransaction : Transaction
+ +
+
+

In case a mosaic has the flag ‘supplyMutable’ set to true, the creator of the mosaic can change the supply, +i.e. increase or decrease the supply.

+ +
+
+
+ +
    +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicSupplyType + +
    +
    +
    +
    +
    +
    +

    Mosaic supply type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicSupplyType: MosaicSupplyType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + delta + +
    +
    +
    +
    +
    +
    +

    Amount of mosaics added or removed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let delta: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a mosaic supply change transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaicId: MosaicId,
    +        mosaicSupplyType: MosaicSupplyType,
    +        delta: UInt64,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> MosaicSupplyChangeTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaicId + + +
    +

    Mosaic id.

    +
    +
    + + mosaicSupplyType + + +
    +

    Supply type.

    +
    +
    + + delta + + +
    +

    Supply change in units for the mosaic.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    MosaicSupplyChangeTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/NamespaceHttp.html b/docs/Classes/NamespaceHttp.html new file mode 100644 index 0000000..d6d73f9 --- /dev/null +++ b/docs/Classes/NamespaceHttp.html @@ -0,0 +1,335 @@ + + + + NamespaceHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceHttp

+
+
+
public class NamespaceHttp : Http, NamespaceRepository
+ +
+
+

Namespace http repository

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/NetworkHttp.html b/docs/Classes/NetworkHttp.html new file mode 100644 index 0000000..b289293 --- /dev/null +++ b/docs/Classes/NetworkHttp.html @@ -0,0 +1,335 @@ + + + + NetworkHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NetworkHttp

+
+
+
public class NetworkHttp : Http, NetworkRepository
+ +
+
+

Network http repository.

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/PlainMessage.html b/docs/Classes/PlainMessage.html new file mode 100644 index 0000000..4929ee2 --- /dev/null +++ b/docs/Classes/PlainMessage.html @@ -0,0 +1,396 @@ + + + + PlainMessage Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PlainMessage

+
+
+
public class PlainMessage : Message
+ +
+
+

The plain message model defines a plain string. When sending it to the network we transform the payload to hex-string.

+ +
+
+
+ +
    +
  • +
    + + + + empty + +
    +
    +
    +
    +
    +
    +

    Plain message containing an empty string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let empty: PlainMessage
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + text + +
    +
    +
    +
    +
    +
    +

    Plain text message. Nil If loaded payload cannot be decoded as utf-8 string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let text: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(text:) + +
    +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(text: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + text + + +
    +

    plain message text.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/RegisterNamespaceTransaction.html b/docs/Classes/RegisterNamespaceTransaction.html new file mode 100644 index 0000000..e71f770 --- /dev/null +++ b/docs/Classes/RegisterNamespaceTransaction.html @@ -0,0 +1,624 @@ + + + + RegisterNamespaceTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

RegisterNamespaceTransaction

+
+
+
public class RegisterNamespaceTransaction : Transaction
+ +
+
+

Accounts can rent a namespace for an amount of blocks and after a this renew the contract. +This is done via a RegisterNamespaceTransaction.

+ +
+
+
+ +
    +
  • +
    + + + + namespaceName + +
    +
    +
    +
    +
    +
    +

    Namespace name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceName: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    ID of the namespace derived from namespaceName. +When creating a sub namespace the namespaceId is derived from namespaceName and parentId.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceType + +
    +
    +
    +
    +
    +
    +

    Namespace type either rootNamespace or subNamespace.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceType: NamespaceType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Number of blocks a namespace is active.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    ID of the parent of sub namespace.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a root namespace object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createRootNamespace(
    +        namespaceName: String,
    +        duration: UInt64,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> RegisterNamespaceTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + namespaceName + + +
    +

    Namespace name.

    +
    +
    + + duration + + +
    +

    Duration of the namespace.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of RegisterNamespaceTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a sub namespace object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createSubNamespace(
    +        namespaceName: String,
    +        parentId: NamespaceId,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> RegisterNamespaceTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + namespaceName + + +
    +

    Namespace name.

    +
    +
    + + parentId + + +
    +

    Parent id name.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of RegisterNamespaceTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/SecretLockTransaction.html b/docs/Classes/SecretLockTransaction.html new file mode 100644 index 0000000..c32b73a --- /dev/null +++ b/docs/Classes/SecretLockTransaction.html @@ -0,0 +1,571 @@ + + + + SecretLockTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

SecretLockTransaction

+
+
+
public class SecretLockTransaction : Transaction
+ +
+
+

Secret lock transaction

+ +
+
+
+ +
    +
  • +
    + + + + mosaic + +
    +
    +
    +
    +
    +
    +

    Locked mosaic.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaic: Mosaic
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Duration for the funds to be released or returned.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hashType + +
    +
    +
    +
    +
    +
    +

    Hash algorithm, secret is generated with.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hashType: HashType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secret + +
    +
    +
    +
    +
    +
    +

    Proof hashed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let secret: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + recipient + +
    +
    +
    +
    +
    +
    +

    Recipient of the funds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let recipient: Address
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a secret lock transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaic: Mosaic,
    +        duration: UInt64,
    +        hashType: HashType,
    +        secret: [UInt8],
    +        recipient: Address,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> SecretLockTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaic + + +
    +

    Locked mosaic.

    +
    +
    + + duration + + +
    +

    Duration for the funds to be released or returned.

    +
    +
    + + hashType + + +
    +

    Hash algorithm secret is generated with.

    +
    +
    + + secret + + +
    +

    Proof hashed.

    +
    +
    + + recipient + + +
    +

    Recipient of the funds.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    a SecretLockTransaction instance

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/SecretProofTransaction.html b/docs/Classes/SecretProofTransaction.html new file mode 100644 index 0000000..1ac6f8b --- /dev/null +++ b/docs/Classes/SecretProofTransaction.html @@ -0,0 +1,503 @@ + + + + SecretProofTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

SecretProofTransaction

+
+
+
public class SecretProofTransaction : Transaction
+ +
+
+

Secret lock transaction

+ +
+
+
+ +
    +
  • +
    + + + + hashType + +
    +
    +
    +
    +
    +
    +

    Hash algorithm, secret is generated with.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hashType: HashType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secret + +
    +
    +
    +
    +
    +
    +

    Proof hashed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let secret: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + proof + +
    +
    +
    +
    +
    +
    +

    Proof.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let proof: [UInt8]
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a secret proof transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        hashType: HashType,
    +        secret: [UInt8],
    +        proof: [UInt8],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> SecretProofTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + hashType + + +
    +

    Hash algorithm secret is generated with.

    +
    +
    + + secret + + +
    +

    Proof hashed.

    +
    +
    + + proof + + +
    +

    Proof.

    +
    +
    + + recipient + + +
    +

    Recipient of the funds.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    a SecretProofTransaction instance

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/Transaction.html b/docs/Classes/Transaction.html new file mode 100644 index 0000000..3137a05 --- /dev/null +++ b/docs/Classes/Transaction.html @@ -0,0 +1,731 @@ + + + + Transaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Transaction

+
+
+
public class Transaction
+ +
+
+

An abstract transaction class that serves as the base class of all NEM transactions.

+ +
+
+
+ +
    +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: TransactionType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + networkType + +
    +
    +
    +
    +
    +
    +

    Network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let networkType: NetworkType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + version + +
    +
    +
    +
    +
    +
    +

    Transaction version.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let version: UInt8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + deadline + +
    +
    +
    +
    +
    +
    +

    Deadline to include the transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deadline: Deadline
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + fee + +
    +
    +
    +
    +
    +
    +

    Fee for the transaction. The higher the fee, the higher the priority of the transaction. Transactions with high priority get included in a block before transactions with lower priority.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let fee: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    Transaction signature (missing if part of an aggregate transaction).

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Transaction creator public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var signer: PublicAccount?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + transactionInfo + +
    +
    +
    +
    +
    +
    +

    Meta data object contains additional information about the transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let transactionInfo: TransactionInfo?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isUnconfirmed + +
    +
    +
    +
    +
    +
    +

    If a transaction is pending to be included in a block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isUnconfirmed: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isConfirmed + +
    +
    +
    +
    +
    +
    +

    If a transaction is included in a block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isConfirmed: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hasMissingSignatures + +
    +
    +
    +
    +
    +
    +

    if a transaction has missing signatures.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasMissingSignatures: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isUnannounced + +
    +
    +
    +
    +
    +
    +

    If a transaction is not known by the network.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isUnannounced: Bool { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + signWith(account:) + +
    +
    +
    +
    +
    +
    +

    Serialize and sign transaction creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signWith(account: Account) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    The account to sign the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    Signed transaction.

    +
    +
    +
    +
  • +
  • +
    + + + + toAggregate(signer:) + +
    +
    +
    +
    +
    +
    +

    Convert an aggregate transaction to an inner transaction including transaction signer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func toAggregate(signer: PublicAccount) -> Transaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + signer + + +
    +

    Transaction signer.

    +
    +
    +
    +
    +

    Return Value

    +

    instance of Transaction with signer

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/TransactionHttp.html b/docs/Classes/TransactionHttp.html new file mode 100644 index 0000000..1715217 --- /dev/null +++ b/docs/Classes/TransactionHttp.html @@ -0,0 +1,335 @@ + + + + TransactionHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionHttp

+
+
+
public class TransactionHttp : Http, TransactionRepository
+ +
+
+

Transaction http repository.

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/TransferTransaction.html b/docs/Classes/TransferTransaction.html new file mode 100644 index 0000000..51f747a --- /dev/null +++ b/docs/Classes/TransferTransaction.html @@ -0,0 +1,469 @@ + + + + TransferTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransferTransaction

+
+
+
public class TransferTransaction : Transaction
+ +
+
+

Transfer transaction.

+ +
+
+
+
    +
  • +
    + + + + recipient + +
    +
    +
    +
    +
    +
    +

    Address of the recipient.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let recipient: Address
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaics + +
    +
    +
    +
    +
    +
    +

    List of mosaic objects.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaics: [Mosaic]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + message + +
    +
    +
    +
    +
    +
    +

    Transaction message.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let message: Message?
    + +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a transfer transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        recipient: Address,
    +        mosaics: [Mosaic],
    +        message: Message? = nil,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> TransferTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + recipient + + +
    +

    Recipient of the transaction.

    +
    +
    + + mosaics + + +
    +

    Array of mosaics.

    +
    +
    + + message + + +
    +

    Transaction message.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Classes/XEM.html b/docs/Classes/XEM.html new file mode 100644 index 0000000..ee670c7 --- /dev/null +++ b/docs/Classes/XEM.html @@ -0,0 +1,558 @@ + + + + XEM Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

XEM

+
+
+
public class XEM
+ +
+
+

XEM Mosaic

+ +
+
+
+ +
    +
  • +
    + + + + divisibility + +
    +
    +
    +
    +
    +
    +

    Divisibility

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let divisibility: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + initialSupply + +
    +
    +
    +
    +
    +
    +

    Initial supply

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let initialSupply: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + transferable + +
    +
    +
    +
    +
    +
    +

    Is transferable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let transferable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + supplyMutable + +
    +
    +
    +
    +
    +
    +

    Is supply mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let supplyMutable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + of(xemAmount:) + +
    +
    +
    +
    +
    +
    +

    Create xem with using xem as unit.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func of(xemAmount: Decimal) -> Mosaic
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + xemAmount + + +
    +

    XEM amount

    +
    +
    +
    +
    +

    Return Value

    +

    XEM Mosaic

    +
    +
    +
    +
  • +
  • +
    + + + + of(microXemAmount:) + +
    +
    +
    +
    +
    +
    +

    Create xem with using micro xem as unit, 1 XEM = 1000000 micro XEM.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func of(microXemAmount: UInt64) -> Mosaic
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + microXemAmount + + +
    +

    micro XEM amount

    +
    +
    +
    +
    +

    Return Value

    +

    XEM Mosaic

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums.html b/docs/Enums.html new file mode 100644 index 0000000..6683c97 --- /dev/null +++ b/docs/Enums.html @@ -0,0 +1,503 @@ + + + + Enumerations Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Enumerations

+

The following enumerations are available globally.

+ +
+
+
+
    +
  • +
    + + + + Nem2SdkSwiftError + +
    +
    +
    +
    +
    +
    +

    Errors from Nem2SdkSwift

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Nem2SdkSwiftError : Error
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NetworkType + +
    +
    +
    +
    +
    +
    +

    Network type

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum NetworkType : UInt8, CaseIterable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicSupplyType + +
    +
    +
    +
    +
    +
    +

    Undocumented

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum MosaicSupplyType : UInt8, CaseIterable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceType + +
    +
    +
    +
    +
    +
    +

    Namespace level type

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum NamespaceType : UInt8, CaseIterable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + HashType + +
    +
    +
    +
    +
    +
    +

    Enum containing hash type.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum HashType : UInt8
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Enum containing multisig cosignatory modification type constants.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum MultisigCosignatoryModificationType : UInt8
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionType + +
    +
    +
    +
    +
    +
    +

    Enum containing transaction type constants.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum TransactionType : UInt16
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/HashType.html b/docs/Enums/HashType.html new file mode 100644 index 0000000..b7d064e --- /dev/null +++ b/docs/Enums/HashType.html @@ -0,0 +1,316 @@ + + + + HashType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

HashType

+
+
+
public enum HashType : UInt8
+ +
+
+

Enum containing hash type.

+ +
+
+
+
    +
  • +
    + + + + sha3_512 + +
    +
    +
    +
    +
    +
    +

    SHA3 512

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case sha3_512 = 0
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/MosaicSupplyType.html b/docs/Enums/MosaicSupplyType.html new file mode 100644 index 0000000..7d6278f --- /dev/null +++ b/docs/Enums/MosaicSupplyType.html @@ -0,0 +1,343 @@ + + + + MosaicSupplyType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicSupplyType

+
+
+
public enum MosaicSupplyType : UInt8, CaseIterable
+ +
+
+

Undocumented

+ +
+
+
+
    +
  • +
    + + + + decrease + +
    +
    +
    +
    +
    +
    +

    Decrease the supply.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case decrease = 0
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + increase + +
    +
    +
    +
    +
    +
    +

    Increase the supply.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case increase = 1
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/MultisigCosignatoryModificationType.html b/docs/Enums/MultisigCosignatoryModificationType.html new file mode 100644 index 0000000..4d50f31 --- /dev/null +++ b/docs/Enums/MultisigCosignatoryModificationType.html @@ -0,0 +1,343 @@ + + + + MultisigCosignatoryModificationType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigCosignatoryModificationType

+
+
+
public enum MultisigCosignatoryModificationType : UInt8
+ +
+
+

Enum containing multisig cosignatory modification type constants.

+ +
+
+
+
    +
  • +
    + + + + add + +
    +
    +
    +
    +
    +
    +

    Add cosignatory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case add = 0
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + remove + +
    +
    +
    +
    +
    +
    +

    Remove cosignatory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case remove = 1
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/NamespaceType.html b/docs/Enums/NamespaceType.html new file mode 100644 index 0000000..4eed95d --- /dev/null +++ b/docs/Enums/NamespaceType.html @@ -0,0 +1,343 @@ + + + + NamespaceType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceType

+
+
+
public enum NamespaceType : UInt8, CaseIterable
+ +
+
+

Namespace level type

+ +
+
+
+
    +
  • +
    + + + + rootNamespace + +
    +
    +
    +
    +
    +
    +

    Root namespace

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case rootNamespace = 0
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + subNamespace + +
    +
    +
    +
    +
    +
    +

    Sub namespace

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case subNamespace = 1
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/Nem2SdkSwiftError.html b/docs/Enums/Nem2SdkSwiftError.html new file mode 100644 index 0000000..aa88cd2 --- /dev/null +++ b/docs/Enums/Nem2SdkSwiftError.html @@ -0,0 +1,424 @@ + + + + Nem2SdkSwiftError Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Nem2SdkSwiftError

+
+
+
public enum Nem2SdkSwiftError : Error
+ +
+
+

Errors from Nem2SdkSwift

+ +
+
+
+
    +
  • +
    + + + + illegalArgument(_:) + +
    +
    +
    +
    +
    +
    +

    An argument of the API is invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case illegalArgument(String)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + networkError + +
    +
    +
    +
    +
    +
    +

    A network error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case networkError
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + responseError(_:_:) + +
    +
    +
    +
    +
    +
    +

    A response error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case responseError(Int, String?)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parseError(_:) + +
    +
    +
    +
    +
    +
    +

    A parse error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case parseError(String)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + serializeError(_:) + +
    +
    +
    +
    +
    +
    +

    A serialize error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case serializeError(String)
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/NetworkType.html b/docs/Enums/NetworkType.html new file mode 100644 index 0000000..3b95b94 --- /dev/null +++ b/docs/Enums/NetworkType.html @@ -0,0 +1,452 @@ + + + + NetworkType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NetworkType

+
+
+
public enum NetworkType : UInt8, CaseIterable
+ +
+
+

Network type

+ +
+
+
+
    +
  • +
    + + + + mainNet + +
    +
    +
    +
    +
    +
    +

    Main network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mainNet = 104
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + testNet + +
    +
    +
    +
    +
    +
    +

    Test network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case testNet = 152
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mijin + +
    +
    +
    +
    +
    +
    +

    Mijin network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mijin = 96
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mijinTest + +
    +
    +
    +
    +
    +
    +

    Mijin test network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mijinTest = 144
    + +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    MARK: Properties +Initial address character of this network.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var initialCharacterOfAddress: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    String description of this network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Enums/TransactionType.html b/docs/Enums/TransactionType.html new file mode 100644 index 0000000..67f8a22 --- /dev/null +++ b/docs/Enums/TransactionType.html @@ -0,0 +1,559 @@ + + + + TransactionType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionType

+
+
+
public enum TransactionType : UInt16
+ +
+
+

Enum containing transaction type constants.

+ +
+
+
+
    +
  • +
    + + + + aggregateComplete + +
    +
    +
    +
    +
    +
    +

    Aggregate complete transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case aggregateComplete = 0x4141
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + aggregateBonded + +
    +
    +
    +
    +
    +
    +

    Aggregate bonded transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case aggregateBonded = 0x4241
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicDefinition + +
    +
    +
    +
    +
    +
    +

    Mosaic definition transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mosaicDefinition = 0x414d
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicSupplyChange + +
    +
    +
    +
    +
    +
    +

    Mosaic supply change

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mosaicSupplyChange = 0x424d
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + modifyMultisigAccount + +
    +
    +
    +
    +
    +
    +

    Modify multisig account

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case modifyMultisigAccount = 0x4155
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + registerNamespace + +
    +
    +
    +
    +
    +
    +

    Register namespace transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case registerNamespace = 0x414e
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + transfer + +
    +
    +
    +
    +
    +
    +

    Transfer Transaction transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case transfer = 0x4154
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + lock + +
    +
    +
    +
    +
    +
    +

    Lock transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case lock = 0x414C
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secretLock + +
    +
    +
    +
    +
    +
    +

    Secret Lock Transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case secretLock = 0x424C
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secretProof + +
    +
    +
    +
    +
    +
    +

    Secret Proof transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case secretProof = 0x434C
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Extensions.html b/docs/Extensions.html new file mode 100644 index 0000000..901709b --- /dev/null +++ b/docs/Extensions.html @@ -0,0 +1,337 @@ + + + + Extensions Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Extensions

+

The following extensions are available globally.

+ +
+
+
+
    +
  • +
    + + + + Array + +
    +
    +
    +
    +
    +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct Array<Element> : _DestructorSafeContainer
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + String + +
    +
    +
    +
    +
    +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct String
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Extensions/Array.html b/docs/Extensions/Array.html new file mode 100644 index 0000000..4722ff7 --- /dev/null +++ b/docs/Extensions/Array.html @@ -0,0 +1,322 @@ + + + + Array Extension Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Array

+
+
+
struct Array<Element> : _DestructorSafeContainer
+ +
+
+ +
+
+
+ +
    +
  • +
    + + + + hexString + +
    +
    +
    +
    +
    +
    +

    Hex string description of this bytes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var hexString: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Extensions/String.html b/docs/Extensions/String.html new file mode 100644 index 0000000..b0b3e13 --- /dev/null +++ b/docs/Extensions/String.html @@ -0,0 +1,439 @@ + + + + String Extension Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

String

+
+
+
struct String
+ +
+
+ +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Decodes this string as hex string of bytes and returns the bytes.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if this string is malformed as hex string. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func toBytesFromHexString() -> [UInt8]?
    + +
    +
    +
    +

    Return Value

    +

    Bytes

    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + stringValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var stringValue: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(stringValue:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init?(stringValue: String)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + intValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var intValue: Int? { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(intValue:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init?(intValue: Int)
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols.html b/docs/Protocols.html new file mode 100644 index 0000000..c47bd10 --- /dev/null +++ b/docs/Protocols.html @@ -0,0 +1,471 @@ + + + + Protocols Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Protocols

+

The following protocols are available globally.

+ +
+
+
+
    +
  • +
    + + + + AccountRepository + +
    +
    +
    +
    +
    +
    +

    Account interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AccountRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockchainRepository + +
    +
    +
    +
    +
    +
    +

    Blockchain interface repository

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol BlockchainRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicRepository + +
    +
    +
    +
    +
    +
    +

    Mosaic interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol MosaicRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceRepository + +
    +
    +
    +
    +
    +
    +

    Namespace interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol NamespaceRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NetworkRepository + +
    +
    +
    +
    +
    +
    +

    Network interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol NetworkRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionRepository + +
    +
    +
    +
    +
    +
    +

    Transaction interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol TransactionRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols/AccountRepository.html b/docs/Protocols/AccountRepository.html new file mode 100644 index 0000000..7b94301 --- /dev/null +++ b/docs/Protocols/AccountRepository.html @@ -0,0 +1,823 @@ + + + + AccountRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AccountRepository

+
+
+
public protocol AccountRepository
+ +
+
+

Account interface repository.

+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Gets an AccountInfo for an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getAccountInfo(address: Address) -> Single<AccountInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of AccountInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets AccountsInfo for different accounts.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getAccountsInfo(addresses: [Address]) -> Single<[AccountInfo]>
    + +
    +
    +
    +

    Return Value

    +

    Observable of [AccountInfo]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets a MultisigAccountInfo for an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMultisigAccountInfo(address: Address) -> Single<MultisigAccountInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of MultisigAccountInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets a MultisigAccountGraphInfo for an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMultisigAccountGraphInfo(address: Address) -> Single<MultisigAccountGraphInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of MultisigAccountGraphInfo

    +
    +
    +
    +
  • +
  • +
    + + + + transactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of confirmed transactions for which an account is signer or receiver.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func transactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + incomingTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of transactions for which an account is the recipient of a transaction. + A transaction is said to be incoming with respect to an account if the account is the recipient of a transaction.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func incomingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + outgoingTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of transactions for which an account is the sender a transaction. + A transaction is said to be outgoing with respect to an account if the account is the sender of a transaction.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func outgoingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + aggregateBondedTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of transactions for which an account is the sender or has sign the transaction. + A transaction is said to be aggregate bonded with respect to an account if there are missing signatures.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func aggregateBondedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[AggregateTransaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [AggregateTransaction]

    +
    +
    +
    +
  • +
  • +
    + + + + unconfirmedTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets the list of transactions for which an account is the sender or receiver and which have not yet been included in a block. + Unconfirmed transactions are those transactions that have not yet been included in a block. + Unconfirmed transactions are not guaranteed to be included in any block.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func unconfirmedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols/BlockchainRepository.html b/docs/Protocols/BlockchainRepository.html new file mode 100644 index 0000000..6378c18 --- /dev/null +++ b/docs/Protocols/BlockchainRepository.html @@ -0,0 +1,506 @@ + + + + BlockchainRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainRepository

+
+
+
public protocol BlockchainRepository
+ +
+
+

Blockchain interface repository

+ +
+
+
+
    +
  • +
    + + + + getBlock(height:) + +
    +
    +
    +
    +
    +
    +

    Gets a BlockInfo for a given block height.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlock(height: UInt64) -> Single<BlockInfo>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + height + + +
    +

    Block height

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of BlockInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets list of transactions included in a block for a block height.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockTransactions(height: UInt64, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + getBlockchainHeight() + +
    +
    +
    +
    +
    +
    +

    Gets current blockchain height.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockchainHeight() -> Single<UInt64>
    + +
    +
    +
    +

    Return Value

    +

    Observable of UInt64

    +
    +
    +
    +
  • +
  • +
    + + + + getBlockchainScore() + +
    +
    +
    +
    +
    +
    +

    Gets current blockchain score.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockchainScore() -> Single<BlockchainScore>
    + +
    +
    +
    +

    Return Value

    +

    Observable of BlockchainScore

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets blockchain storage info.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockchainStorage() -> Single<BlockchainStorageInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of BlockchainStorageInfo

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols/MosaicRepository.html b/docs/Protocols/MosaicRepository.html new file mode 100644 index 0000000..c722181 --- /dev/null +++ b/docs/Protocols/MosaicRepository.html @@ -0,0 +1,520 @@ + + + + MosaicRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicRepository

+
+
+
public protocol MosaicRepository
+ +
+
+

Mosaic interface repository.

+ +
+
+
+
    +
  • +
    + + + + getMosaic(mosaicId:) + +
    +
    +
    +
    +
    +
    +

    Gets a MosaicInfo for a given mosaicId

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaic(mosaicId: MosaicId) -> Single<MosaicInfo>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + mosaicId + + +
    +

    Mosaic id

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of MosaicInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets MosaicInfo for different mosaicIds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaics(mosaicIds: [MosaicId]) -> Single<[MosaicInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + mosaicIds + + +
    +

    List of mosaic id

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [MosaicInfo]

    +
    +
    +
    +
  • +
  • +
    + + + + getMosaicsFromNamespace(namespaceId:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets list of MosaicInfo from mosaics created with provided namespace.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaicsFromNamespace(namespaceId: NamespaceId, pageSize: Int?, id: String?) -> Single<[MosaicInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + namespaceId + + +
    +

    Namespace id.

    +
    +
    + + pageSize + + +
    +

    The number of mosaics to return. (optional)

    +
    +
    + + id + + +
    +

    The mosaic id up to which mosaic definitions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [MosaicInfo]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets list of MosaicName for different mosaicIds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaicNames(mosaicIds: [MosaicId]) -> Single<[MosaicName]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + mosaicIds + + +
    +

    List of mosaic id.

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [MosaicName]

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols/NamespaceRepository.html b/docs/Protocols/NamespaceRepository.html new file mode 100644 index 0000000..d6f9a4c --- /dev/null +++ b/docs/Protocols/NamespaceRepository.html @@ -0,0 +1,551 @@ + + + + NamespaceRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceRepository

+
+
+
public protocol NamespaceRepository
+ +
+
+

Namespace interface repository.

+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Gets the NamespaceInfo for a given namespaceId.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespace(namespaceId: NamespaceId) -> Single<NamespaceInfo>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + namespaceId + + +
    +

    NamespaceId

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of NamespaceInfo

    +
    +
    +
    +
  • +
  • +
    + + + + getNamespacesFromAccount(address:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets list of NamespaceInfo for an account.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespacesFromAccount(address: Address, pageSize: Int?, id: String?) -> Single<[NamespaceInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + address + + +
    +

    Address

    +
    +
    + + pageSize + + +
    +

    The number of namespaces to return. (optional)

    +
    +
    + + id + + +
    +

    The namespace id up to which namespace definitions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [NamespaceInfo]

    +
    +
    +
    +
  • +
  • +
    + + + + getNamespacesFromAccounts(addresses:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets list of NamespaceInfo for different account.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespacesFromAccounts(addresses: [Address], pageSize: Int?, id: String?) -> Single<[NamespaceInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + addresses + + +
    +

    List of Address

    +
    +
    + + pageSize + + +
    +

    The number of namespaces to return. (optional)

    +
    +
    + + id + + +
    +

    The namespace id up to which namespace definitions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [NamespaceInfo]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets list of NamespaceName for different namespaceIds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespaceNames(namespaceIds: [NamespaceId]) -> Single<[NamespaceName]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + namespaceIds + + +
    +

    List of NamespaceId

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [NamespaceName]

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols/NetworkRepository.html b/docs/Protocols/NetworkRepository.html new file mode 100644 index 0000000..b2b80fd --- /dev/null +++ b/docs/Protocols/NetworkRepository.html @@ -0,0 +1,316 @@ + + + + NetworkRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NetworkRepository

+
+
+
public protocol NetworkRepository
+ +
+
+

Network interface repository.

+ +
+
+
+
    +
  • +
    + + + + getNetworkType() + +
    +
    +
    +
    +
    +
    +

    Get current network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNetworkType() -> Single<NetworkType>
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Protocols/TransactionRepository.html b/docs/Protocols/TransactionRepository.html new file mode 100644 index 0000000..e01dea5 --- /dev/null +++ b/docs/Protocols/TransactionRepository.html @@ -0,0 +1,639 @@ + + + + TransactionRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionRepository

+
+
+
public protocol TransactionRepository
+ +
+
+

Transaction interface repository.

+ +
+
+
+
    +
  • +
    + + + + getTransaction(hash:) + +
    +
    +
    +
    +
    +
    +

    Gets a transaction for a given hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransaction(hash: [UInt8]) -> Single<Transaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hash + + +
    +

    Transaction hash.

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of Transaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets an list of transactions for different transaction hashes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransactions(hashes: [[UInt8]]) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hashes + + +
    +

    List of transaction hash string.

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets a transaction status for a transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransactionStatus(hash: [UInt8]) -> Single<TransactionStatus>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hash + + +
    +

    Transaction hash string

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionStatus

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets an list of transaction status for different transaction hashes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransactionStatuses(hashes: [[UInt8]]) -> Single<[TransactionStatus]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hashes + + +
    +

    List of transaction hash string

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [TransactionStatus]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Send a signed transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func announce(signedTransaction: SignedTransaction) -> Single<TransactionAnnounceResponse>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + signedTransaction + + +
    +

    SignedTransaction

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionAnnounceResponse

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Send a signed transaction with missing signatures.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func announceAggregateBonded(signedTransaction: SignedTransaction) -> Single<TransactionAnnounceResponse>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + signedTransaction + + +
    +

    SignedTransaction

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionAnnounceResponse

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Send a cosignature signed transaction of an already announced transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func announceAggregateBondedCosignature(cosignatureSignedTransaction: CosignatureSignedTransaction) -> Single<TransactionAnnounceResponse>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + cosignatureSignedTransaction + + +
    +

    CosignatureSignedTransaction

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionAnnounceResponse

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs.html b/docs/Structs.html new file mode 100644 index 0000000..82c4ccb --- /dev/null +++ b/docs/Structs.html @@ -0,0 +1,1145 @@ + + + + Structures Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Structures

+

The following structures are available globally.

+ +
+
+
+
    +
  • +
    + + + + PrivateKey + +
    +
    +
    +
    +
    +
    +

    Represents a private key.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct PrivateKey : Equatable, CustomStringConvertible
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + PublicKey + +
    +
    +
    +
    +
    +
    +

    Represents a public key.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct PublicKey : Equatable, CustomStringConvertible
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Undocumented

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ListenerSubscribeMessage : Codable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + AccountInfo + +
    +
    +
    +
    +
    +
    +

    The account info structure describes basic information for an account.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct AccountInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Address + +
    +
    +
    +
    +
    +
    +

    The address structure describes an address with its network.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Address : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    @since 1.0

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MultisigAccountGraphInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MultisigAccountInfo + +
    +
    +
    +
    +
    +
    +

    The multisig account info structure describes information of a multisig account.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MultisigAccountInfo : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + PublicAccount + +
    +
    +
    +
    +
    +
    +

    The public account structure contains account’s address and public key.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct PublicAccount : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockInfo + +
    +
    +
    +
    +
    +
    +

    The block info structure describes basic information of a block.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct BlockInfo : CustomStringConvertible
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockchainStorageInfo + +
    +
    +
    +
    +
    +
    +

    The blockchain storage info structure describes stored data.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct BlockchainStorageInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Mosaic + +
    +
    +
    +
    +
    +
    +

    A mosaic describes an instance of a mosaic definition. +Mosaics can be transferred by means of a transfer transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Mosaic
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicId + +
    +
    +
    +
    +
    +
    +

    The mosaic id structure describes mosaic id

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicId : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicInfo + +
    +
    +
    +
    +
    +
    +

    The mosaic info structure contains its properties, the owner and the namespace to which it belongs to.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicName + +
    +
    +
    +
    +
    +
    +

    The mosaic name info structure describes basic information of a mosaic and name.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicName
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicProperties + +
    +
    +
    +
    +
    +
    +

    The mosaic properties structure describes mosaic properties.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicProperties
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceId + +
    +
    +
    +
    +
    +
    +

    The namespace id structure describes namespace id

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct NamespaceId : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceInfo + +
    +
    +
    +
    +
    +
    +

    NamespaceInfo contains the state information of a namespace.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct NamespaceInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceName + +
    +
    +
    +
    +
    +
    +

    The namespace name info structure describes basic information of a namespace and name.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct NamespaceName
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The model representing cosignature of an aggregate transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct AggregateTransactionCosignature
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The co-signature signed transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct CosignatureSignedTransaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The multisig cosignatory modifications are part of the NEM’s multisig account system. +With a multisig cosignatory modification a cosignatory is added to or deleted from a multisig account. +Multisig cosignatory modifications are part of a modify multisig account transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MultisigCosignatoryModification
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + SignedTransaction + +
    +
    +
    +
    +
    +
    +

    The signed transaction object is used to transfer the transaction data and the signature to NIS

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SignedTransaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The transaction response of an announce transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionAnnounceResponse
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionInfo + +
    +
    +
    +
    +
    +
    +

    The transaction information model included in all transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionStatus + +
    +
    +
    +
    +
    +
    +

    The transaction status contains basic of a transaction announced to the blockchain.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionStatus
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The transaction status error model returned by listeners.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionStatusError
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockchainScore + +
    +
    +
    +
    +
    +
    +

    The blockchain score structure describes blockchain difficulty.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct BlockchainScore
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/AccountInfo.html b/docs/Structs/AccountInfo.html new file mode 100644 index 0000000..3e176e4 --- /dev/null +++ b/docs/Structs/AccountInfo.html @@ -0,0 +1,485 @@ + + + + AccountInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AccountInfo

+
+
+
public struct AccountInfo
+ +
+
+

The account info structure describes basic information for an account.

+ +
+
+
+ +
    +
  • +
    + + + + address + +
    +
    +
    +
    +
    +
    +

    Account address.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let address: Address
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + addressHeight + +
    +
    +
    +
    +
    +
    +

    Height when the address was published.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let addressHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKey + +
    +
    +
    +
    +
    +
    +

    Public key of the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKey: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKeyHeight + +
    +
    +
    +
    +
    +
    +

    Height when the public key was published.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKeyHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + importance + +
    +
    +
    +
    +
    +
    +

    Importance of the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let importance: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + importanceHeight + +
    +
    +
    +
    +
    +
    +

    Importance height of the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let importanceHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaics + +
    +
    +
    +
    +
    +
    +

    Mosaics hold by the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaics: [Mosaic]
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/Address.html b/docs/Structs/Address.html new file mode 100644 index 0000000..5044d14 --- /dev/null +++ b/docs/Structs/Address.html @@ -0,0 +1,674 @@ + + + + Address Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Address

+
+
+
public struct Address : Equatable
+ +
+
+

The address structure describes an address with its network.

+ +
+
+
+ +
    +
  • +
    + + + + networkType + +
    +
    +
    +
    +
    +
    +

    Network type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let networkType: NetworkType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + plain + +
    +
    +
    +
    +
    +
    +

    The address in plain format ex: SB3KUBHATFCPV7UZQLWAQ2EUR6SIHBSBEOEDDDF3.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var plain: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + pretty + +
    +
    +
    +
    +
    +
    +

    The address in pretty format ex: SB3KUB-HATFCP-V7UZQL-WAQ2EU-R6SIHB-SBEOED-DDF3.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var pretty: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Constructor

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the address is invalid length or doesn’t match the network. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(address: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + address + + +
    +

    Address in plain format

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(rawAddress:) + +
    +
    +
    +
    +
    +
    +

    Creates an Address from a given raw address.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the address is invalid length or does’t match any network. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rawAddress: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rawAddress + + +
    +

    Address string.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(encodedAddress:) + +
    +
    +
    +
    +
    +
    +

    Creates an Address from a given base32 encoded address.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the address is invalid length or does’t match any network. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(encodedAddress: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + encodedAddress + + +
    +

    Base32 encoded address string.

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates from public key hex string.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the public key is invalid length or malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKeyHexString: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKeyHexString + + +
    +

    Public key hex string.

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates from public key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKey: PublicKey, networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKey + + +
    +

    Public key.

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/AggregateTransactionCosignature.html b/docs/Structs/AggregateTransactionCosignature.html new file mode 100644 index 0000000..b701506 --- /dev/null +++ b/docs/Structs/AggregateTransactionCosignature.html @@ -0,0 +1,343 @@ + + + + AggregateTransactionCosignature Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AggregateTransactionCosignature

+
+
+
public struct AggregateTransactionCosignature
+ +
+
+

The model representing cosignature of an aggregate transaction.

+ +
+
+
+
    +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    Signature of aggregate transaction done by the cosigner.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Cosigner public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signer: PublicAccount
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/BlockInfo.html b/docs/Structs/BlockInfo.html new file mode 100644 index 0000000..8516f81 --- /dev/null +++ b/docs/Structs/BlockInfo.html @@ -0,0 +1,701 @@ + + + + BlockInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockInfo

+
+
+
public struct BlockInfo : CustomStringConvertible
+ +
+
+

The block info structure describes basic information of a block.

+ +
+
+
+ +
    +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Block hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + generationHash + +
    +
    +
    +
    +
    +
    +

    Block generation hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let generationHash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + totalFee + +
    +
    +
    +
    +
    +
    +

    Total fee paid to the account harvesting the block. Nil when generated by listeners.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let totalFee: UInt64?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + numTransactions + +
    +
    +
    +
    +
    +
    +

    Number of transactions included the block. Nil when generated by listeners.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numTransactions: Int?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    The block signature. +The signature was generated by the signer and can be used to validate that the blockchain data was not modified by a node.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Public account of block harvester.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signer: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + networkType + +
    +
    +
    +
    +
    +
    +

    Network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let networkType: NetworkType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + version + +
    +
    +
    +
    +
    +
    +

    Block transaction version.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let version: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Block transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Height of which the block was confirmed. Each block has a unique height. Subsequent blocks differ in height by 1.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + timestamp + +
    +
    +
    +
    +
    +
    +

    The number of seconds elapsed since the creation of the nemesis blockchain.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let timestamp: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + difficulty + +
    +
    +
    +
    +
    +
    +

    POI difficulty to harvest a block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let difficulty: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + previousBlockHash + +
    +
    +
    +
    +
    +
    +

    The last block hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let previousBlockHash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + blockTransactionHash + +
    +
    +
    +
    +
    +
    +

    The block transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let blockTransactionHash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/BlockchainScore.html b/docs/Structs/BlockchainScore.html new file mode 100644 index 0000000..c896df7 --- /dev/null +++ b/docs/Structs/BlockchainScore.html @@ -0,0 +1,343 @@ + + + + BlockchainScore Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainScore

+
+
+
public struct BlockchainScore
+ +
+
+

The blockchain score structure describes blockchain difficulty.

+ +
+
+
+
    +
  • +
    + + + + scoreLow + +
    +
    +
    +
    +
    +
    +

    Low part of the blockchain score.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let scoreLow: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + scoreHigh + +
    +
    +
    +
    +
    +
    +

    High part of the blockchain score.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let scoreHigh: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/BlockchainStorageInfo.html b/docs/Structs/BlockchainStorageInfo.html new file mode 100644 index 0000000..749589e --- /dev/null +++ b/docs/Structs/BlockchainStorageInfo.html @@ -0,0 +1,377 @@ + + + + BlockchainStorageInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainStorageInfo

+
+
+
public struct BlockchainStorageInfo
+ +
+
+

The blockchain storage info structure describes stored data.

+ +
+
+
+ +
    +
  • +
    + + + + numAccounts + +
    +
    +
    +
    +
    +
    +

    Number of accounts published in the blockchain.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numAccounts: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + numBlocks + +
    +
    +
    +
    +
    +
    +

    Number of confirmed blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numBlocks: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + numTransactions + +
    +
    +
    +
    +
    +
    +

    Number of confirmed transactions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numTransactions: Int
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/CosignatureSignedTransaction.html b/docs/Structs/CosignatureSignedTransaction.html new file mode 100644 index 0000000..be355a7 --- /dev/null +++ b/docs/Structs/CosignatureSignedTransaction.html @@ -0,0 +1,370 @@ + + + + CosignatureSignedTransaction Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

CosignatureSignedTransaction

+
+
+
public struct CosignatureSignedTransaction
+ +
+
+

The co-signature signed transaction.

+ +
+
+
+
    +
  • +
    + + + + parentHash + +
    +
    +
    +
    +
    +
    +

    Hash of parent aggregate transaction that has been signed by a cosignatory of the transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentHash: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    Signatures generated by signing the parent aggregate transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Signer of the cosignature transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signer: [UInt8]
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/Mosaic.html b/docs/Structs/Mosaic.html new file mode 100644 index 0000000..c61b504 --- /dev/null +++ b/docs/Structs/Mosaic.html @@ -0,0 +1,344 @@ + + + + Mosaic Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Mosaic

+
+
+
public struct Mosaic
+ +
+
+

A mosaic describes an instance of a mosaic definition. +Mosaics can be transferred by means of a transfer transaction.

+ +
+
+
+
    +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Mosaic identifier

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + amount + +
    +
    +
    +
    +
    +
    +

    Amount of mosaic

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let amount: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/MosaicId.html b/docs/Structs/MosaicId.html new file mode 100644 index 0000000..00aa471 --- /dev/null +++ b/docs/Structs/MosaicId.html @@ -0,0 +1,485 @@ + + + + MosaicId Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicId

+
+
+
public struct MosaicId : Equatable
+ +
+
+

The mosaic id structure describes mosaic id

+ +
+
+
+ +
    +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Mosaic integer id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + fullName + +
    +
    +
    +
    +
    +
    +

    Mosaic full name, with namespace name (ex: nem:xem)

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let fullName: String?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(fullName:) + +
    +
    +
    +
    +
    +
    +

    Create MosaicId from mosaic and namespace string name (ex: nem:xem or domain.subdom.subdome:token)

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the fullName is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fullName: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fullName + + +
    +

    Mosaic full name

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(id:) + +
    +
    +
    +
    +
    +
    +

    Create MosaicId from integer id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(id: UInt64)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + id + + +
    +

    Mosaic integer id

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    +

    Compares only the ids.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: MosaicId, rhs: MosaicId) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/MosaicInfo.html b/docs/Structs/MosaicInfo.html new file mode 100644 index 0000000..ad6a570 --- /dev/null +++ b/docs/Structs/MosaicInfo.html @@ -0,0 +1,668 @@ + + + + MosaicInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicInfo

+
+
+
public struct MosaicInfo
+ +
+
+

The mosaic info structure contains its properties, the owner and the namespace to which it belongs to.

+ +
+
+
+
    +
  • +
    + + + + isActive + +
    +
    +
    +
    +
    +
    +

    MARK: Properties +If the mosaic is active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isActive: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + index + +
    +
    +
    +
    +
    +
    +

    Index

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let index: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + metaId + +
    +
    +
    +
    +
    +
    +

    Meta ID

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let metaId: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    The namespace id it belongs to

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + supply + +
    +
    +
    +
    +
    +
    +

    Total mosaic supply

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let supply: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Block height it was created

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + owner + +
    +
    +
    +
    +
    +
    +

    Mosaic account owner

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let owner: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isExpired + +
    +
    +
    +
    +
    +
    +

    If the mosaic is expired

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isExpired: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isSupplyMutable + +
    +
    +
    +
    +
    +
    +

    True if the supply is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isSupplyMutable: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isTransferable + +
    +
    +
    +
    +
    +
    +

    True if the mosaic is transferable between non-owner accounts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isTransferable: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isLevyMutable + +
    +
    +
    +
    +
    +
    +

    If the mosaic levy is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isLevyMutable: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    The number of blocks from height it will be active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var duration: UInt64 { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + divisibility + +
    +
    +
    +
    +
    +
    +

    Mosaic divisibility

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var divisibility: Int { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/MosaicName.html b/docs/Structs/MosaicName.html new file mode 100644 index 0000000..46c06e8 --- /dev/null +++ b/docs/Structs/MosaicName.html @@ -0,0 +1,377 @@ + + + + MosaicName Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicName

+
+
+
public struct MosaicName
+ +
+
+

The mosaic name info structure describes basic information of a mosaic and name.

+ +
+
+
+ +
    +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic identifier

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    Mosaic name

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let name: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    Namespace identifier it belongs to

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/MosaicProperties.html b/docs/Structs/MosaicProperties.html new file mode 100644 index 0000000..09bbeca --- /dev/null +++ b/docs/Structs/MosaicProperties.html @@ -0,0 +1,424 @@ + + + + MosaicProperties Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicProperties

+
+
+
public struct MosaicProperties
+ +
+
+

The mosaic properties structure describes mosaic properties.

+ +
+
+
+
    +
  • +
    + + + + isSupplyMutable + +
    +
    +
    +
    +
    +
    +

    True if supply is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isSupplyMutable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isTransferable + +
    +
    +
    +
    +
    +
    +

    True if mosaic is transferable between non-owner accounts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isTransferable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isLevyMutable + +
    +
    +
    +
    +
    +
    +

    True if the mosaic levy is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isLevyMutable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + divisibility + +
    +
    +
    +
    +
    +
    +

    Mosaic divisibility

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let divisibility: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Number of blocks from height it will be active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/MultisigAccountGraphInfo.html b/docs/Structs/MultisigAccountGraphInfo.html new file mode 100644 index 0000000..1c552e3 --- /dev/null +++ b/docs/Structs/MultisigAccountGraphInfo.html @@ -0,0 +1,388 @@ + + + + MultisigAccountGraphInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigAccountGraphInfo

+
+
+
public struct MultisigAccountGraphInfo
+ +
+
+

@since 1.0

+ +
+
+
+ +
    +
  • +
    + + + + multisigAccounts + +
    +
    +
    +
    +
    +
    +

    Multisig accounts.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let multisigAccounts: [Int : [MultisigAccountInfo]]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + levelsNumber + +
    +
    +
    +
    +
    +
    +

    Multisig accounts levels number.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var levelsNumber: Set<Int> { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ + +
+
+
+ +
+
+ + + diff --git a/docs/Structs/MultisigAccountInfo.html b/docs/Structs/MultisigAccountInfo.html new file mode 100644 index 0000000..4792c1b --- /dev/null +++ b/docs/Structs/MultisigAccountInfo.html @@ -0,0 +1,569 @@ + + + + MultisigAccountInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigAccountInfo

+
+
+
public struct MultisigAccountInfo : Equatable
+ +
+
+

The multisig account info structure describes information of a multisig account.

+ +
+
+
+ +
    +
  • +
    + + + + account + +
    +
    +
    +
    +
    +
    +

    Account multisig public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let account: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + minApproval + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to approve a transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minApproval: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + minRemoval + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to remove a cosignatory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minRemoval: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + cosignatories + +
    +
    +
    +
    +
    +
    +

    Multisig account cosignatories.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let cosignatories: [PublicAccount]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + multisigAccounts + +
    +
    +
    +
    +
    +
    +

    Multisig accounts this account is cosigner of.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let multisigAccounts: [PublicAccount]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isMultisig + +
    +
    +
    +
    +
    +
    +

    if the account is a multisig account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isMultisig: Bool { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + hasCosigner(account:) + +
    +
    +
    +
    +
    +
    +

    Checks if an account is cosignatory of the multisig account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hasCosigner(account: PublicAccount) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    PublicAccount

    +
    +
    +
    +
    +

    Return Value

    +

    boolean

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Checks if the multisig account is cosignatory of an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func isCosignerOf(account: PublicAccount) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    PublicAccount

    +
    +
    +
    +
    +

    Return Value

    +

    boolean

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/MultisigCosignatoryModification.html b/docs/Structs/MultisigCosignatoryModification.html new file mode 100644 index 0000000..97bda19 --- /dev/null +++ b/docs/Structs/MultisigCosignatoryModification.html @@ -0,0 +1,372 @@ + + + + MultisigCosignatoryModification Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigCosignatoryModification

+
+
+
public struct MultisigCosignatoryModification
+ +
+
+

The multisig cosignatory modifications are part of the NEM’s multisig account system. +With a multisig cosignatory modification a cosignatory is added to or deleted from a multisig account. +Multisig cosignatory modifications are part of a modify multisig account transactions.

+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docs/Structs/NamespaceId.html b/docs/Structs/NamespaceId.html new file mode 100644 index 0000000..cc62a95 --- /dev/null +++ b/docs/Structs/NamespaceId.html @@ -0,0 +1,466 @@ + + + + NamespaceId Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceId

+
+
+
public struct NamespaceId : Equatable
+ +
+
+

The namespace id structure describes namespace id

+ +
+
+
+ +
    +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + fullName + +
    +
    +
    +
    +
    +
    +

    Namespace full name, with subnamespaces if it’s the case.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let fullName: String?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(fullName:) + +
    +
    +
    +
    +
    +
    +

    Create NamespaceId from namespace string name (ex: nem or domain.subdom.subdome)

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the fullName is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fullName: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fullName + + +
    +

    Namespace full name

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(id:) + +
    +
    +
    +
    +
    +
    +

    Create NamespaceId from integer id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(id: UInt64)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    +

    Compares only the ids.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: NamespaceId, rhs: NamespaceId) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/NamespaceInfo.html b/docs/Structs/NamespaceInfo.html new file mode 100644 index 0000000..cce7ae5 --- /dev/null +++ b/docs/Structs/NamespaceInfo.html @@ -0,0 +1,668 @@ + + + + NamespaceInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceInfo

+
+
+
public struct NamespaceInfo
+ +
+
+

NamespaceInfo contains the state information of a namespace.

+ +
+
+
+
    +
  • +
    + + + + isActive + +
    +
    +
    +
    +
    +
    +

    MARK: Properties +If namespace is active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isActive: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + index + +
    +
    +
    +
    +
    +
    +

    Index

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let index: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + metaId + +
    +
    +
    +
    +
    +
    +

    Meta id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let metaId: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Namespace type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: NamespaceType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + depth + +
    +
    +
    +
    +
    +
    +

    Namespace level depth

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let depth: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + levels + +
    +
    +
    +
    +
    +
    +

    Different NamespaceIds per level

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let levels: [NamespaceId]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    Parent namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + owner + +
    +
    +
    +
    +
    +
    +

    Mosaic owner account

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let owner: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + startHeight + +
    +
    +
    +
    +
    +
    +

    Block height the namespace was registered

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let startHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + endHeight + +
    +
    +
    +
    +
    +
    +

    Block height the namespace expires if not renewed

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let endHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isExpired + +
    +
    +
    +
    +
    +
    +

    Namespace expiration status

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isExpired: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var id: NamespaceId { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isRoot + +
    +
    +
    +
    +
    +
    +

    True if namespace is Root

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isRoot: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isSubNamespace + +
    +
    +
    +
    +
    +
    +

    True if namespace is SubNamespace

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isSubNamespace: Bool { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/NamespaceName.html b/docs/Structs/NamespaceName.html new file mode 100644 index 0000000..09194fc --- /dev/null +++ b/docs/Structs/NamespaceName.html @@ -0,0 +1,377 @@ + + + + NamespaceName Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceName

+
+
+
public struct NamespaceName
+ +
+
+

The namespace name info structure describes basic information of a namespace and name.

+ +
+
+
+ +
    +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    Namespace name

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let name: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    Parent namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId?
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/PrivateKey.html b/docs/Structs/PrivateKey.html new file mode 100644 index 0000000..5521231 --- /dev/null +++ b/docs/Structs/PrivateKey.html @@ -0,0 +1,489 @@ + + + + PrivateKey Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PrivateKey

+
+
+
public struct PrivateKey : Equatable, CustomStringConvertible
+ +
+
+

Represents a private key.

+ +
+
+
+ +
    +
  • +
    + + + + bytes + +
    +
    +
    +
    +
    +
    +

    The raw private key value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let bytes: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    Private key hex string description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(bytes:) + +
    +
    +
    +
    +
    +
    +

    Creates a new private key.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(bytes: [UInt8]) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bytes + + +
    +

    The raw private key value.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(hexString:) + +
    +
    +
    +
    +
    +
    +

    Creates a private key from a hex string.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid or the hex string is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(hexString: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hexString + + +
    +

    The private key hex string.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: PrivateKey, rhs: PrivateKey) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/PublicAccount.html b/docs/Structs/PublicAccount.html new file mode 100644 index 0000000..e8d83f5 --- /dev/null +++ b/docs/Structs/PublicAccount.html @@ -0,0 +1,477 @@ + + + + PublicAccount Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PublicAccount

+
+
+
public struct PublicAccount : Equatable
+ +
+
+

The public account structure contains account’s address and public key.

+ +
+
+
+ +
    +
  • +
    + + + + address + +
    +
    +
    +
    +
    +
    +

    Account address.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let address: Address
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKey + +
    +
    +
    +
    +
    +
    +

    Account public key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKey: PublicKey
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a PublicAccount from a public key and network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKey: PublicKey, networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKey + + +
    +

    Public key

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a PublicAccount from a public key hex string and network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKeyHexString: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKeyHexString + + +
    +

    Public key hex string

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/PublicKey.html b/docs/Structs/PublicKey.html new file mode 100644 index 0000000..95c6620 --- /dev/null +++ b/docs/Structs/PublicKey.html @@ -0,0 +1,489 @@ + + + + PublicKey Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PublicKey

+
+
+
public struct PublicKey : Equatable, CustomStringConvertible
+ +
+
+

Represents a public key.

+ +
+
+
+ +
    +
  • +
    + + + + bytes + +
    +
    +
    +
    +
    +
    +

    The raw public key value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let bytes: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    Public key hex string description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(bytes:) + +
    +
    +
    +
    +
    +
    +

    Creates a new public key.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(bytes: [UInt8]) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bytes + + +
    +

    The raw public key value.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(hexString:) + +
    +
    +
    +
    +
    +
    +

    Creates a public key from a hex string.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid or the hex string is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(hexString: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hexString + + +
    +

    The public key hex string.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: PublicKey, rhs: PublicKey) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/SignedTransaction.html b/docs/Structs/SignedTransaction.html new file mode 100644 index 0000000..ac83cda --- /dev/null +++ b/docs/Structs/SignedTransaction.html @@ -0,0 +1,377 @@ + + + + SignedTransaction Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

SignedTransaction

+
+
+
public struct SignedTransaction
+ +
+
+

The signed transaction object is used to transfer the transaction data and the signature to NIS

+ +
+
+
+ +
    +
  • +
    + + + + payload + +
    +
    +
    +
    +
    +
    +

    Transaction serialized data.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let payload: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: TransactionType
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/TransactionAnnounceResponse.html b/docs/Structs/TransactionAnnounceResponse.html new file mode 100644 index 0000000..d32aefb --- /dev/null +++ b/docs/Structs/TransactionAnnounceResponse.html @@ -0,0 +1,316 @@ + + + + TransactionAnnounceResponse Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionAnnounceResponse

+
+
+
public struct TransactionAnnounceResponse
+ +
+
+

The transaction response of an announce transaction.

+ +
+
+
+
    +
  • +
    + + + + message + +
    +
    +
    +
    +
    +
    +

    Success or error message.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let message: String
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/TransactionInfo.html b/docs/Structs/TransactionInfo.html new file mode 100644 index 0000000..8dd86a1 --- /dev/null +++ b/docs/Structs/TransactionInfo.html @@ -0,0 +1,766 @@ + + + + TransactionInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionInfo

+
+
+
public struct TransactionInfo
+ +
+
+

The transaction information model included in all transactions.

+ +
+
+
+ +
    +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Block height in which the transaction was included.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + index + +
    +
    +
    +
    +
    +
    +

    Index representing either transaction index/position within block or within an aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let index: Int?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Transaction id.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + merkleComponentHash + +
    +
    +
    +
    +
    +
    +

    Transaction merkle component hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let merkleComponentHash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + aggregateHash + +
    +
    +
    +
    +
    +
    +

    Hash of the aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let aggregateHash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + aggregateId + +
    +
    +
    +
    +
    +
    +

    Id of the aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let aggregateId: String?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create transaction info object for aggregate transaction inner transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createAggregate(height: UInt64, index: Int, id: String, aggregateHash: [UInt8], aggregateId: String) -> TransactionInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height in which the transaction was included.

    +
    +
    + + index + + +
    +

    The transaction index.

    +
    +
    + + id + + +
    +

    transaction id.

    +
    +
    + + aggregateHash + + +
    +

    The hash of the aggregate transaction.

    +
    +
    + + aggregateId + + +
    +

    The id of the aggregate transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of TransactionInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create transaction info object for a transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(height: UInt64, index: Int, id: String, hash: [UInt8], merkleComponentHash: [UInt8]) -> TransactionInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height in which the transaction was included.

    +
    +
    + + index + + +
    +

    The transaction index.

    +
    +
    + + id + + +
    +

    transaction id.

    +
    +
    + + hash + + +
    +

    The transaction hash.

    +
    +
    + + merkleComponentHash + + +
    +

    The transaction merkle component hash.

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of TransactionInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create transaction info retrieved by listener.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(height: UInt64, hash: [UInt8], merkleComponentHash: [UInt8]) -> TransactionInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height in which the transaction was included.

    +
    +
    + + hash + + +
    +

    The transaction hash

    +
    +
    + + merkleComponentHash + + +
    +

    The transaction merkle component hash.

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of TransactionInfo

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/TransactionStatus.html b/docs/Structs/TransactionStatus.html new file mode 100644 index 0000000..11993f7 --- /dev/null +++ b/docs/Structs/TransactionStatus.html @@ -0,0 +1,431 @@ + + + + TransactionStatus Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionStatus

+
+
+
public struct TransactionStatus
+ +
+
+

The transaction status contains basic of a transaction announced to the blockchain.

+ +
+
+
+ +
    +
  • +
    + + + + group + +
    +
    +
    +
    +
    +
    +

    Transaction status group failed, unconfirmed, confirmed, etc…

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let group: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + status + +
    +
    +
    +
    +
    +
    +

    Transaction status being the error name in case of failure and success otherwise.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let status: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + deadline + +
    +
    +
    +
    +
    +
    +

    Transaction deadline.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deadline: Deadline?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Height of the block at which it was confirmed or rejected.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64?
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/Structs/TransactionStatusError.html b/docs/Structs/TransactionStatusError.html new file mode 100644 index 0000000..323c015 --- /dev/null +++ b/docs/Structs/TransactionStatusError.html @@ -0,0 +1,370 @@ + + + + TransactionStatusError Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionStatusError

+
+
+
public struct TransactionStatusError
+ +
+
+

The transaction status error model returned by listeners.

+ +
+
+
+
    +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + status + +
    +
    +
    +
    +
    +
    +

    Transaction status error when transaction fails.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let status: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + deadline + +
    +
    +
    +
    +
    +
    +

    Transaction deadline.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deadline: Deadline
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/badge.svg b/docs/badge.svg new file mode 100644 index 0000000..bfac052 --- /dev/null +++ b/docs/badge.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + documentation + + + documentation + + + 99% + + + 99% + + + diff --git a/docs/css/highlight.css b/docs/css/highlight.css new file mode 100644 index 0000000..d0db0e1 --- /dev/null +++ b/docs/css/highlight.css @@ -0,0 +1,200 @@ +/* Credit to https://gist.github.com/wataru420/2048287 */ +.highlight { + /* Comment */ + /* Error */ + /* Keyword */ + /* Operator */ + /* Comment.Multiline */ + /* Comment.Preproc */ + /* Comment.Single */ + /* Comment.Special */ + /* Generic.Deleted */ + /* Generic.Deleted.Specific */ + /* Generic.Emph */ + /* Generic.Error */ + /* Generic.Heading */ + /* Generic.Inserted */ + /* Generic.Inserted.Specific */ + /* Generic.Output */ + /* Generic.Prompt */ + /* Generic.Strong */ + /* Generic.Subheading */ + /* Generic.Traceback */ + /* Keyword.Constant */ + /* Keyword.Declaration */ + /* Keyword.Pseudo */ + /* Keyword.Reserved */ + /* Keyword.Type */ + /* Literal.Number */ + /* Literal.String */ + /* Name.Attribute */ + /* Name.Builtin */ + /* Name.Class */ + /* Name.Constant */ + /* Name.Entity */ + /* Name.Exception */ + /* Name.Function */ + /* Name.Namespace */ + /* Name.Tag */ + /* Name.Variable */ + /* Operator.Word */ + /* Text.Whitespace */ + /* Literal.Number.Float */ + /* Literal.Number.Hex */ + /* Literal.Number.Integer */ + /* Literal.Number.Oct */ + /* Literal.String.Backtick */ + /* Literal.String.Char */ + /* Literal.String.Doc */ + /* Literal.String.Double */ + /* Literal.String.Escape */ + /* Literal.String.Heredoc */ + /* Literal.String.Interpol */ + /* Literal.String.Other */ + /* Literal.String.Regex */ + /* Literal.String.Single */ + /* Literal.String.Symbol */ + /* Name.Builtin.Pseudo */ + /* Name.Variable.Class */ + /* Name.Variable.Global */ + /* Name.Variable.Instance */ + /* Literal.Number.Integer.Long */ } + .highlight .c { + color: #999988; + font-style: italic; } + .highlight .err { + color: #a61717; + background-color: #e3d2d2; } + .highlight .k { + color: #000000; + font-weight: bold; } + .highlight .o { + color: #000000; + font-weight: bold; } + .highlight .cm { + color: #999988; + font-style: italic; } + .highlight .cp { + color: #999999; + font-weight: bold; } + .highlight .c1 { + color: #999988; + font-style: italic; } + .highlight .cs { + color: #999999; + font-weight: bold; + font-style: italic; } + .highlight .gd { + color: #000000; + background-color: #ffdddd; } + .highlight .gd .x { + color: #000000; + background-color: #ffaaaa; } + .highlight .ge { + color: #000000; + font-style: italic; } + .highlight .gr { + color: #aa0000; } + .highlight .gh { + color: #999999; } + .highlight .gi { + color: #000000; + background-color: #ddffdd; } + .highlight .gi .x { + color: #000000; + background-color: #aaffaa; } + .highlight .go { + color: #888888; } + .highlight .gp { + color: #555555; } + .highlight .gs { + font-weight: bold; } + .highlight .gu { + color: #aaaaaa; } + .highlight .gt { + color: #aa0000; } + .highlight .kc { + color: #000000; + font-weight: bold; } + .highlight .kd { + color: #000000; + font-weight: bold; } + .highlight .kp { + color: #000000; + font-weight: bold; } + .highlight .kr { + color: #000000; + font-weight: bold; } + .highlight .kt { + color: #445588; } + .highlight .m { + color: #009999; } + .highlight .s { + color: #d14; } + .highlight .na { + color: #008080; } + .highlight .nb { + color: #0086B3; } + .highlight .nc { + color: #445588; + font-weight: bold; } + .highlight .no { + color: #008080; } + .highlight .ni { + color: #800080; } + .highlight .ne { + color: #990000; + font-weight: bold; } + .highlight .nf { + color: #990000; } + .highlight .nn { + color: #555555; } + .highlight .nt { + color: #000080; } + .highlight .nv { + color: #008080; } + .highlight .ow { + color: #000000; + font-weight: bold; } + .highlight .w { + color: #bbbbbb; } + .highlight .mf { + color: #009999; } + .highlight .mh { + color: #009999; } + .highlight .mi { + color: #009999; } + .highlight .mo { + color: #009999; } + .highlight .sb { + color: #d14; } + .highlight .sc { + color: #d14; } + .highlight .sd { + color: #d14; } + .highlight .s2 { + color: #d14; } + .highlight .se { + color: #d14; } + .highlight .sh { + color: #d14; } + .highlight .si { + color: #d14; } + .highlight .sx { + color: #d14; } + .highlight .sr { + color: #009926; } + .highlight .s1 { + color: #d14; } + .highlight .ss { + color: #990073; } + .highlight .bp { + color: #999999; } + .highlight .vc { + color: #008080; } + .highlight .vg { + color: #008080; } + .highlight .vi { + color: #008080; } + .highlight .il { + color: #009999; } diff --git a/docs/css/jazzy.css b/docs/css/jazzy.css new file mode 100644 index 0000000..d628282 --- /dev/null +++ b/docs/css/jazzy.css @@ -0,0 +1,337 @@ +html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { + background: transparent; + border: 0; + margin: 0; + outline: 0; + padding: 0; + vertical-align: baseline; } + +body { + background-color: #f2f2f2; + font-family: Helvetica, freesans, Arial, sans-serif; + font-size: 14px; + -webkit-font-smoothing: subpixel-antialiased; + word-wrap: break-word; } + +h1, h2, h3 { + margin-top: 0.8em; + margin-bottom: 0.3em; + font-weight: 100; + color: black; } + +h1 { + font-size: 2.5em; } + +h2 { + font-size: 2em; + border-bottom: 1px solid #e2e2e2; } + +h4 { + font-size: 13px; + line-height: 1.5; + margin-top: 21px; } + +h5 { + font-size: 1.1em; } + +h6 { + font-size: 1.1em; + color: #777; } + +.section-name { + color: gray; + display: block; + font-family: Helvetica; + font-size: 22px; + font-weight: 100; + margin-bottom: 15px; } + +pre, code { + font: 0.95em Menlo, monospace; + color: #777; + word-wrap: normal; } + +p code, li code { + background-color: #eee; + padding: 2px 4px; + border-radius: 4px; } + +a { + color: #0088cc; + text-decoration: none; } + +ul { + padding-left: 15px; } + +li { + line-height: 1.8em; } + +img { + max-width: 100%; } + +blockquote { + margin-left: 0; + padding: 0 10px; + border-left: 4px solid #ccc; } + +.content-wrapper { + margin: 0 auto; + width: 980px; } + +header { + font-size: 0.85em; + line-height: 26px; + background-color: #414141; + position: fixed; + width: 100%; + z-index: 1; } + header img { + padding-right: 6px; + vertical-align: -4px; + height: 16px; } + header a { + color: #fff; } + header p { + float: left; + color: #999; } + header .header-right { + float: right; + margin-left: 16px; } + +#breadcrumbs { + background-color: #f2f2f2; + height: 27px; + padding-top: 17px; + position: fixed; + width: 100%; + z-index: 1; + margin-top: 26px; } + #breadcrumbs #carat { + height: 10px; + margin: 0 5px; } + +.sidebar { + background-color: #f9f9f9; + border: 1px solid #e2e2e2; + overflow-y: auto; + overflow-x: hidden; + position: fixed; + top: 70px; + bottom: 0; + width: 230px; + word-wrap: normal; } + +.nav-groups { + list-style-type: none; + background: #fff; + padding-left: 0; } + +.nav-group-name { + border-bottom: 1px solid #e2e2e2; + font-size: 1.1em; + font-weight: 100; + padding: 15px 0 15px 20px; } + .nav-group-name > a { + color: #333; } + +.nav-group-tasks { + margin-top: 5px; } + +.nav-group-task { + font-size: 0.9em; + list-style-type: none; + white-space: nowrap; } + .nav-group-task a { + color: #888; } + +.main-content { + background-color: #fff; + border: 1px solid #e2e2e2; + margin-left: 246px; + position: absolute; + overflow: hidden; + padding-bottom: 60px; + top: 70px; + width: 734px; } + .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { + margin-bottom: 1em; } + .main-content p { + line-height: 1.8em; } + .main-content section .section:first-child { + margin-top: 0; + padding-top: 0; } + .main-content section .task-group-section .task-group:first-of-type { + padding-top: 10px; } + .main-content section .task-group-section .task-group:first-of-type .section-name { + padding-top: 15px; } + .main-content section .heading:before { + content: ""; + display: block; + padding-top: 70px; + margin: -70px 0 0; } + +.section { + padding: 0 25px; } + +.highlight { + background-color: #eee; + padding: 10px 12px; + border: 1px solid #e2e2e2; + border-radius: 4px; + overflow-x: auto; } + +.declaration .highlight { + overflow-x: initial; + padding: 0 40px 40px 0; + margin-bottom: -25px; + background-color: transparent; + border: none; } + +.section-name { + margin: 0; + margin-left: 18px; } + +.task-group-section { + padding-left: 6px; + border-top: 1px solid #e2e2e2; } + +.task-group { + padding-top: 0px; } + +.task-name-container a[name]:before { + content: ""; + display: block; + padding-top: 70px; + margin: -70px 0 0; } + +.item { + padding-top: 8px; + width: 100%; + list-style-type: none; } + .item a[name]:before { + content: ""; + display: block; + padding-top: 70px; + margin: -70px 0 0; } + .item code { + background-color: transparent; + padding: 0; } + .item .token { + padding-left: 3px; + margin-left: 15px; + font-size: 11.9px; } + .item .declaration-note { + font-size: .85em; + color: gray; + font-style: italic; } + +.pointer-container { + border-bottom: 1px solid #e2e2e2; + left: -23px; + padding-bottom: 13px; + position: relative; + width: 110%; } + +.pointer { + background: #f9f9f9; + border-left: 1px solid #e2e2e2; + border-top: 1px solid #e2e2e2; + height: 12px; + left: 21px; + top: -7px; + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + position: absolute; + width: 12px; } + +.height-container { + display: none; + left: -25px; + padding: 0 25px; + position: relative; + width: 100%; + overflow: hidden; } + .height-container .section { + background: #f9f9f9; + border-bottom: 1px solid #e2e2e2; + left: -25px; + position: relative; + width: 100%; + padding-top: 10px; + padding-bottom: 5px; } + +.aside, .language { + padding: 6px 12px; + margin: 12px 0; + border-left: 5px solid #dddddd; + overflow-y: hidden; } + .aside .aside-title, .language .aside-title { + font-size: 9px; + letter-spacing: 2px; + text-transform: uppercase; + padding-bottom: 0; + margin: 0; + color: #aaa; + -webkit-user-select: none; } + .aside p:last-child, .language p:last-child { + margin-bottom: 0; } + +.language { + border-left: 5px solid #cde9f4; } + .language .aside-title { + color: #4b8afb; } + +.aside-warning { + border-left: 5px solid #ff6666; } + .aside-warning .aside-title { + color: #ff0000; } + +.graybox { + border-collapse: collapse; + width: 100%; } + .graybox p { + margin: 0; + word-break: break-word; + min-width: 50px; } + .graybox td { + border: 1px solid #e2e2e2; + padding: 5px 25px 5px 10px; + vertical-align: middle; } + .graybox tr td:first-of-type { + text-align: right; + padding: 7px; + vertical-align: top; + word-break: normal; + width: 40px; } + +.slightly-smaller { + font-size: 0.9em; } + +#footer { + position: absolute; + bottom: 10px; + margin-left: 25px; } + #footer p { + margin: 0; + color: #aaa; + font-size: 0.8em; } + +html.dash header, html.dash #breadcrumbs, html.dash .sidebar { + display: none; } +html.dash .main-content { + width: 980px; + margin-left: 0; + border: none; + width: 100%; + top: 0; + padding-bottom: 0; } +html.dash .height-container { + display: block; } +html.dash .item .token { + margin-left: 0; } +html.dash .content-wrapper { + width: auto; } +html.dash #footer { + position: static; } diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Info.plist b/docs/docsets/Nem2SdkSwift.docset/Contents/Info.plist new file mode 100644 index 0000000..2cc5f73 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleIdentifier + com.jazzy.nem2sdkswift + CFBundleName + Nem2SdkSwift + DocSetPlatformFamily + nem2sdkswift + isDashDocset + + dashIndexFilePath + index.html + isJavaScriptEnabled + + DashDocSetFamily + dashtoc + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes.html new file mode 100644 index 0000000..51f6047 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes.html @@ -0,0 +1,1116 @@ + + + + Classes Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Classes

+

The following classes are available globally.

+ +
+
+
+
    +
  • +
    + + + + Hashes + +
    +
    +
    +
    +
    +
    +

    Static class that exposes hash functions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Hashes
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + KeyPair + +
    +
    +
    +
    +
    +
    +

    Key pair of a private key and the public key

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class KeyPair
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + HexEncoder + +
    +
    +
    +
    +
    +
    +

    Static class that contains utility functions for converting hex strings to and from bytes.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class HexEncoder
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+ +
+
+
    +
  • +
    + + + + Listener + +
    +
    +
    +
    +
    +
    +

    WebSocket Listener

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Listener
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicHttp + +
    +
    +
    +
    +
    +
    +

    Mosaic http repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class MosaicHttp : Http, MosaicRepository
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+ +
+
+ +
+
+
    +
  • +
    + + + + Account + +
    +
    +
    +
    +
    +
    +

    The account structure describes an account private key, public key, address and allows signing transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Account
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + XEM + +
    +
    +
    +
    +
    +
    +

    XEM Mosaic

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class XEM
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + AggregateTransaction + +
    +
    +
    +
    +
    +
    +

    The aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class AggregateTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The cosignature transaction is used to sign an aggregate transactions with missing cosignatures.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class CosignatureTransaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Deadline + +
    +
    +
    +
    +
    +
    +

    The deadline of the transaction. The deadline is given as the number of seconds elapsed since the creation of the nemesis block.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Deadline
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + LockFundsTransaction + +
    +
    +
    +
    +
    +
    +

    Lock funds transaction is used before sending an Aggregate bonded transaction, as a deposit to announce the transaction. + When aggregate bonded transaction is confirmed funds are returned to LockFundsTransaction signer.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class LockFundsTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Message + +
    +
    +
    +
    +
    +
    +

    An abstract message class that serves as the base class of all message types.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Message
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Modify multisig account transactions are part of the NEM’s multisig account system. +A modify multisig account transaction holds an array of multisig cosignatory modifications, min number of signatures to approve a transaction and a min number of signatures to remove a cosignatory.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class ModifyMultisigAccountTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Before a mosaic can be created or transferred, a corresponding definition of the mosaic has to be created and published to the network. +This is done via a mosaic definition transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class MosaicDefinitionTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    In case a mosaic has the flag ‘supplyMutable’ set to true, the creator of the mosaic can change the supply, +i.e. increase or decrease the supply.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class MosaicSupplyChangeTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + PlainMessage + +
    +
    +
    +
    +
    +
    +

    The plain message model defines a plain string. When sending it to the network we transform the payload to hex-string.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class PlainMessage : Message
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Accounts can rent a namespace for an amount of blocks and after a this renew the contract. +This is done via a RegisterNamespaceTransaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class RegisterNamespaceTransaction : Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+ +
+
+
    +
  • +
    + + + + Transaction + +
    +
    +
    +
    +
    +
    +

    An abstract transaction class that serves as the base class of all NEM transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public class Transaction
    + +
    +
    +
    +
    +
  • +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Account.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Account.html new file mode 100644 index 0000000..9189558 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Account.html @@ -0,0 +1,794 @@ + + + + Account Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Account

+
+
+
public class Account
+ +
+
+

The account structure describes an account private key, public key, address and allows signing transactions.

+ +
+
+
+ +
    +
  • +
    + + + + keyPair + +
    +
    +
    +
    +
    +
    +

    Account keyPair containing public and private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let keyPair: KeyPair
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicAccount + +
    +
    +
    +
    +
    +
    +

    Public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicAccount: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + address + +
    +
    +
    +
    +
    +
    +

    Account address

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var address: Address { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKeyHexString + +
    +
    +
    +
    +
    +
    +

    Account public key hex string

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var publicKeyHexString: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKeyBytes + +
    +
    +
    +
    +
    +
    +

    Account public key bytes

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var publicKeyBytes: [UInt8] { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + privateKeyHexString + +
    +
    +
    +
    +
    +
    +

    Account private key hex string

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var privateKeyHexString: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create an Account from a given private key hex string.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the private key hex string is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(privateKeyHexString: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + privateKeyHexString + + +
    +

    Private key hex string

    +
    +
    + + networkType + + +
    +

    NetworkType

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create an Account from a given private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(keyPair: KeyPair, networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + keyPair + + +
    +

    Key pair

    +
    +
    + + networkType + + +
    +

    NetworkType

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(networkType:) + +
    +
    +
    +
    +
    +
    +

    Create an Account with random generated private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + networkType + + +
    +

    NetworkType

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + sign(transaction:) + +
    +
    +
    +
    +
    +
    +

    Sign a transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func sign(transaction: Transaction) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + transaction + + +
    +

    The transaction to be signed.

    +
    +
    +
    +
    +

    Return Value

    +

    SignedTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Sign aggregate signature transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func sign(cosignatureTransaction: CosignatureTransaction) -> CosignatureSignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + cosignatureTransaction + + +
    +

    The aggregate signature transaction.

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Sign transaction with cosignatories creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func sign(aggregateTransaction: AggregateTransaction, with cosignatories: [Account]) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + transaction + + +
    +

    The aggregate transaction to be signed.

    +
    +
    + + cosignatories + + +
    +

    The list of accounts that will cosign the transaction

    +
    +
    +
    +
    +

    Return Value

    +

    SignedTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/AccountHttp.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/AccountHttp.html new file mode 100644 index 0000000..9ef2ba3 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/AccountHttp.html @@ -0,0 +1,335 @@ + + + + AccountHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AccountHttp

+
+
+
public class AccountHttp : Http, AccountRepository
+ +
+
+

Account http repository

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/AggregateTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/AggregateTransaction.html new file mode 100644 index 0000000..bf76168 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/AggregateTransaction.html @@ -0,0 +1,627 @@ + + + + AggregateTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AggregateTransaction

+
+
+
public class AggregateTransaction : Transaction
+ +
+
+

The aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts.

+ +
+
+
+ +
    +
  • +
    + + + + innerTransactions + +
    +
    +
    +
    +
    +
    +

    List of innerTransactions included in the aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let innerTransactions: [Transaction]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + cosignatures + +
    +
    +
    +
    +
    +
    +

    List of transaction cosigners signatures.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let cosignatures: [AggregateTransactionCosignature]
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create an aggregate complete transaction object

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createComplete(
    +        innerTransactions: [Transaction],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60) ) throws -> AggregateTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + deadline + + +
    +

    The deadline to include the transaction.

    +
    +
    + + innerTransactions + + +
    +

    The list of inner innerTransactions.

    +
    +
    + + networkType + + +
    +

    The network type.

    +
    +
    +
    +
    +

    Return Value

    +

    AggregateTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create an aggregate bonded transaction object

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createBonded(
    +        innerTransactions: [Transaction],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60 ) ) throws -> AggregateTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + innerTransactions + + +
    +

    The list of inner innerTransactions.

    +
    +
    + + networkType + + +
    +

    The network type.

    +
    +
    + + deadline + + +
    +

    The deadline to include the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    AggregateTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Sign transaction with cosignatories creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signWith(initiatorAccount: Account, cosignatories: [Account]) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + initiatorAccount + + +
    +

    Initiator account

    +
    +
    + + cosignatories + + +
    +

    The list of accounts that will cosign the transaction

    +
    +
    +
    +
    +

    Return Value

    +

    Signed transaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Check if account has signed transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signedByAccount(publicAccount: PublicAccount) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + publicAccount + + +
    +

    Signer public account

    +
    +
    +
    +
    +

    Return Value

    +

    boolean

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/BlockchainHttp.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/BlockchainHttp.html new file mode 100644 index 0000000..339c947 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/BlockchainHttp.html @@ -0,0 +1,335 @@ + + + + BlockchainHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainHttp

+
+
+
public class BlockchainHttp : Http, BlockchainRepository
+ +
+
+

Blockchain http repository

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/CosignatureTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/CosignatureTransaction.html new file mode 100644 index 0000000..a95a32d --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/CosignatureTransaction.html @@ -0,0 +1,430 @@ + + + + CosignatureTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

CosignatureTransaction

+
+
+
public class CosignatureTransaction
+ +
+
+

The cosignature transaction is used to sign an aggregate transactions with missing cosignatures.

+ +
+
+
+ + +
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(transactionToCosign: AggregateTransaction) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + transactionToCosign + + +
    +

    Aggregate transaction that will be cosigned.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + signWith(account:) + +
    +
    +
    +
    +
    +
    +

    Serialize and sign transaction creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signWith(account: Account) -> CosignatureSignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    Account

    +
    +
    +
    +
    +

    Return Value

    +

    CosignatureSignedTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Deadline.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Deadline.html new file mode 100644 index 0000000..04dfc40 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Deadline.html @@ -0,0 +1,462 @@ + + + + Deadline Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Deadline

+
+
+
public class Deadline
+ +
+
+

The deadline of the transaction. The deadline is given as the number of seconds elapsed since the creation of the nemesis block.

+ +
+
+
+
    +
  • +
    + + + + dateOfNemesisBlock + +
    +
    +
    +
    +
    +
    +

    Nemesis block date. The date is 2016/04/01 00:00:00 UTC.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let dateOfNemesisBlock: Date
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + date + +
    +
    +
    +
    +
    +
    +

    Deadline date

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let date: Date
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + timestamp + +
    +
    +
    +
    +
    +
    +

    Number of milli seconds elapsed since the creation of the nemesis block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var timestamp: UInt64 { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(fromNow:) + +
    +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fromNow interval: TimeInterval)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fromNow + + +
    +

    Duration time from now

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(fromNemesis:) + +
    +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fromNemesis interval: TimeInterval)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fromNemesis + + +
    +

    Duration time from nemesis block

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Hashes.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Hashes.html new file mode 100644 index 0000000..047f071 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Hashes.html @@ -0,0 +1,446 @@ + + + + Hashes Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Hashes

+
+
+
public class Hashes
+ +
+
+

Static class that exposes hash functions.

+ +
+
+
+ +
    +
  • +
    + + + + sha3_256(_:) + +
    +
    +
    +
    +
    +
    +

    Performs a SHA3-256 hash of the inputs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func sha3_256(_ inputs: [UInt8]) -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + inputs + + +
    +

    The byte arrays to hash.

    +
    +
    +
    +
    +

    Return Value

    +

    The hash of the inputs.

    +
    +
    +
    +
  • +
  • +
    + + + + sha3_512(_:) + +
    +
    +
    +
    +
    +
    +

    Performs a SHA3-512 hash of the inputs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func sha3_512(_ inputs: [UInt8]) -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + inputs + + +
    +

    The byte arrays to hash.

    +
    +
    +
    +
    +

    Return Value

    +

    The hash of the inputs.

    +
    +
    +
    +
  • +
  • +
    + + + + ripemd160(_:) + +
    +
    +
    +
    +
    +
    +

    Performs a RIPEMD160 hash of the inputs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func ripemd160(_ inputs: [UInt8]) -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + inputs + + +
    +

    The byte arrays to hash.

    +
    +
    +
    +
    +

    Return Value

    +

    The hash of the inputs.

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/HexEncoder.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/HexEncoder.html new file mode 100644 index 0000000..b0b1866 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/HexEncoder.html @@ -0,0 +1,401 @@ + + + + HexEncoder Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

HexEncoder

+
+
+
public class HexEncoder
+ +
+
+

Static class that contains utility functions for converting hex strings to and from bytes.

+ +
+
+
+ +
    +
  • +
    + + + + toHexString(_:) + +
    +
    +
    +
    +
    +
    +

    Converts bytes to hex string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func toHexString(_ bytes: [UInt8]) -> String
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bytes + + +
    +

    Bytes

    +
    +
    +
    +
    +

    Return Value

    +

    Hex string

    +
    +
    +
    +
  • +
  • +
    + + + + toBytes(_:) + +
    +
    +
    +
    +
    +
    +

    Converts bytes to hex string

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the input is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func toBytes(_ input: String) throws -> [UInt8]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + input + + +
    +

    Hex string

    +
    +
    +
    +
    +

    Return Value

    +

    Bytes

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/KeyPair.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/KeyPair.html new file mode 100644 index 0000000..769d4b5 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/KeyPair.html @@ -0,0 +1,435 @@ + + + + KeyPair Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

KeyPair

+
+
+
public class KeyPair
+ +
+
+

Key pair of a private key and the public key

+ +
+
+
+ +
    +
  • +
    + + + + privateKey + +
    +
    +
    +
    +
    +
    +

    Private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let privateKey: PrivateKey
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKey + +
    +
    +
    +
    +
    +
    +

    Public key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKey: PublicKey
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    Creates a random key pair.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init()
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(privateKey:) + +
    +
    +
    +
    +
    +
    +

    Creates a key pair around a private key. + The public key is calculated from the private key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(privateKey: PrivateKey)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + privateKey + + +
    +

    The private key.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Listener.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Listener.html new file mode 100644 index 0000000..1ffc8d4 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Listener.html @@ -0,0 +1,828 @@ + + + + Listener Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Listener

+
+
+
public class Listener
+ +
+
+

WebSocket Listener

+ +
+
+
+ +
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Creates WebSocket Listener.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + open() + +
    +
    +
    +
    +
    +
    +

    Opens WebSocket connection.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func open() -> Completable
    + +
    +
    +
    +

    Return Value

    +

    Completable that resolves when the WebSocket connection is opened

    +
    +
    +
    +
  • +
  • +
    + + + + close() + +
    +
    +
    +
    +
    +
    +

    Close webSocket connection

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func close()
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + newBlock() + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of BlockInfo. + Each time a new Block is added into the blockchain, + it emits a new BlockInfo in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func newBlock() -> Observable<BlockInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable stream of BlockInfo

    +
    +
    +
    +
  • +
  • +
    + + + + confirmed(address:) + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction for a specific address. + Each time a transaction is in confirmed state an it involves the address, + it emits a new Transaction in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func confirmed(address: Address) -> Observable<Transaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is in confirmed state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Transaction with state confirmed

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction for a specific address. + Each time a transaction is in unconfirmed state an it involves the address, + it emits a new Transaction in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func unconfirmedAdded(address: Address) -> Observable<Transaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is in unconfirmed state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Transaction with state unconfirmed

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction Hashes for specific address. + Each time a transaction with state unconfirmed changes its state, + it emits a new message with the transaction hash in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func unconfirmedRemoved(address: Address) -> Observable<[UInt8]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is removed from unconfirmed state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Strings with the transaction hash

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Return an observable of AggregateTransaction for specific address. + Each time an aggregate bonded transaction is announced, + it emits a new AggregateTransaction in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func aggregateBondedAdded(address: Address) -> Observable<AggregateTransaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    address we listen when a transaction with missing signatures state

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of AggregateTransaction with missing signatures state

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of Transaction Hashes for specific address. + Each time an aggregate bonded transaction is announced, + it emits a new message with the transaction hash in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func aggregateBondedRemoved(address: Address) -> Observable<[UInt8]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a transaction is confirmed or rejected

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of Strings with the transaction hash

    +
    +
    +
    +
  • +
  • +
    + + + + status(address:) + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of {@link TransactionStatusError} for specific address. + Each time a transaction contains an error, + it emits a new message with the transaction status error in the event stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func status(address: Address) -> Observable<TransactionStatusError>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen to be notified when some error happened

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of TransactionStatusError

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns an observable stream of CosignatureSignedTransaction for specific address. + Each time a cosigner signs a transaction the address initialized, + it emits a new message with the cosignatory signed transaction in the even stream.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func cosignatureAdded(address: Address) -> Observable<CosignatureSignedTransaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + address + + +
    +

    Address we listen when a cosignatory is added to some transaction address sent

    +
    +
    +
    +
    +

    Return Value

    +

    Observable stream of CosignatureSignedTransaction

    +
    +
    +
    +
  • +
  • +
    + + + + error() + +
    +
    +
    +
    +
    +
    +

    Returns an observable stream of Error.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func error() -> Observable<Error>
    + +
    +
    +
    +

    Return Value

    +

    Observable stream of Error.

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/LockFundsTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/LockFundsTransaction.html new file mode 100644 index 0000000..c54f36c --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/LockFundsTransaction.html @@ -0,0 +1,474 @@ + + + + LockFundsTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

LockFundsTransaction

+
+
+
public class LockFundsTransaction : Transaction
+ +
+
+

Lock funds transaction is used before sending an Aggregate bonded transaction, as a deposit to announce the transaction. + When aggregate bonded transaction is confirmed funds are returned to LockFundsTransaction signer.

+ +
+
+
+
    +
  • +
    + + + + mosaic + +
    +
    +
    +
    +
    +
    +

    Locked mosaic.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaic: Mosaic
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Funds lock duration in number of blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signedTransaction + +
    +
    +
    +
    +
    +
    +

    Signed transaction for which funds are locked.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signedTransaction: SignedTransaction
    + +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a lock funds transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaic: Mosaic,
    +        duration: UInt64,
    +        signedTransaction: SignedTransaction,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> LockFundsTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaic + + +
    +

    Locked mosaic.

    +
    +
    + + duration + + +
    +

    Funds lock duration in number of blocks.

    +
    +
    + + signedTransaction + + +
    +

    Signed transaction for which funds are locked.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    LockFundsTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Message.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Message.html new file mode 100644 index 0000000..8cb4661 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Message.html @@ -0,0 +1,350 @@ + + + + Message Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Message

+
+
+
public class Message
+ +
+
+

An abstract message class that serves as the base class of all message types.

+ +
+
+
+ +
    +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Message type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: UInt8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + payload + +
    +
    +
    +
    +
    +
    +

    Returns message payload.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let payload: [UInt8]
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/ModifyMultisigAccountTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/ModifyMultisigAccountTransaction.html new file mode 100644 index 0000000..05de591 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/ModifyMultisigAccountTransaction.html @@ -0,0 +1,494 @@ + + + + ModifyMultisigAccountTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

ModifyMultisigAccountTransaction

+
+
+
public class ModifyMultisigAccountTransaction : Transaction
+ +
+
+

Modify multisig account transactions are part of the NEM’s multisig account system. +A modify multisig account transaction holds an array of multisig cosignatory modifications, min number of signatures to approve a transaction and a min number of signatures to remove a cosignatory.

+ +
+
+
+ +
    +
  • +
    + + + + minApprovalDelta + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to approve a transaction. +If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minApprovalDelta: Int8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + minRemovalDelta + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to remove a cosignatory. +If we are modifying and existing multi-signature account this indicates the relative change of the minimum cosignatories.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minRemovalDelta: Int8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + modifications + +
    +
    +
    +
    +
    +
    +

    List of cosigner accounts added or removed from the multi-signature account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let modifications: [MultisigCosignatoryModification]
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a modify multisig account transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        minApprovalDelta: Int8,
    +        minRemovalDelta: Int8,
    +        modifications: [MultisigCosignatoryModification],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> ModifyMultisigAccountTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + minApprovalDelta + + +
    +

    Min approval relative change.

    +
    +
    + + minRemovalDelta + + +
    +

    Min removal relative change.

    +
    +
    + + modifications + + +
    +

    List of modifications.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    ModifyMultisigAccountTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicDefinitionTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicDefinitionTransaction.html new file mode 100644 index 0000000..efa423a --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicDefinitionTransaction.html @@ -0,0 +1,519 @@ + + + + MosaicDefinitionTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicDefinitionTransaction

+
+
+
public class MosaicDefinitionTransaction : Transaction
+ +
+
+

Before a mosaic can be created or transferred, a corresponding definition of the mosaic has to be created and published to the network. +This is done via a mosaic definition transaction.

+ +
+
+
+ +
    +
  • +
    + + + + mosaicName + +
    +
    +
    +
    +
    +
    +

    Mosaic name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicName: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id generated from namespace name and mosaic name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    Namespace id generated from namespace name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicProperties + +
    +
    +
    +
    +
    +
    +

    Mosaic properties defining mosaic.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicProperties: MosaicProperties
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a mosaic creation transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaicName: String,
    +        namespaceFullName: String,
    +        mosaicProperties: MosaicProperties,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> MosaicDefinitionTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaicName + + +
    +

    Mosaic name ex: xem.

    +
    +
    + + namespaceFullName + + +
    +

    Namespace where mosaic will be included ex: nem.

    +
    +
    + + mosaicProperties + + +
    +

    Mosaic properties.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    MosaicDefinitionTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicHttp.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicHttp.html new file mode 100644 index 0000000..f66aeda --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicHttp.html @@ -0,0 +1,335 @@ + + + + MosaicHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicHttp

+
+
+
public class MosaicHttp : Http, MosaicRepository
+ +
+
+

Mosaic http repository.

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicSupplyChangeTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicSupplyChangeTransaction.html new file mode 100644 index 0000000..dee93d9 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/MosaicSupplyChangeTransaction.html @@ -0,0 +1,492 @@ + + + + MosaicSupplyChangeTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicSupplyChangeTransaction

+
+
+
public class MosaicSupplyChangeTransaction : Transaction
+ +
+
+

In case a mosaic has the flag ‘supplyMutable’ set to true, the creator of the mosaic can change the supply, +i.e. increase or decrease the supply.

+ +
+
+
+ +
    +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicSupplyType + +
    +
    +
    +
    +
    +
    +

    Mosaic supply type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicSupplyType: MosaicSupplyType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + delta + +
    +
    +
    +
    +
    +
    +

    Amount of mosaics added or removed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let delta: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a mosaic supply change transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaicId: MosaicId,
    +        mosaicSupplyType: MosaicSupplyType,
    +        delta: UInt64,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> MosaicSupplyChangeTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaicId + + +
    +

    Mosaic id.

    +
    +
    + + mosaicSupplyType + + +
    +

    Supply type.

    +
    +
    + + delta + + +
    +

    Supply change in units for the mosaic.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    MosaicSupplyChangeTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/NamespaceHttp.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/NamespaceHttp.html new file mode 100644 index 0000000..d6d73f9 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/NamespaceHttp.html @@ -0,0 +1,335 @@ + + + + NamespaceHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceHttp

+
+
+
public class NamespaceHttp : Http, NamespaceRepository
+ +
+
+

Namespace http repository

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/NetworkHttp.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/NetworkHttp.html new file mode 100644 index 0000000..b289293 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/NetworkHttp.html @@ -0,0 +1,335 @@ + + + + NetworkHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NetworkHttp

+
+
+
public class NetworkHttp : Http, NetworkRepository
+ +
+
+

Network http repository.

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/PlainMessage.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/PlainMessage.html new file mode 100644 index 0000000..4929ee2 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/PlainMessage.html @@ -0,0 +1,396 @@ + + + + PlainMessage Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PlainMessage

+
+
+
public class PlainMessage : Message
+ +
+
+

The plain message model defines a plain string. When sending it to the network we transform the payload to hex-string.

+ +
+
+
+ +
    +
  • +
    + + + + empty + +
    +
    +
    +
    +
    +
    +

    Plain message containing an empty string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let empty: PlainMessage
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + text + +
    +
    +
    +
    +
    +
    +

    Plain text message. Nil If loaded payload cannot be decoded as utf-8 string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let text: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(text:) + +
    +
    +
    +
    +
    +
    +

    Constructor

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(text: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + text + + +
    +

    plain message text.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/RegisterNamespaceTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/RegisterNamespaceTransaction.html new file mode 100644 index 0000000..e71f770 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/RegisterNamespaceTransaction.html @@ -0,0 +1,624 @@ + + + + RegisterNamespaceTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

RegisterNamespaceTransaction

+
+
+
public class RegisterNamespaceTransaction : Transaction
+ +
+
+

Accounts can rent a namespace for an amount of blocks and after a this renew the contract. +This is done via a RegisterNamespaceTransaction.

+ +
+
+
+ +
    +
  • +
    + + + + namespaceName + +
    +
    +
    +
    +
    +
    +

    Namespace name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceName: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    ID of the namespace derived from namespaceName. +When creating a sub namespace the namespaceId is derived from namespaceName and parentId.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceType + +
    +
    +
    +
    +
    +
    +

    Namespace type either rootNamespace or subNamespace.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceType: NamespaceType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Number of blocks a namespace is active.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    ID of the parent of sub namespace.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a root namespace object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createRootNamespace(
    +        namespaceName: String,
    +        duration: UInt64,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> RegisterNamespaceTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + namespaceName + + +
    +

    Namespace name.

    +
    +
    + + duration + + +
    +

    Duration of the namespace.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of RegisterNamespaceTransaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a sub namespace object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createSubNamespace(
    +        namespaceName: String,
    +        parentId: NamespaceId,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) throws -> RegisterNamespaceTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + namespaceName + + +
    +

    Namespace name.

    +
    +
    + + parentId + + +
    +

    Parent id name.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of RegisterNamespaceTransaction

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/SecretLockTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/SecretLockTransaction.html new file mode 100644 index 0000000..c32b73a --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/SecretLockTransaction.html @@ -0,0 +1,571 @@ + + + + SecretLockTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

SecretLockTransaction

+
+
+
public class SecretLockTransaction : Transaction
+ +
+
+

Secret lock transaction

+ +
+
+
+ +
    +
  • +
    + + + + mosaic + +
    +
    +
    +
    +
    +
    +

    Locked mosaic.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaic: Mosaic
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Duration for the funds to be released or returned.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hashType + +
    +
    +
    +
    +
    +
    +

    Hash algorithm, secret is generated with.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hashType: HashType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secret + +
    +
    +
    +
    +
    +
    +

    Proof hashed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let secret: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + recipient + +
    +
    +
    +
    +
    +
    +

    Recipient of the funds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let recipient: Address
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a secret lock transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        mosaic: Mosaic,
    +        duration: UInt64,
    +        hashType: HashType,
    +        secret: [UInt8],
    +        recipient: Address,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> SecretLockTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + mosaic + + +
    +

    Locked mosaic.

    +
    +
    + + duration + + +
    +

    Duration for the funds to be released or returned.

    +
    +
    + + hashType + + +
    +

    Hash algorithm secret is generated with.

    +
    +
    + + secret + + +
    +

    Proof hashed.

    +
    +
    + + recipient + + +
    +

    Recipient of the funds.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    a SecretLockTransaction instance

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/SecretProofTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/SecretProofTransaction.html new file mode 100644 index 0000000..1ac6f8b --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/SecretProofTransaction.html @@ -0,0 +1,503 @@ + + + + SecretProofTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

SecretProofTransaction

+
+
+
public class SecretProofTransaction : Transaction
+ +
+
+

Secret lock transaction

+ +
+
+
+ +
    +
  • +
    + + + + hashType + +
    +
    +
    +
    +
    +
    +

    Hash algorithm, secret is generated with.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hashType: HashType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secret + +
    +
    +
    +
    +
    +
    +

    Proof hashed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let secret: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + proof + +
    +
    +
    +
    +
    +
    +

    Proof.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let proof: [UInt8]
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a secret proof transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        hashType: HashType,
    +        secret: [UInt8],
    +        proof: [UInt8],
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> SecretProofTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + hashType + + +
    +

    Hash algorithm secret is generated with.

    +
    +
    + + secret + + +
    +

    Proof hashed.

    +
    +
    + + proof + + +
    +

    Proof.

    +
    +
    + + recipient + + +
    +

    Recipient of the funds.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +

    Return Value

    +

    a SecretProofTransaction instance

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Transaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Transaction.html new file mode 100644 index 0000000..3137a05 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/Transaction.html @@ -0,0 +1,731 @@ + + + + Transaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Transaction

+
+
+
public class Transaction
+ +
+
+

An abstract transaction class that serves as the base class of all NEM transactions.

+ +
+
+
+ +
    +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: TransactionType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + networkType + +
    +
    +
    +
    +
    +
    +

    Network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let networkType: NetworkType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + version + +
    +
    +
    +
    +
    +
    +

    Transaction version.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let version: UInt8
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + deadline + +
    +
    +
    +
    +
    +
    +

    Deadline to include the transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deadline: Deadline
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + fee + +
    +
    +
    +
    +
    +
    +

    Fee for the transaction. The higher the fee, the higher the priority of the transaction. Transactions with high priority get included in a block before transactions with lower priority.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let fee: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    Transaction signature (missing if part of an aggregate transaction).

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Transaction creator public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var signer: PublicAccount?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + transactionInfo + +
    +
    +
    +
    +
    +
    +

    Meta data object contains additional information about the transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let transactionInfo: TransactionInfo?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isUnconfirmed + +
    +
    +
    +
    +
    +
    +

    If a transaction is pending to be included in a block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isUnconfirmed: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isConfirmed + +
    +
    +
    +
    +
    +
    +

    If a transaction is included in a block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isConfirmed: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hasMissingSignatures + +
    +
    +
    +
    +
    +
    +

    if a transaction has missing signatures.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasMissingSignatures: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isUnannounced + +
    +
    +
    +
    +
    +
    +

    If a transaction is not known by the network.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isUnannounced: Bool { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + signWith(account:) + +
    +
    +
    +
    +
    +
    +

    Serialize and sign transaction creating a new SignedTransaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func signWith(account: Account) -> SignedTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    The account to sign the transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    Signed transaction.

    +
    +
    +
    +
  • +
  • +
    + + + + toAggregate(signer:) + +
    +
    +
    +
    +
    +
    +

    Convert an aggregate transaction to an inner transaction including transaction signer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func toAggregate(signer: PublicAccount) -> Transaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + signer + + +
    +

    Transaction signer.

    +
    +
    +
    +
    +

    Return Value

    +

    instance of Transaction with signer

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/TransactionHttp.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/TransactionHttp.html new file mode 100644 index 0000000..1715217 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/TransactionHttp.html @@ -0,0 +1,335 @@ + + + + TransactionHttp Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionHttp

+
+
+
public class TransactionHttp : Http, TransactionRepository
+ +
+
+

Transaction http repository.

+ +
+
+
+
    +
  • +
    + + + + init(url:) + +
    +
    +
    +
    +
    +
    +

    Constructs with host.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public override init(url: URL)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + url + + +
    +

    Host url.

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/TransferTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/TransferTransaction.html new file mode 100644 index 0000000..51f747a --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/TransferTransaction.html @@ -0,0 +1,469 @@ + + + + TransferTransaction Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransferTransaction

+
+
+
public class TransferTransaction : Transaction
+ +
+
+

Transfer transaction.

+ +
+
+
+
    +
  • +
    + + + + recipient + +
    +
    +
    +
    +
    +
    +

    Address of the recipient.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let recipient: Address
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaics + +
    +
    +
    +
    +
    +
    +

    List of mosaic objects.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaics: [Mosaic]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + message + +
    +
    +
    +
    +
    +
    +

    Transaction message.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let message: Message?
    + +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a transfer transaction object.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(
    +        recipient: Address,
    +        mosaics: [Mosaic],
    +        message: Message? = nil,
    +        networkType: NetworkType,
    +        deadline: Deadline = Deadline(fromNow: 60 * 60)) -> TransferTransaction
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + recipient + + +
    +

    Recipient of the transaction.

    +
    +
    + + mosaics + + +
    +

    Array of mosaics.

    +
    +
    + + message + + +
    +

    Transaction message.

    +
    +
    + + networkType + + +
    +

    Network type.

    +
    +
    + + deadline + + +
    +

    Deadline to include the transaction.(Optional. The default is 1 hour from now.)

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/XEM.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/XEM.html new file mode 100644 index 0000000..ee670c7 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Classes/XEM.html @@ -0,0 +1,558 @@ + + + + XEM Class Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

XEM

+
+
+
public class XEM
+ +
+
+

XEM Mosaic

+ +
+
+
+ +
    +
  • +
    + + + + divisibility + +
    +
    +
    +
    +
    +
    +

    Divisibility

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let divisibility: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + initialSupply + +
    +
    +
    +
    +
    +
    +

    Initial supply

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let initialSupply: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + transferable + +
    +
    +
    +
    +
    +
    +

    Is transferable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let transferable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + supplyMutable + +
    +
    +
    +
    +
    +
    +

    Is supply mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let supplyMutable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + of(xemAmount:) + +
    +
    +
    +
    +
    +
    +

    Create xem with using xem as unit.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func of(xemAmount: Decimal) -> Mosaic
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + xemAmount + + +
    +

    XEM amount

    +
    +
    +
    +
    +

    Return Value

    +

    XEM Mosaic

    +
    +
    +
    +
  • +
  • +
    + + + + of(microXemAmount:) + +
    +
    +
    +
    +
    +
    +

    Create xem with using micro xem as unit, 1 XEM = 1000000 micro XEM.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func of(microXemAmount: UInt64) -> Mosaic
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + microXemAmount + + +
    +

    micro XEM amount

    +
    +
    +
    +
    +

    Return Value

    +

    XEM Mosaic

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums.html new file mode 100644 index 0000000..6683c97 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums.html @@ -0,0 +1,503 @@ + + + + Enumerations Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Enumerations

+

The following enumerations are available globally.

+ +
+
+
+
    +
  • +
    + + + + Nem2SdkSwiftError + +
    +
    +
    +
    +
    +
    +

    Errors from Nem2SdkSwift

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Nem2SdkSwiftError : Error
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NetworkType + +
    +
    +
    +
    +
    +
    +

    Network type

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum NetworkType : UInt8, CaseIterable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicSupplyType + +
    +
    +
    +
    +
    +
    +

    Undocumented

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum MosaicSupplyType : UInt8, CaseIterable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceType + +
    +
    +
    +
    +
    +
    +

    Namespace level type

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum NamespaceType : UInt8, CaseIterable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + HashType + +
    +
    +
    +
    +
    +
    +

    Enum containing hash type.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum HashType : UInt8
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Enum containing multisig cosignatory modification type constants.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum MultisigCosignatoryModificationType : UInt8
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionType + +
    +
    +
    +
    +
    +
    +

    Enum containing transaction type constants.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum TransactionType : UInt16
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/HashType.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/HashType.html new file mode 100644 index 0000000..b7d064e --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/HashType.html @@ -0,0 +1,316 @@ + + + + HashType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

HashType

+
+
+
public enum HashType : UInt8
+ +
+
+

Enum containing hash type.

+ +
+
+
+
    +
  • +
    + + + + sha3_512 + +
    +
    +
    +
    +
    +
    +

    SHA3 512

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case sha3_512 = 0
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/MosaicSupplyType.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/MosaicSupplyType.html new file mode 100644 index 0000000..7d6278f --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/MosaicSupplyType.html @@ -0,0 +1,343 @@ + + + + MosaicSupplyType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicSupplyType

+
+
+
public enum MosaicSupplyType : UInt8, CaseIterable
+ +
+
+

Undocumented

+ +
+
+
+
    +
  • +
    + + + + decrease + +
    +
    +
    +
    +
    +
    +

    Decrease the supply.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case decrease = 0
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + increase + +
    +
    +
    +
    +
    +
    +

    Increase the supply.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case increase = 1
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/MultisigCosignatoryModificationType.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/MultisigCosignatoryModificationType.html new file mode 100644 index 0000000..4d50f31 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/MultisigCosignatoryModificationType.html @@ -0,0 +1,343 @@ + + + + MultisigCosignatoryModificationType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigCosignatoryModificationType

+
+
+
public enum MultisigCosignatoryModificationType : UInt8
+ +
+
+

Enum containing multisig cosignatory modification type constants.

+ +
+
+
+
    +
  • +
    + + + + add + +
    +
    +
    +
    +
    +
    +

    Add cosignatory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case add = 0
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + remove + +
    +
    +
    +
    +
    +
    +

    Remove cosignatory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case remove = 1
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/NamespaceType.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/NamespaceType.html new file mode 100644 index 0000000..4eed95d --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/NamespaceType.html @@ -0,0 +1,343 @@ + + + + NamespaceType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceType

+
+
+
public enum NamespaceType : UInt8, CaseIterable
+ +
+
+

Namespace level type

+ +
+
+
+
    +
  • +
    + + + + rootNamespace + +
    +
    +
    +
    +
    +
    +

    Root namespace

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case rootNamespace = 0
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + subNamespace + +
    +
    +
    +
    +
    +
    +

    Sub namespace

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case subNamespace = 1
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/Nem2SdkSwiftError.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/Nem2SdkSwiftError.html new file mode 100644 index 0000000..aa88cd2 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/Nem2SdkSwiftError.html @@ -0,0 +1,424 @@ + + + + Nem2SdkSwiftError Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Nem2SdkSwiftError

+
+
+
public enum Nem2SdkSwiftError : Error
+ +
+
+

Errors from Nem2SdkSwift

+ +
+
+
+
    +
  • +
    + + + + illegalArgument(_:) + +
    +
    +
    +
    +
    +
    +

    An argument of the API is invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case illegalArgument(String)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + networkError + +
    +
    +
    +
    +
    +
    +

    A network error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case networkError
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + responseError(_:_:) + +
    +
    +
    +
    +
    +
    +

    A response error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case responseError(Int, String?)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parseError(_:) + +
    +
    +
    +
    +
    +
    +

    A parse error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case parseError(String)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + serializeError(_:) + +
    +
    +
    +
    +
    +
    +

    A serialize error

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case serializeError(String)
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/NetworkType.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/NetworkType.html new file mode 100644 index 0000000..3b95b94 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/NetworkType.html @@ -0,0 +1,452 @@ + + + + NetworkType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NetworkType

+
+
+
public enum NetworkType : UInt8, CaseIterable
+ +
+
+

Network type

+ +
+
+
+
    +
  • +
    + + + + mainNet + +
    +
    +
    +
    +
    +
    +

    Main network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mainNet = 104
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + testNet + +
    +
    +
    +
    +
    +
    +

    Test network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case testNet = 152
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mijin + +
    +
    +
    +
    +
    +
    +

    Mijin network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mijin = 96
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mijinTest + +
    +
    +
    +
    +
    +
    +

    Mijin test network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mijinTest = 144
    + +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    MARK: Properties +Initial address character of this network.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var initialCharacterOfAddress: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    String description of this network

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/TransactionType.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/TransactionType.html new file mode 100644 index 0000000..67f8a22 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Enums/TransactionType.html @@ -0,0 +1,559 @@ + + + + TransactionType Enumeration Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionType

+
+
+
public enum TransactionType : UInt16
+ +
+
+

Enum containing transaction type constants.

+ +
+
+
+
    +
  • +
    + + + + aggregateComplete + +
    +
    +
    +
    +
    +
    +

    Aggregate complete transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case aggregateComplete = 0x4141
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + aggregateBonded + +
    +
    +
    +
    +
    +
    +

    Aggregate bonded transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case aggregateBonded = 0x4241
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicDefinition + +
    +
    +
    +
    +
    +
    +

    Mosaic definition transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mosaicDefinition = 0x414d
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicSupplyChange + +
    +
    +
    +
    +
    +
    +

    Mosaic supply change

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case mosaicSupplyChange = 0x424d
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + modifyMultisigAccount + +
    +
    +
    +
    +
    +
    +

    Modify multisig account

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case modifyMultisigAccount = 0x4155
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + registerNamespace + +
    +
    +
    +
    +
    +
    +

    Register namespace transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case registerNamespace = 0x414e
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + transfer + +
    +
    +
    +
    +
    +
    +

    Transfer Transaction transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case transfer = 0x4154
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + lock + +
    +
    +
    +
    +
    +
    +

    Lock transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case lock = 0x414C
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secretLock + +
    +
    +
    +
    +
    +
    +

    Secret Lock Transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case secretLock = 0x424C
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + secretProof + +
    +
    +
    +
    +
    +
    +

    Secret Proof transaction type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case secretProof = 0x434C
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions.html new file mode 100644 index 0000000..901709b --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions.html @@ -0,0 +1,337 @@ + + + + Extensions Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Extensions

+

The following extensions are available globally.

+ +
+
+
+
    +
  • +
    + + + + Array + +
    +
    +
    +
    +
    +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct Array<Element> : _DestructorSafeContainer
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + String + +
    +
    +
    +
    +
    +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct String
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions/Array.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions/Array.html new file mode 100644 index 0000000..4722ff7 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions/Array.html @@ -0,0 +1,322 @@ + + + + Array Extension Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Array

+
+
+
struct Array<Element> : _DestructorSafeContainer
+ +
+
+ +
+
+
+ +
    +
  • +
    + + + + hexString + +
    +
    +
    +
    +
    +
    +

    Hex string description of this bytes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var hexString: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions/String.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions/String.html new file mode 100644 index 0000000..b0b3e13 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Extensions/String.html @@ -0,0 +1,439 @@ + + + + String Extension Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

String

+
+
+
struct String
+ +
+
+ +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Decodes this string as hex string of bytes and returns the bytes.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if this string is malformed as hex string. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func toBytesFromHexString() -> [UInt8]?
    + +
    +
    +
    +

    Return Value

    +

    Bytes

    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + stringValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var stringValue: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(stringValue:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init?(stringValue: String)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + intValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var intValue: Int? { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + init(intValue:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init?(intValue: Int)
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols.html new file mode 100644 index 0000000..c47bd10 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols.html @@ -0,0 +1,471 @@ + + + + Protocols Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Protocols

+

The following protocols are available globally.

+ +
+
+
+
    +
  • +
    + + + + AccountRepository + +
    +
    +
    +
    +
    +
    +

    Account interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AccountRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockchainRepository + +
    +
    +
    +
    +
    +
    +

    Blockchain interface repository

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol BlockchainRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicRepository + +
    +
    +
    +
    +
    +
    +

    Mosaic interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol MosaicRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceRepository + +
    +
    +
    +
    +
    +
    +

    Namespace interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol NamespaceRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NetworkRepository + +
    +
    +
    +
    +
    +
    +

    Network interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol NetworkRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionRepository + +
    +
    +
    +
    +
    +
    +

    Transaction interface repository.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol TransactionRepository
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/AccountRepository.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/AccountRepository.html new file mode 100644 index 0000000..7b94301 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/AccountRepository.html @@ -0,0 +1,823 @@ + + + + AccountRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AccountRepository

+
+
+
public protocol AccountRepository
+ +
+
+

Account interface repository.

+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Gets an AccountInfo for an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getAccountInfo(address: Address) -> Single<AccountInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of AccountInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets AccountsInfo for different accounts.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getAccountsInfo(addresses: [Address]) -> Single<[AccountInfo]>
    + +
    +
    +
    +

    Return Value

    +

    Observable of [AccountInfo]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets a MultisigAccountInfo for an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMultisigAccountInfo(address: Address) -> Single<MultisigAccountInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of MultisigAccountInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets a MultisigAccountGraphInfo for an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMultisigAccountGraphInfo(address: Address) -> Single<MultisigAccountGraphInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of MultisigAccountGraphInfo

    +
    +
    +
    +
  • +
  • +
    + + + + transactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of confirmed transactions for which an account is signer or receiver.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func transactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + incomingTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of transactions for which an account is the recipient of a transaction. + A transaction is said to be incoming with respect to an account if the account is the recipient of a transaction.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func incomingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + outgoingTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of transactions for which an account is the sender a transaction. + A transaction is said to be outgoing with respect to an account if the account is the sender of a transaction.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func outgoingTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + aggregateBondedTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets an list of transactions for which an account is the sender or has sign the transaction. + A transaction is said to be aggregate bonded with respect to an account if there are missing signatures.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func aggregateBondedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[AggregateTransaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [AggregateTransaction]

    +
    +
    +
    +
  • +
  • +
    + + + + unconfirmedTransactions(publicAccount:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets the list of transactions for which an account is the sender or receiver and which have not yet been included in a block. + Unconfirmed transactions are those transactions that have not yet been included in a block. + Unconfirmed transactions are not guaranteed to be included in any block.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func unconfirmedTransactions(publicAccount: PublicAccount, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + publicAccount + + +
    +

    PublicAccount

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/BlockchainRepository.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/BlockchainRepository.html new file mode 100644 index 0000000..6378c18 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/BlockchainRepository.html @@ -0,0 +1,506 @@ + + + + BlockchainRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainRepository

+
+
+
public protocol BlockchainRepository
+ +
+
+

Blockchain interface repository

+ +
+
+
+
    +
  • +
    + + + + getBlock(height:) + +
    +
    +
    +
    +
    +
    +

    Gets a BlockInfo for a given block height.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlock(height: UInt64) -> Single<BlockInfo>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + height + + +
    +

    Block height

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of BlockInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets list of transactions included in a block for a block height.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockTransactions(height: UInt64, pageSize: Int?, id: String?) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height

    +
    +
    + + pageSize + + +
    +

    The number of transactions to return for each request. The default value is 10, the minimum is 10 and the maximum is 100. (optional)

    +
    +
    + + id + + +
    +

    The identifier of the transaction after which we want the transactions to be returned. If not supplied the most recent transactions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • +
    + + + + getBlockchainHeight() + +
    +
    +
    +
    +
    +
    +

    Gets current blockchain height.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockchainHeight() -> Single<UInt64>
    + +
    +
    +
    +

    Return Value

    +

    Observable of UInt64

    +
    +
    +
    +
  • +
  • +
    + + + + getBlockchainScore() + +
    +
    +
    +
    +
    +
    +

    Gets current blockchain score.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockchainScore() -> Single<BlockchainScore>
    + +
    +
    +
    +

    Return Value

    +

    Observable of BlockchainScore

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets blockchain storage info.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getBlockchainStorage() -> Single<BlockchainStorageInfo>
    + +
    +
    +
    +

    Return Value

    +

    Observable of BlockchainStorageInfo

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/MosaicRepository.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/MosaicRepository.html new file mode 100644 index 0000000..c722181 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/MosaicRepository.html @@ -0,0 +1,520 @@ + + + + MosaicRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicRepository

+
+
+
public protocol MosaicRepository
+ +
+
+

Mosaic interface repository.

+ +
+
+
+
    +
  • +
    + + + + getMosaic(mosaicId:) + +
    +
    +
    +
    +
    +
    +

    Gets a MosaicInfo for a given mosaicId

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaic(mosaicId: MosaicId) -> Single<MosaicInfo>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + mosaicId + + +
    +

    Mosaic id

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of MosaicInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets MosaicInfo for different mosaicIds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaics(mosaicIds: [MosaicId]) -> Single<[MosaicInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + mosaicIds + + +
    +

    List of mosaic id

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [MosaicInfo]

    +
    +
    +
    +
  • +
  • +
    + + + + getMosaicsFromNamespace(namespaceId:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets list of MosaicInfo from mosaics created with provided namespace.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaicsFromNamespace(namespaceId: NamespaceId, pageSize: Int?, id: String?) -> Single<[MosaicInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + namespaceId + + +
    +

    Namespace id.

    +
    +
    + + pageSize + + +
    +

    The number of mosaics to return. (optional)

    +
    +
    + + id + + +
    +

    The mosaic id up to which mosaic definitions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [MosaicInfo]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets list of MosaicName for different mosaicIds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getMosaicNames(mosaicIds: [MosaicId]) -> Single<[MosaicName]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + mosaicIds + + +
    +

    List of mosaic id.

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [MosaicName]

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/NamespaceRepository.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/NamespaceRepository.html new file mode 100644 index 0000000..d6f9a4c --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/NamespaceRepository.html @@ -0,0 +1,551 @@ + + + + NamespaceRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceRepository

+
+
+
public protocol NamespaceRepository
+ +
+
+

Namespace interface repository.

+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Gets the NamespaceInfo for a given namespaceId.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespace(namespaceId: NamespaceId) -> Single<NamespaceInfo>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + namespaceId + + +
    +

    NamespaceId

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of NamespaceInfo

    +
    +
    +
    +
  • +
  • +
    + + + + getNamespacesFromAccount(address:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets list of NamespaceInfo for an account.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespacesFromAccount(address: Address, pageSize: Int?, id: String?) -> Single<[NamespaceInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + address + + +
    +

    Address

    +
    +
    + + pageSize + + +
    +

    The number of namespaces to return. (optional)

    +
    +
    + + id + + +
    +

    The namespace id up to which namespace definitions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [NamespaceInfo]

    +
    +
    +
    +
  • +
  • +
    + + + + getNamespacesFromAccounts(addresses:pageSize:id:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gets list of NamespaceInfo for different account.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespacesFromAccounts(addresses: [Address], pageSize: Int?, id: String?) -> Single<[NamespaceInfo]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + addresses + + +
    +

    List of Address

    +
    +
    + + pageSize + + +
    +

    The number of namespaces to return. (optional)

    +
    +
    + + id + + +
    +

    The namespace id up to which namespace definitions are returned. (optional)

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [NamespaceInfo]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets list of NamespaceName for different namespaceIds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNamespaceNames(namespaceIds: [NamespaceId]) -> Single<[NamespaceName]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + namespaceIds + + +
    +

    List of NamespaceId

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [NamespaceName]

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/NetworkRepository.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/NetworkRepository.html new file mode 100644 index 0000000..b2b80fd --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/NetworkRepository.html @@ -0,0 +1,316 @@ + + + + NetworkRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NetworkRepository

+
+
+
public protocol NetworkRepository
+ +
+
+

Network interface repository.

+ +
+
+
+
    +
  • +
    + + + + getNetworkType() + +
    +
    +
    +
    +
    +
    +

    Get current network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getNetworkType() -> Single<NetworkType>
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/TransactionRepository.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/TransactionRepository.html new file mode 100644 index 0000000..e01dea5 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Protocols/TransactionRepository.html @@ -0,0 +1,639 @@ + + + + TransactionRepository Protocol Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionRepository

+
+
+
public protocol TransactionRepository
+ +
+
+

Transaction interface repository.

+ +
+
+
+
    +
  • +
    + + + + getTransaction(hash:) + +
    +
    +
    +
    +
    +
    +

    Gets a transaction for a given hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransaction(hash: [UInt8]) -> Single<Transaction>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hash + + +
    +

    Transaction hash.

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of Transaction

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets an list of transactions for different transaction hashes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransactions(hashes: [[UInt8]]) -> Single<[Transaction]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hashes + + +
    +

    List of transaction hash string.

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [Transaction]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets a transaction status for a transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransactionStatus(hash: [UInt8]) -> Single<TransactionStatus>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hash + + +
    +

    Transaction hash string

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionStatus

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Gets an list of transaction status for different transaction hashes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func getTransactionStatuses(hashes: [[UInt8]]) -> Single<[TransactionStatus]>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hashes + + +
    +

    List of transaction hash string

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of [TransactionStatus]

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Send a signed transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func announce(signedTransaction: SignedTransaction) -> Single<TransactionAnnounceResponse>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + signedTransaction + + +
    +

    SignedTransaction

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionAnnounceResponse

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Send a signed transaction with missing signatures.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func announceAggregateBonded(signedTransaction: SignedTransaction) -> Single<TransactionAnnounceResponse>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + signedTransaction + + +
    +

    SignedTransaction

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionAnnounceResponse

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Send a cosignature signed transaction of an already announced transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func announceAggregateBondedCosignature(cosignatureSignedTransaction: CosignatureSignedTransaction) -> Single<TransactionAnnounceResponse>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + cosignatureSignedTransaction + + +
    +

    CosignatureSignedTransaction

    +
    +
    +
    +
    +

    Return Value

    +

    Observable of TransactionAnnounceResponse

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs.html new file mode 100644 index 0000000..82c4ccb --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs.html @@ -0,0 +1,1145 @@ + + + + Structures Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Structures

+

The following structures are available globally.

+ +
+
+
+
    +
  • +
    + + + + PrivateKey + +
    +
    +
    +
    +
    +
    +

    Represents a private key.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct PrivateKey : Equatable, CustomStringConvertible
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + PublicKey + +
    +
    +
    +
    +
    +
    +

    Represents a public key.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct PublicKey : Equatable, CustomStringConvertible
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Undocumented

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ListenerSubscribeMessage : Codable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + AccountInfo + +
    +
    +
    +
    +
    +
    +

    The account info structure describes basic information for an account.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct AccountInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Address + +
    +
    +
    +
    +
    +
    +

    The address structure describes an address with its network.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Address : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    @since 1.0

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MultisigAccountGraphInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MultisigAccountInfo + +
    +
    +
    +
    +
    +
    +

    The multisig account info structure describes information of a multisig account.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MultisigAccountInfo : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + PublicAccount + +
    +
    +
    +
    +
    +
    +

    The public account structure contains account’s address and public key.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct PublicAccount : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockInfo + +
    +
    +
    +
    +
    +
    +

    The block info structure describes basic information of a block.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct BlockInfo : CustomStringConvertible
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockchainStorageInfo + +
    +
    +
    +
    +
    +
    +

    The blockchain storage info structure describes stored data.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct BlockchainStorageInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + Mosaic + +
    +
    +
    +
    +
    +
    +

    A mosaic describes an instance of a mosaic definition. +Mosaics can be transferred by means of a transfer transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Mosaic
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicId + +
    +
    +
    +
    +
    +
    +

    The mosaic id structure describes mosaic id

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicId : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicInfo + +
    +
    +
    +
    +
    +
    +

    The mosaic info structure contains its properties, the owner and the namespace to which it belongs to.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicName + +
    +
    +
    +
    +
    +
    +

    The mosaic name info structure describes basic information of a mosaic and name.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicName
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + MosaicProperties + +
    +
    +
    +
    +
    +
    +

    The mosaic properties structure describes mosaic properties.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MosaicProperties
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceId + +
    +
    +
    +
    +
    +
    +

    The namespace id structure describes namespace id

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct NamespaceId : Equatable
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceInfo + +
    +
    +
    +
    +
    +
    +

    NamespaceInfo contains the state information of a namespace.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct NamespaceInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + NamespaceName + +
    +
    +
    +
    +
    +
    +

    The namespace name info structure describes basic information of a namespace and name.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct NamespaceName
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The model representing cosignature of an aggregate transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct AggregateTransactionCosignature
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The co-signature signed transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct CosignatureSignedTransaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The multisig cosignatory modifications are part of the NEM’s multisig account system. +With a multisig cosignatory modification a cosignatory is added to or deleted from a multisig account. +Multisig cosignatory modifications are part of a modify multisig account transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct MultisigCosignatoryModification
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + SignedTransaction + +
    +
    +
    +
    +
    +
    +

    The signed transaction object is used to transfer the transaction data and the signature to NIS

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SignedTransaction
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The transaction response of an announce transaction.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionAnnounceResponse
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionInfo + +
    +
    +
    +
    +
    +
    +

    The transaction information model included in all transactions.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionInfo
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + TransactionStatus + +
    +
    +
    +
    +
    +
    +

    The transaction status contains basic of a transaction announced to the blockchain.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionStatus
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The transaction status error model returned by listeners.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct TransactionStatusError
    + +
    +
    +
    +
    +
  • +
+
+
+
    +
  • +
    + + + + BlockchainScore + +
    +
    +
    +
    +
    +
    +

    The blockchain score structure describes blockchain difficulty.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct BlockchainScore
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/AccountInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/AccountInfo.html new file mode 100644 index 0000000..3e176e4 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/AccountInfo.html @@ -0,0 +1,485 @@ + + + + AccountInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AccountInfo

+
+
+
public struct AccountInfo
+ +
+
+

The account info structure describes basic information for an account.

+ +
+
+
+ +
    +
  • +
    + + + + address + +
    +
    +
    +
    +
    +
    +

    Account address.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let address: Address
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + addressHeight + +
    +
    +
    +
    +
    +
    +

    Height when the address was published.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let addressHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKey + +
    +
    +
    +
    +
    +
    +

    Public key of the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKey: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKeyHeight + +
    +
    +
    +
    +
    +
    +

    Height when the public key was published.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKeyHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + importance + +
    +
    +
    +
    +
    +
    +

    Importance of the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let importance: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + importanceHeight + +
    +
    +
    +
    +
    +
    +

    Importance height of the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let importanceHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaics + +
    +
    +
    +
    +
    +
    +

    Mosaics hold by the account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaics: [Mosaic]
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/Address.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/Address.html new file mode 100644 index 0000000..5044d14 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/Address.html @@ -0,0 +1,674 @@ + + + + Address Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Address

+
+
+
public struct Address : Equatable
+ +
+
+

The address structure describes an address with its network.

+ +
+
+
+ +
    +
  • +
    + + + + networkType + +
    +
    +
    +
    +
    +
    +

    Network type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let networkType: NetworkType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + plain + +
    +
    +
    +
    +
    +
    +

    The address in plain format ex: SB3KUBHATFCPV7UZQLWAQ2EUR6SIHBSBEOEDDDF3.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var plain: String { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + pretty + +
    +
    +
    +
    +
    +
    +

    The address in pretty format ex: SB3KUB-HATFCP-V7UZQL-WAQ2EU-R6SIHB-SBEOED-DDF3.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var pretty: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Constructor

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the address is invalid length or doesn’t match the network. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(address: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + address + + +
    +

    Address in plain format

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(rawAddress:) + +
    +
    +
    +
    +
    +
    +

    Creates an Address from a given raw address.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the address is invalid length or does’t match any network. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rawAddress: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rawAddress + + +
    +

    Address string.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(encodedAddress:) + +
    +
    +
    +
    +
    +
    +

    Creates an Address from a given base32 encoded address.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the address is invalid length or does’t match any network. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(encodedAddress: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + encodedAddress + + +
    +

    Base32 encoded address string.

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates from public key hex string.

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the public key is invalid length or malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKeyHexString: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKeyHexString + + +
    +

    Public key hex string.

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates from public key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKey: PublicKey, networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKey + + +
    +

    Public key.

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/AggregateTransactionCosignature.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/AggregateTransactionCosignature.html new file mode 100644 index 0000000..b701506 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/AggregateTransactionCosignature.html @@ -0,0 +1,343 @@ + + + + AggregateTransactionCosignature Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

AggregateTransactionCosignature

+
+
+
public struct AggregateTransactionCosignature
+ +
+
+

The model representing cosignature of an aggregate transaction.

+ +
+
+
+
    +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    Signature of aggregate transaction done by the cosigner.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Cosigner public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signer: PublicAccount
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockInfo.html new file mode 100644 index 0000000..8516f81 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockInfo.html @@ -0,0 +1,701 @@ + + + + BlockInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockInfo

+
+
+
public struct BlockInfo : CustomStringConvertible
+ +
+
+

The block info structure describes basic information of a block.

+ +
+
+
+ +
    +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Block hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + generationHash + +
    +
    +
    +
    +
    +
    +

    Block generation hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let generationHash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + totalFee + +
    +
    +
    +
    +
    +
    +

    Total fee paid to the account harvesting the block. Nil when generated by listeners.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let totalFee: UInt64?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + numTransactions + +
    +
    +
    +
    +
    +
    +

    Number of transactions included the block. Nil when generated by listeners.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numTransactions: Int?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    The block signature. +The signature was generated by the signer and can be used to validate that the blockchain data was not modified by a node.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Public account of block harvester.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signer: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + networkType + +
    +
    +
    +
    +
    +
    +

    Network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let networkType: NetworkType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + version + +
    +
    +
    +
    +
    +
    +

    Block transaction version.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let version: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Block transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Height of which the block was confirmed. Each block has a unique height. Subsequent blocks differ in height by 1.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + timestamp + +
    +
    +
    +
    +
    +
    +

    The number of seconds elapsed since the creation of the nemesis blockchain.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let timestamp: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + difficulty + +
    +
    +
    +
    +
    +
    +

    POI difficulty to harvest a block.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let difficulty: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + previousBlockHash + +
    +
    +
    +
    +
    +
    +

    The last block hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let previousBlockHash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + blockTransactionHash + +
    +
    +
    +
    +
    +
    +

    The block transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let blockTransactionHash: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockchainScore.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockchainScore.html new file mode 100644 index 0000000..c896df7 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockchainScore.html @@ -0,0 +1,343 @@ + + + + BlockchainScore Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainScore

+
+
+
public struct BlockchainScore
+ +
+
+

The blockchain score structure describes blockchain difficulty.

+ +
+
+
+
    +
  • +
    + + + + scoreLow + +
    +
    +
    +
    +
    +
    +

    Low part of the blockchain score.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let scoreLow: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + scoreHigh + +
    +
    +
    +
    +
    +
    +

    High part of the blockchain score.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let scoreHigh: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockchainStorageInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockchainStorageInfo.html new file mode 100644 index 0000000..749589e --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/BlockchainStorageInfo.html @@ -0,0 +1,377 @@ + + + + BlockchainStorageInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

BlockchainStorageInfo

+
+
+
public struct BlockchainStorageInfo
+ +
+
+

The blockchain storage info structure describes stored data.

+ +
+
+
+ +
    +
  • +
    + + + + numAccounts + +
    +
    +
    +
    +
    +
    +

    Number of accounts published in the blockchain.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numAccounts: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + numBlocks + +
    +
    +
    +
    +
    +
    +

    Number of confirmed blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numBlocks: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + numTransactions + +
    +
    +
    +
    +
    +
    +

    Number of confirmed transactions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let numTransactions: Int
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/CosignatureSignedTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/CosignatureSignedTransaction.html new file mode 100644 index 0000000..be355a7 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/CosignatureSignedTransaction.html @@ -0,0 +1,370 @@ + + + + CosignatureSignedTransaction Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

CosignatureSignedTransaction

+
+
+
public struct CosignatureSignedTransaction
+ +
+
+

The co-signature signed transaction.

+ +
+
+
+
    +
  • +
    + + + + parentHash + +
    +
    +
    +
    +
    +
    +

    Hash of parent aggregate transaction that has been signed by a cosignatory of the transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentHash: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signature + +
    +
    +
    +
    +
    +
    +

    Signatures generated by signing the parent aggregate transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signature: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + signer + +
    +
    +
    +
    +
    +
    +

    Signer of the cosignature transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let signer: [UInt8]
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/Mosaic.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/Mosaic.html new file mode 100644 index 0000000..c61b504 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/Mosaic.html @@ -0,0 +1,344 @@ + + + + Mosaic Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

Mosaic

+
+
+
public struct Mosaic
+ +
+
+

A mosaic describes an instance of a mosaic definition. +Mosaics can be transferred by means of a transfer transaction.

+ +
+
+
+
    +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Mosaic identifier

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + amount + +
    +
    +
    +
    +
    +
    +

    Amount of mosaic

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let amount: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicId.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicId.html new file mode 100644 index 0000000..00aa471 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicId.html @@ -0,0 +1,485 @@ + + + + MosaicId Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicId

+
+
+
public struct MosaicId : Equatable
+ +
+
+

The mosaic id structure describes mosaic id

+ +
+
+
+ +
    +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Mosaic integer id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + fullName + +
    +
    +
    +
    +
    +
    +

    Mosaic full name, with namespace name (ex: nem:xem)

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let fullName: String?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(fullName:) + +
    +
    +
    +
    +
    +
    +

    Create MosaicId from mosaic and namespace string name (ex: nem:xem or domain.subdom.subdome:token)

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the fullName is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fullName: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fullName + + +
    +

    Mosaic full name

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(id:) + +
    +
    +
    +
    +
    +
    +

    Create MosaicId from integer id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(id: UInt64)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + id + + +
    +

    Mosaic integer id

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    +

    Compares only the ids.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: MosaicId, rhs: MosaicId) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicInfo.html new file mode 100644 index 0000000..ad6a570 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicInfo.html @@ -0,0 +1,668 @@ + + + + MosaicInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicInfo

+
+
+
public struct MosaicInfo
+ +
+
+

The mosaic info structure contains its properties, the owner and the namespace to which it belongs to.

+ +
+
+
+
    +
  • +
    + + + + isActive + +
    +
    +
    +
    +
    +
    +

    MARK: Properties +If the mosaic is active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isActive: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + index + +
    +
    +
    +
    +
    +
    +

    Index

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let index: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + metaId + +
    +
    +
    +
    +
    +
    +

    Meta ID

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let metaId: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    The namespace id it belongs to

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + supply + +
    +
    +
    +
    +
    +
    +

    Total mosaic supply

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let supply: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Block height it was created

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + owner + +
    +
    +
    +
    +
    +
    +

    Mosaic account owner

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let owner: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isExpired + +
    +
    +
    +
    +
    +
    +

    If the mosaic is expired

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isExpired: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isSupplyMutable + +
    +
    +
    +
    +
    +
    +

    True if the supply is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isSupplyMutable: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isTransferable + +
    +
    +
    +
    +
    +
    +

    True if the mosaic is transferable between non-owner accounts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isTransferable: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isLevyMutable + +
    +
    +
    +
    +
    +
    +

    If the mosaic levy is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isLevyMutable: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    The number of blocks from height it will be active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var duration: UInt64 { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + divisibility + +
    +
    +
    +
    +
    +
    +

    Mosaic divisibility

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var divisibility: Int { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicName.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicName.html new file mode 100644 index 0000000..46c06e8 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicName.html @@ -0,0 +1,377 @@ + + + + MosaicName Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicName

+
+
+
public struct MosaicName
+ +
+
+

The mosaic name info structure describes basic information of a mosaic and name.

+ +
+
+
+ +
    +
  • +
    + + + + mosaicId + +
    +
    +
    +
    +
    +
    +

    Mosaic identifier

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let mosaicId: MosaicId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    Mosaic name

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let name: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    Namespace identifier it belongs to

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicProperties.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicProperties.html new file mode 100644 index 0000000..09bbeca --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MosaicProperties.html @@ -0,0 +1,424 @@ + + + + MosaicProperties Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MosaicProperties

+
+
+
public struct MosaicProperties
+ +
+
+

The mosaic properties structure describes mosaic properties.

+ +
+
+
+
    +
  • +
    + + + + isSupplyMutable + +
    +
    +
    +
    +
    +
    +

    True if supply is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isSupplyMutable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isTransferable + +
    +
    +
    +
    +
    +
    +

    True if mosaic is transferable between non-owner accounts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isTransferable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isLevyMutable + +
    +
    +
    +
    +
    +
    +

    True if the mosaic levy is mutable

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isLevyMutable: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + divisibility + +
    +
    +
    +
    +
    +
    +

    Mosaic divisibility

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let divisibility: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + duration + +
    +
    +
    +
    +
    +
    +

    Number of blocks from height it will be active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let duration: UInt64
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigAccountGraphInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigAccountGraphInfo.html new file mode 100644 index 0000000..1c552e3 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigAccountGraphInfo.html @@ -0,0 +1,388 @@ + + + + MultisigAccountGraphInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigAccountGraphInfo

+
+
+
public struct MultisigAccountGraphInfo
+ +
+
+

@since 1.0

+ +
+
+
+ +
    +
  • +
    + + + + multisigAccounts + +
    +
    +
    +
    +
    +
    +

    Multisig accounts.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let multisigAccounts: [Int : [MultisigAccountInfo]]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + levelsNumber + +
    +
    +
    +
    +
    +
    +

    Multisig accounts levels number.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var levelsNumber: Set<Int> { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ + +
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigAccountInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigAccountInfo.html new file mode 100644 index 0000000..4792c1b --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigAccountInfo.html @@ -0,0 +1,569 @@ + + + + MultisigAccountInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigAccountInfo

+
+
+
public struct MultisigAccountInfo : Equatable
+ +
+
+

The multisig account info structure describes information of a multisig account.

+ +
+
+
+ +
    +
  • +
    + + + + account + +
    +
    +
    +
    +
    +
    +

    Account multisig public account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let account: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + minApproval + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to approve a transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minApproval: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + minRemoval + +
    +
    +
    +
    +
    +
    +

    Number of signatures needed to remove a cosignatory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minRemoval: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + cosignatories + +
    +
    +
    +
    +
    +
    +

    Multisig account cosignatories.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let cosignatories: [PublicAccount]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + multisigAccounts + +
    +
    +
    +
    +
    +
    +

    Multisig accounts this account is cosigner of.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let multisigAccounts: [PublicAccount]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isMultisig + +
    +
    +
    +
    +
    +
    +

    if the account is a multisig account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isMultisig: Bool { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + hasCosigner(account:) + +
    +
    +
    +
    +
    +
    +

    Checks if an account is cosignatory of the multisig account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hasCosigner(account: PublicAccount) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    PublicAccount

    +
    +
    +
    +
    +

    Return Value

    +

    boolean

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Checks if the multisig account is cosignatory of an account.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func isCosignerOf(account: PublicAccount) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + account + + +
    +

    PublicAccount

    +
    +
    +
    +
    +

    Return Value

    +

    boolean

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigCosignatoryModification.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigCosignatoryModification.html new file mode 100644 index 0000000..97bda19 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/MultisigCosignatoryModification.html @@ -0,0 +1,372 @@ + + + + MultisigCosignatoryModification Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

MultisigCosignatoryModification

+
+
+
public struct MultisigCosignatoryModification
+ +
+
+

The multisig cosignatory modifications are part of the NEM’s multisig account system. +With a multisig cosignatory modification a cosignatory is added to or deleted from a multisig account. +Multisig cosignatory modifications are part of a modify multisig account transactions.

+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceId.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceId.html new file mode 100644 index 0000000..cc62a95 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceId.html @@ -0,0 +1,466 @@ + + + + NamespaceId Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceId

+
+
+
public struct NamespaceId : Equatable
+ +
+
+

The namespace id structure describes namespace id

+ +
+
+
+ +
    +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + fullName + +
    +
    +
    +
    +
    +
    +

    Namespace full name, with subnamespaces if it’s the case.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let fullName: String?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(fullName:) + +
    +
    +
    +
    +
    +
    +

    Create NamespaceId from namespace string name (ex: nem or domain.subdom.subdome)

    +
    +

    Throws

    + Nem2SdkSwiftError.illegalArgument if the fullName is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fullName: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fullName + + +
    +

    Namespace full name

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(id:) + +
    +
    +
    +
    +
    +
    +

    Create NamespaceId from integer id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(id: UInt64)
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    +

    Compares only the ids.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: NamespaceId, rhs: NamespaceId) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceInfo.html new file mode 100644 index 0000000..cce7ae5 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceInfo.html @@ -0,0 +1,668 @@ + + + + NamespaceInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceInfo

+
+
+
public struct NamespaceInfo
+ +
+
+

NamespaceInfo contains the state information of a namespace.

+ +
+
+
+
    +
  • +
    + + + + isActive + +
    +
    +
    +
    +
    +
    +

    MARK: Properties +If namespace is active

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isActive: Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + index + +
    +
    +
    +
    +
    +
    +

    Index

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let index: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + metaId + +
    +
    +
    +
    +
    +
    +

    Meta id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let metaId: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Namespace type

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: NamespaceType
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + depth + +
    +
    +
    +
    +
    +
    +

    Namespace level depth

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let depth: Int
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + levels + +
    +
    +
    +
    +
    +
    +

    Different NamespaceIds per level

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let levels: [NamespaceId]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    Parent namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + owner + +
    +
    +
    +
    +
    +
    +

    Mosaic owner account

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let owner: PublicAccount
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + startHeight + +
    +
    +
    +
    +
    +
    +

    Block height the namespace was registered

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let startHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + endHeight + +
    +
    +
    +
    +
    +
    +

    Block height the namespace expires if not renewed

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let endHeight: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isExpired + +
    +
    +
    +
    +
    +
    +

    Namespace expiration status

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isExpired: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var id: NamespaceId { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isRoot + +
    +
    +
    +
    +
    +
    +

    True if namespace is Root

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isRoot: Bool { get }
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + isSubNamespace + +
    +
    +
    +
    +
    +
    +

    True if namespace is SubNamespace

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isSubNamespace: Bool { get }
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceName.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceName.html new file mode 100644 index 0000000..09194fc --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/NamespaceName.html @@ -0,0 +1,377 @@ + + + + NamespaceName Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

NamespaceName

+
+
+
public struct NamespaceName
+ +
+
+

The namespace name info structure describes basic information of a namespace and name.

+ +
+
+
+ +
    +
  • +
    + + + + namespaceId + +
    +
    +
    +
    +
    +
    +

    Namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let namespaceId: NamespaceId
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    Namespace name

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let name: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + parentId + +
    +
    +
    +
    +
    +
    +

    Parent namespace id

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let parentId: NamespaceId?
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PrivateKey.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PrivateKey.html new file mode 100644 index 0000000..5521231 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PrivateKey.html @@ -0,0 +1,489 @@ + + + + PrivateKey Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PrivateKey

+
+
+
public struct PrivateKey : Equatable, CustomStringConvertible
+ +
+
+

Represents a private key.

+ +
+
+
+ +
    +
  • +
    + + + + bytes + +
    +
    +
    +
    +
    +
    +

    The raw private key value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let bytes: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    Private key hex string description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(bytes:) + +
    +
    +
    +
    +
    +
    +

    Creates a new private key.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(bytes: [UInt8]) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bytes + + +
    +

    The raw private key value.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(hexString:) + +
    +
    +
    +
    +
    +
    +

    Creates a private key from a hex string.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid or the hex string is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(hexString: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hexString + + +
    +

    The private key hex string.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: PrivateKey, rhs: PrivateKey) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PublicAccount.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PublicAccount.html new file mode 100644 index 0000000..e8d83f5 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PublicAccount.html @@ -0,0 +1,477 @@ + + + + PublicAccount Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PublicAccount

+
+
+
public struct PublicAccount : Equatable
+ +
+
+

The public account structure contains account’s address and public key.

+ +
+
+
+ +
    +
  • +
    + + + + address + +
    +
    +
    +
    +
    +
    +

    Account address.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let address: Address
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + publicKey + +
    +
    +
    +
    +
    +
    +

    Account public key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let publicKey: PublicKey
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create a PublicAccount from a public key and network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKey: PublicKey, networkType: NetworkType)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKey + + +
    +

    Public key

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a PublicAccount from a public key hex string and network type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(publicKeyHexString: String, networkType: NetworkType) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + publicKeyHexString + + +
    +

    Public key hex string

    +
    +
    + + networkType + + +
    +

    Network type

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PublicKey.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PublicKey.html new file mode 100644 index 0000000..95c6620 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/PublicKey.html @@ -0,0 +1,489 @@ + + + + PublicKey Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

PublicKey

+
+
+
public struct PublicKey : Equatable, CustomStringConvertible
+ +
+
+

Represents a public key.

+ +
+
+
+ +
    +
  • +
    + + + + bytes + +
    +
    +
    +
    +
    +
    +

    The raw public key value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let bytes: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    Public key hex string description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • +
    + + + + init(bytes:) + +
    +
    +
    +
    +
    +
    +

    Creates a new public key.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(bytes: [UInt8]) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bytes + + +
    +

    The raw public key value.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + init(hexString:) + +
    +
    +
    +
    +
    +
    +

    Creates a public key from a hex string.

    +
    +

    Throws

    + Nem2SDkSwiftError.illegalArgument if the byte length is invalid or the hex string is malformed. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(hexString: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + hexString + + +
    +

    The public key hex string.

    +
    +
    +
    +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: PublicKey, rhs: PublicKey) -> Bool
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/SignedTransaction.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/SignedTransaction.html new file mode 100644 index 0000000..ac83cda --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/SignedTransaction.html @@ -0,0 +1,377 @@ + + + + SignedTransaction Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

SignedTransaction

+
+
+
public struct SignedTransaction
+ +
+
+

The signed transaction object is used to transfer the transaction data and the signature to NIS

+ +
+
+
+ +
    +
  • +
    + + + + payload + +
    +
    +
    +
    +
    +
    +

    Transaction serialized data.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let payload: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Transaction type.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let type: TransactionType
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionAnnounceResponse.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionAnnounceResponse.html new file mode 100644 index 0000000..d32aefb --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionAnnounceResponse.html @@ -0,0 +1,316 @@ + + + + TransactionAnnounceResponse Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionAnnounceResponse

+
+
+
public struct TransactionAnnounceResponse
+ +
+
+

The transaction response of an announce transaction.

+ +
+
+
+
    +
  • +
    + + + + message + +
    +
    +
    +
    +
    +
    +

    Success or error message.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let message: String
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionInfo.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionInfo.html new file mode 100644 index 0000000..8dd86a1 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionInfo.html @@ -0,0 +1,766 @@ + + + + TransactionInfo Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionInfo

+
+
+
public struct TransactionInfo
+ +
+
+

The transaction information model included in all transactions.

+ +
+
+
+ +
    +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Block height in which the transaction was included.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + index + +
    +
    +
    +
    +
    +
    +

    Index representing either transaction index/position within block or within an aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let index: Int?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    Transaction id.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + merkleComponentHash + +
    +
    +
    +
    +
    +
    +

    Transaction merkle component hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let merkleComponentHash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + aggregateHash + +
    +
    +
    +
    +
    +
    +

    Hash of the aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let aggregateHash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + aggregateId + +
    +
    +
    +
    +
    +
    +

    Id of the aggregate transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let aggregateId: String?
    + +
    +
    +
    +
    +
  • +
+
+
+ +
    +
  • + +
    +
    +
    +
    +
    +

    Create transaction info object for aggregate transaction inner transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func createAggregate(height: UInt64, index: Int, id: String, aggregateHash: [UInt8], aggregateId: String) -> TransactionInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height in which the transaction was included.

    +
    +
    + + index + + +
    +

    The transaction index.

    +
    +
    + + id + + +
    +

    transaction id.

    +
    +
    + + aggregateHash + + +
    +

    The hash of the aggregate transaction.

    +
    +
    + + aggregateId + + +
    +

    The id of the aggregate transaction.

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of TransactionInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create transaction info object for a transaction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(height: UInt64, index: Int, id: String, hash: [UInt8], merkleComponentHash: [UInt8]) -> TransactionInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height in which the transaction was included.

    +
    +
    + + index + + +
    +

    The transaction index.

    +
    +
    + + id + + +
    +

    transaction id.

    +
    +
    + + hash + + +
    +

    The transaction hash.

    +
    +
    + + merkleComponentHash + + +
    +

    The transaction merkle component hash.

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of TransactionInfo

    +
    +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create transaction info retrieved by listener.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func create(height: UInt64, hash: [UInt8], merkleComponentHash: [UInt8]) -> TransactionInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + height + + +
    +

    Block height in which the transaction was included.

    +
    +
    + + hash + + +
    +

    The transaction hash

    +
    +
    + + merkleComponentHash + + +
    +

    The transaction merkle component hash.

    +
    +
    +
    +
    +

    Return Value

    +

    Instance of TransactionInfo

    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionStatus.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionStatus.html new file mode 100644 index 0000000..11993f7 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionStatus.html @@ -0,0 +1,431 @@ + + + + TransactionStatus Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionStatus

+
+
+
public struct TransactionStatus
+ +
+
+

The transaction status contains basic of a transaction announced to the blockchain.

+ +
+
+
+ +
    +
  • +
    + + + + group + +
    +
    +
    +
    +
    +
    +

    Transaction status group failed, unconfirmed, confirmed, etc…

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let group: String?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + status + +
    +
    +
    +
    +
    +
    +

    Transaction status being the error name in case of failure and success otherwise.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let status: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + deadline + +
    +
    +
    +
    +
    +
    +

    Transaction deadline.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deadline: Deadline?
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + height + +
    +
    +
    +
    +
    +
    +

    Height of the block at which it was confirmed or rejected.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let height: UInt64?
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionStatusError.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionStatusError.html new file mode 100644 index 0000000..323c015 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/Structs/TransactionStatusError.html @@ -0,0 +1,370 @@ + + + + TransactionStatusError Structure Reference + + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+

TransactionStatusError

+
+
+
public struct TransactionStatusError
+ +
+
+

The transaction status error model returned by listeners.

+ +
+
+
+
    +
  • +
    + + + + hash + +
    +
    +
    +
    +
    +
    +

    Transaction hash.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let hash: [UInt8]
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + status + +
    +
    +
    +
    +
    +
    +

    Transaction status error when transaction fails.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let status: String
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + deadline + +
    +
    +
    +
    +
    +
    +

    Transaction deadline.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deadline: Deadline
    + +
    +
    +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/css/highlight.css b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/css/highlight.css new file mode 100644 index 0000000..d0db0e1 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/css/highlight.css @@ -0,0 +1,200 @@ +/* Credit to https://gist.github.com/wataru420/2048287 */ +.highlight { + /* Comment */ + /* Error */ + /* Keyword */ + /* Operator */ + /* Comment.Multiline */ + /* Comment.Preproc */ + /* Comment.Single */ + /* Comment.Special */ + /* Generic.Deleted */ + /* Generic.Deleted.Specific */ + /* Generic.Emph */ + /* Generic.Error */ + /* Generic.Heading */ + /* Generic.Inserted */ + /* Generic.Inserted.Specific */ + /* Generic.Output */ + /* Generic.Prompt */ + /* Generic.Strong */ + /* Generic.Subheading */ + /* Generic.Traceback */ + /* Keyword.Constant */ + /* Keyword.Declaration */ + /* Keyword.Pseudo */ + /* Keyword.Reserved */ + /* Keyword.Type */ + /* Literal.Number */ + /* Literal.String */ + /* Name.Attribute */ + /* Name.Builtin */ + /* Name.Class */ + /* Name.Constant */ + /* Name.Entity */ + /* Name.Exception */ + /* Name.Function */ + /* Name.Namespace */ + /* Name.Tag */ + /* Name.Variable */ + /* Operator.Word */ + /* Text.Whitespace */ + /* Literal.Number.Float */ + /* Literal.Number.Hex */ + /* Literal.Number.Integer */ + /* Literal.Number.Oct */ + /* Literal.String.Backtick */ + /* Literal.String.Char */ + /* Literal.String.Doc */ + /* Literal.String.Double */ + /* Literal.String.Escape */ + /* Literal.String.Heredoc */ + /* Literal.String.Interpol */ + /* Literal.String.Other */ + /* Literal.String.Regex */ + /* Literal.String.Single */ + /* Literal.String.Symbol */ + /* Name.Builtin.Pseudo */ + /* Name.Variable.Class */ + /* Name.Variable.Global */ + /* Name.Variable.Instance */ + /* Literal.Number.Integer.Long */ } + .highlight .c { + color: #999988; + font-style: italic; } + .highlight .err { + color: #a61717; + background-color: #e3d2d2; } + .highlight .k { + color: #000000; + font-weight: bold; } + .highlight .o { + color: #000000; + font-weight: bold; } + .highlight .cm { + color: #999988; + font-style: italic; } + .highlight .cp { + color: #999999; + font-weight: bold; } + .highlight .c1 { + color: #999988; + font-style: italic; } + .highlight .cs { + color: #999999; + font-weight: bold; + font-style: italic; } + .highlight .gd { + color: #000000; + background-color: #ffdddd; } + .highlight .gd .x { + color: #000000; + background-color: #ffaaaa; } + .highlight .ge { + color: #000000; + font-style: italic; } + .highlight .gr { + color: #aa0000; } + .highlight .gh { + color: #999999; } + .highlight .gi { + color: #000000; + background-color: #ddffdd; } + .highlight .gi .x { + color: #000000; + background-color: #aaffaa; } + .highlight .go { + color: #888888; } + .highlight .gp { + color: #555555; } + .highlight .gs { + font-weight: bold; } + .highlight .gu { + color: #aaaaaa; } + .highlight .gt { + color: #aa0000; } + .highlight .kc { + color: #000000; + font-weight: bold; } + .highlight .kd { + color: #000000; + font-weight: bold; } + .highlight .kp { + color: #000000; + font-weight: bold; } + .highlight .kr { + color: #000000; + font-weight: bold; } + .highlight .kt { + color: #445588; } + .highlight .m { + color: #009999; } + .highlight .s { + color: #d14; } + .highlight .na { + color: #008080; } + .highlight .nb { + color: #0086B3; } + .highlight .nc { + color: #445588; + font-weight: bold; } + .highlight .no { + color: #008080; } + .highlight .ni { + color: #800080; } + .highlight .ne { + color: #990000; + font-weight: bold; } + .highlight .nf { + color: #990000; } + .highlight .nn { + color: #555555; } + .highlight .nt { + color: #000080; } + .highlight .nv { + color: #008080; } + .highlight .ow { + color: #000000; + font-weight: bold; } + .highlight .w { + color: #bbbbbb; } + .highlight .mf { + color: #009999; } + .highlight .mh { + color: #009999; } + .highlight .mi { + color: #009999; } + .highlight .mo { + color: #009999; } + .highlight .sb { + color: #d14; } + .highlight .sc { + color: #d14; } + .highlight .sd { + color: #d14; } + .highlight .s2 { + color: #d14; } + .highlight .se { + color: #d14; } + .highlight .sh { + color: #d14; } + .highlight .si { + color: #d14; } + .highlight .sx { + color: #d14; } + .highlight .sr { + color: #009926; } + .highlight .s1 { + color: #d14; } + .highlight .ss { + color: #990073; } + .highlight .bp { + color: #999999; } + .highlight .vc { + color: #008080; } + .highlight .vg { + color: #008080; } + .highlight .vi { + color: #008080; } + .highlight .il { + color: #009999; } diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/css/jazzy.css b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/css/jazzy.css new file mode 100644 index 0000000..d628282 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/css/jazzy.css @@ -0,0 +1,337 @@ +html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { + background: transparent; + border: 0; + margin: 0; + outline: 0; + padding: 0; + vertical-align: baseline; } + +body { + background-color: #f2f2f2; + font-family: Helvetica, freesans, Arial, sans-serif; + font-size: 14px; + -webkit-font-smoothing: subpixel-antialiased; + word-wrap: break-word; } + +h1, h2, h3 { + margin-top: 0.8em; + margin-bottom: 0.3em; + font-weight: 100; + color: black; } + +h1 { + font-size: 2.5em; } + +h2 { + font-size: 2em; + border-bottom: 1px solid #e2e2e2; } + +h4 { + font-size: 13px; + line-height: 1.5; + margin-top: 21px; } + +h5 { + font-size: 1.1em; } + +h6 { + font-size: 1.1em; + color: #777; } + +.section-name { + color: gray; + display: block; + font-family: Helvetica; + font-size: 22px; + font-weight: 100; + margin-bottom: 15px; } + +pre, code { + font: 0.95em Menlo, monospace; + color: #777; + word-wrap: normal; } + +p code, li code { + background-color: #eee; + padding: 2px 4px; + border-radius: 4px; } + +a { + color: #0088cc; + text-decoration: none; } + +ul { + padding-left: 15px; } + +li { + line-height: 1.8em; } + +img { + max-width: 100%; } + +blockquote { + margin-left: 0; + padding: 0 10px; + border-left: 4px solid #ccc; } + +.content-wrapper { + margin: 0 auto; + width: 980px; } + +header { + font-size: 0.85em; + line-height: 26px; + background-color: #414141; + position: fixed; + width: 100%; + z-index: 1; } + header img { + padding-right: 6px; + vertical-align: -4px; + height: 16px; } + header a { + color: #fff; } + header p { + float: left; + color: #999; } + header .header-right { + float: right; + margin-left: 16px; } + +#breadcrumbs { + background-color: #f2f2f2; + height: 27px; + padding-top: 17px; + position: fixed; + width: 100%; + z-index: 1; + margin-top: 26px; } + #breadcrumbs #carat { + height: 10px; + margin: 0 5px; } + +.sidebar { + background-color: #f9f9f9; + border: 1px solid #e2e2e2; + overflow-y: auto; + overflow-x: hidden; + position: fixed; + top: 70px; + bottom: 0; + width: 230px; + word-wrap: normal; } + +.nav-groups { + list-style-type: none; + background: #fff; + padding-left: 0; } + +.nav-group-name { + border-bottom: 1px solid #e2e2e2; + font-size: 1.1em; + font-weight: 100; + padding: 15px 0 15px 20px; } + .nav-group-name > a { + color: #333; } + +.nav-group-tasks { + margin-top: 5px; } + +.nav-group-task { + font-size: 0.9em; + list-style-type: none; + white-space: nowrap; } + .nav-group-task a { + color: #888; } + +.main-content { + background-color: #fff; + border: 1px solid #e2e2e2; + margin-left: 246px; + position: absolute; + overflow: hidden; + padding-bottom: 60px; + top: 70px; + width: 734px; } + .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { + margin-bottom: 1em; } + .main-content p { + line-height: 1.8em; } + .main-content section .section:first-child { + margin-top: 0; + padding-top: 0; } + .main-content section .task-group-section .task-group:first-of-type { + padding-top: 10px; } + .main-content section .task-group-section .task-group:first-of-type .section-name { + padding-top: 15px; } + .main-content section .heading:before { + content: ""; + display: block; + padding-top: 70px; + margin: -70px 0 0; } + +.section { + padding: 0 25px; } + +.highlight { + background-color: #eee; + padding: 10px 12px; + border: 1px solid #e2e2e2; + border-radius: 4px; + overflow-x: auto; } + +.declaration .highlight { + overflow-x: initial; + padding: 0 40px 40px 0; + margin-bottom: -25px; + background-color: transparent; + border: none; } + +.section-name { + margin: 0; + margin-left: 18px; } + +.task-group-section { + padding-left: 6px; + border-top: 1px solid #e2e2e2; } + +.task-group { + padding-top: 0px; } + +.task-name-container a[name]:before { + content: ""; + display: block; + padding-top: 70px; + margin: -70px 0 0; } + +.item { + padding-top: 8px; + width: 100%; + list-style-type: none; } + .item a[name]:before { + content: ""; + display: block; + padding-top: 70px; + margin: -70px 0 0; } + .item code { + background-color: transparent; + padding: 0; } + .item .token { + padding-left: 3px; + margin-left: 15px; + font-size: 11.9px; } + .item .declaration-note { + font-size: .85em; + color: gray; + font-style: italic; } + +.pointer-container { + border-bottom: 1px solid #e2e2e2; + left: -23px; + padding-bottom: 13px; + position: relative; + width: 110%; } + +.pointer { + background: #f9f9f9; + border-left: 1px solid #e2e2e2; + border-top: 1px solid #e2e2e2; + height: 12px; + left: 21px; + top: -7px; + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + position: absolute; + width: 12px; } + +.height-container { + display: none; + left: -25px; + padding: 0 25px; + position: relative; + width: 100%; + overflow: hidden; } + .height-container .section { + background: #f9f9f9; + border-bottom: 1px solid #e2e2e2; + left: -25px; + position: relative; + width: 100%; + padding-top: 10px; + padding-bottom: 5px; } + +.aside, .language { + padding: 6px 12px; + margin: 12px 0; + border-left: 5px solid #dddddd; + overflow-y: hidden; } + .aside .aside-title, .language .aside-title { + font-size: 9px; + letter-spacing: 2px; + text-transform: uppercase; + padding-bottom: 0; + margin: 0; + color: #aaa; + -webkit-user-select: none; } + .aside p:last-child, .language p:last-child { + margin-bottom: 0; } + +.language { + border-left: 5px solid #cde9f4; } + .language .aside-title { + color: #4b8afb; } + +.aside-warning { + border-left: 5px solid #ff6666; } + .aside-warning .aside-title { + color: #ff0000; } + +.graybox { + border-collapse: collapse; + width: 100%; } + .graybox p { + margin: 0; + word-break: break-word; + min-width: 50px; } + .graybox td { + border: 1px solid #e2e2e2; + padding: 5px 25px 5px 10px; + vertical-align: middle; } + .graybox tr td:first-of-type { + text-align: right; + padding: 7px; + vertical-align: top; + word-break: normal; + width: 40px; } + +.slightly-smaller { + font-size: 0.9em; } + +#footer { + position: absolute; + bottom: 10px; + margin-left: 25px; } + #footer p { + margin: 0; + color: #aaa; + font-size: 0.8em; } + +html.dash header, html.dash #breadcrumbs, html.dash .sidebar { + display: none; } +html.dash .main-content { + width: 980px; + margin-left: 0; + border: none; + width: 100%; + top: 0; + padding-bottom: 0; } +html.dash .height-container { + display: block; } +html.dash .item .token { + margin-left: 0; } +html.dash .content-wrapper { + width: auto; } +html.dash #footer { + position: static; } diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/carat.png b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/carat.png new file mode 100755 index 0000000..29d2f7f Binary files /dev/null and b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/carat.png differ diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/dash.png b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/dash.png new file mode 100755 index 0000000..6f694c7 Binary files /dev/null and b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/dash.png differ diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/gh.png b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/gh.png new file mode 100755 index 0000000..628da97 Binary files /dev/null and b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/img/gh.png differ diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/index.html b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/index.html new file mode 100644 index 0000000..f332ff3 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/index.html @@ -0,0 +1,421 @@ + + + + Nem2SdkSwift Reference + + + + + + + + + +
+
+

Nem2SdkSwift Docs (99% documented)

+
+
+
+ +
+
+ +
+
+
+ +

nem2-sdk for Swift 4

+ +

The nem2-sdk for Swift 4, available for mobile applications on iOS, to work with the NEM2 (a.k.a Catapult).

+

Requirements

+ +
    +
  • iOS 9.0 or higher
  • +
  • Swift 4 or higher
  • +
+

Sample Project

+ +

Sample project are in Nem2SdkSwiftDemo directory.

+

Installation

+

Cocoa Pods

+ +

Not yet.

+

Carthage

+ +
    +
  1. Insert github proximax-storage/nem2-sdk-swift to your Cartfile.

  2. +
  3. Run carthage update.

  4. +
  5. Add Nem2SdkSwift.framework to Linked Frameworks and Libraries
    +3-1. Select your application project in the Project navigator.
    +3-2. Click on the + button under the Linked Frameworks and Libraries section in General tab.
    +3-3. Select Nem2SwiftSdk.framework in Carthage/Build/iOS

  6. +
  7. Add Run Script in Build Phases
    +Build Phases -> Click + -> New Run Script Phase

    + +
      +
    • Shell: /bin/sh
    • +
    • Script: /usr/local/bin/carthage copy-frameworks
    • +
    • Input Files: The following frameworks in Carthage/Build/iOS + +
        +
      • Alamofire.framework
      • +
      • CryptoSwift.framework
      • +
      • Nem2SdkSwift.framework
      • +
      • RxSwift.framework
      • +
      • Starscream.framework
      • +
    • +
  8. +
+

Manual

+ +
    +
  1. Clone this repository with submodules using –recursive switch.

    +
    $ git clone --recursive https://github.com/proximax-storage/nem2-sdk-swift.git
    +
  2. +
  3. Run carthage to download depending libraries.

    +
    $ cd nem2-sdk-swift
    +$ carthage update --platform ios
    +
  4. +
  5. Add Nem2SwiftSdk.xcodeproj to your application project.
    +Right click on Navigator in Xcode, select Add Files to … and select Nem2SwiftSdk.xcodeproj.

  6. +
  7. Add Nem2SwiftSdk.framework.
    +4-1. Select your application project in the Project navigator.
    +4-2. Click on the + button under the Embedded Binaries section in General tab.
    +4-3. Select Nem2SwiftSdk.framework

  8. +
  9. Add depeneded frameworks.
    +Add the following frameworks in nem2-sdk-swift/Carthage/Build/iOS directory to Embedded Binaries

    + +
      +
    • RxSwift.framework
    • +
    + +

    If you don’t check Copy items if needed, add nem2-sdk-swift/Carthage/Build/iOS directory to Framework Search Paths of your application.

  10. +
+

How to use

+

Account Generation

+ +

Account generates a NEM account. Network version is required.

+
let account = Account(networkType: .mijinTest)
+
+ +

If you have private key already, retrieve the account from the key.

+
let account = Account(privateKeyHexString: privateKey, network: .mijinTest)
+
+

Sending XEM or Mosaics

+ +

First, create TransferTransaction object.

+
let transaction = TransferTransaction.create(
+    recipient: try Address(rawAddress: "SC7A4H-7CYCSH-4CP4XI-ZS4G2G-CDZ7JP-PR5FRG-2VBU"),
+    mosaics: [XEM.of(xemAmount: 10)],
+    networkType: .mijinTest)
+
+ +

In this example, a sender sends 10 XEM to SC7A4H-7CYCSH-4CP4XI-ZS4G2G-CDZ7JP-PR5FRG-2VBU .

+ +

Next, sign the transaction with the sender account.

+
let signedTransaction = account.sign(transaction: transaction)
+
+ +

Then send the transaction with TransactionHttp.

+
import RxSwift
+...
+
+let transactionHttp = TransactionHttp(url: URL(string:"http://localhost:3000")!)
+transactionHttp.announce(signedTransaction: signedTransaction).subscribe(
+    onSuccess: { announceResult in
+        ...
+    },
+    onError: { error in
+        ...
+    }).disposed(by: disposeBag)
+
+ +

The response is Single of RxSwift.

+

Monitoring Transactions

+ +

Listener monitors block generations and the transactions you are insterested in.

+ +

First, create Listener instance and call open

+
let listener = Listener(url: URL(string:"http://localhost:3000")!)
+
+listener.open().subscribe(
+    onCompleted: {
+       ...
+    },
+    onError: { error in
+       ...
+    }).disposed(by: disposeBag)
+
+ +

The response of open is Completable of RxSwift.

+ +

After onCompleted is notified, call confirmed or a function corresponding to the item you want to monitor.

+
listener.confirmed(address: address)
+    .subscribe(onNext: { transaction in
+         ...
+    }).disposed(by: disposeBag)
+
+ +

The response of confirmed is Observable. +Each time a transaction is confirmed, onNext is notified.

+

Other NEM2 APIs

+ +

You can use REST API of NEM2 with AccountHttp, BlockchainHttp, MosaicHttp, NamespaceHttp, NetworkHttp and TransactionHttp.

+ +

See REST API reference for detail.

+

API Reference

+ +

You can see API Reference of Nem2SdkSwift in nem2-sdk-swift/docs. +Open nem2-sdk-swift/docs/index.html with your browser.

+

License

+ +

Nem2SdkSwift is available under the Apache License 2.0. See the LICENSE file for more info.

+ +
+
+ +
+
+ + + diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/js/jazzy.js b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/js/jazzy.js new file mode 100755 index 0000000..3965b5f --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/js/jazzy.js @@ -0,0 +1,46 @@ +window.jazzy = {'docset': false} +if (typeof window.dash != 'undefined') { + document.documentElement.className += ' dash' + window.jazzy.docset = true +} +if (navigator.userAgent.match(/xcode/i)) { + document.documentElement.className += ' xcode' + window.jazzy.docset = true +} + +// On doc load, toggle the URL hash discussion if present +$(document).ready(function() { + if (!window.jazzy.docset) { + var linkToHash = $('a[href="' + window.location.hash +'"]'); + linkToHash.trigger("click"); + } +}); + +// On token click, toggle its discussion and animate token.marginLeft +$(".token").click(function(event) { + if (window.jazzy.docset) { + return; + } + var link = $(this); + var animationDuration = 300; + var tokenOffset = "15px"; + var original = link.css('marginLeft') == tokenOffset; + link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); + $content = link.parent().parent().next(); + $content.slideToggle(animationDuration); + + // Keeps the document from jumping to the hash. + var href = $(this).attr('href'); + if (history.pushState) { + history.pushState({}, '', href); + } else { + location.hash = href; + } + event.preventDefault(); +}); + +// Dumb down quotes within code blocks that delimit strings instead of quotations +// https://github.com/realm/jazzy/issues/714 +$("code q").replaceWith(function () { + return ["\"", $(this).contents(), "\""]; +}); diff --git a/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/js/jquery.min.js b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/js/jquery.min.js new file mode 100755 index 0000000..ab28a24 --- /dev/null +++ b/docs/docsets/Nem2SdkSwift.docset/Contents/Resources/Documents/js/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h; +if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?""!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("