diff --git a/.github/workflows/npm.yaml b/.github/workflows/npm.yaml new file mode 100644 index 00000000..27ee31b9 --- /dev/null +++ b/.github/workflows/npm.yaml @@ -0,0 +1,25 @@ +name: Publish to npm + +on: + push: + tags: + - '*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + #Install Node.js, with the version 12 and using the registry URL of npm, this could be changed to a custom registry or the GitHub registry. + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + + # Command to install the package dependencies + # - run: yarn install + + # Publish to npm + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 15f518e5..75165acf 100644 --- a/.gitignore +++ b/.gitignore @@ -108,4 +108,9 @@ crashlytics-build.properties /[Aa]ssets/[Ss]treamingAssets/aa.meta /[Aa]ssets/[Ss]treamingAssets/aa/* dist/* - +*.pidb.meta +sysinfo.txt +*.apk +*.usertasks +*.resources +/BUILD/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..8a8ab107 --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +/TextMesh Pro/ +TextMesh Pro.meta +LICENSE.md +README.md +CHANGELOG.md \ No newline at end of file diff --git a/Assets/Data/Wallets/Temple.asset b/Assets/Data/Wallets/Temple.asset deleted file mode 100644 index f8b5762b..00000000 --- a/Assets/Data/Wallets/Temple.asset +++ /dev/null @@ -1,20 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cbdb2ac43688c49e992239a9dda0906c, type: 3} - m_Name: Temple - m_EditorClassIdentifier: - key: temple_ios - walletName: Temple Wallet - shortName: Temple - logo: {fileID: 0} - universalLink: https://templewallet.com - deepLink: temple:// diff --git a/Assets/Data/Wallets/Temple.asset.meta b/Assets/Data/Wallets/Temple.asset.meta deleted file mode 100644 index 3786db93..00000000 --- a/Assets/Data/Wallets/Temple.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3fc169fc104cf4f2c8b0036c57b5619c -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/Utils.meta b/Assets/Plugins/Android/Source/Utils.meta deleted file mode 100644 index a5b7183d..00000000 --- a/Assets/Plugins/Android/Source/Utils.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 88b7cdaa7aeaaf446a8192b46a520e50 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/Utils/BeaconMessage.kt b/Assets/Plugins/Android/Source/Utils/BeaconMessage.kt deleted file mode 100644 index 511796b7..00000000 --- a/Assets/Plugins/Android/Source/Utils/BeaconMessage.kt +++ /dev/null @@ -1,502 +0,0 @@ -package it.airgap.beaconsdk.utils - -import it.airgap.beaconsdk.blockchain.substrate.message.request.BlockchainSubstrateRequest -import it.airgap.beaconsdk.blockchain.substrate.message.request.PermissionSubstrateRequest -import it.airgap.beaconsdk.blockchain.substrate.message.request.SignPayloadSubstrateRequest -import it.airgap.beaconsdk.blockchain.substrate.message.request.TransferSubstrateRequest -import it.airgap.beaconsdk.blockchain.substrate.message.response.* -import it.airgap.beaconsdk.blockchain.tezos.message.request.* -import it.airgap.beaconsdk.blockchain.tezos.message.response.* -import it.airgap.beaconsdk.core.data.BeaconError -import it.airgap.beaconsdk.core.data.Connection -import it.airgap.beaconsdk.core.internal.utils.failWithIllegalArgument -import it.airgap.beaconsdk.core.message.* -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.JsonObject -import kotlinx.serialization.json.encodeToJsonElement - -fun BeaconMessage.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is BeaconRequest -> toJson(json) - is BeaconResponse -> toJson(json) - is DisconnectBeaconMessage -> toJson(json) - } - -fun BeaconRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is PermissionBeaconRequest -> toJson(json) - is BlockchainBeaconRequest -> toJson(json) - } - -fun PermissionBeaconRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is PermissionTezosRequest -> toJson(json) - is PermissionSubstrateRequest -> toJson(json) - else -> failWithUnknownPermissionBeaconRequest(this) - } - -fun BlockchainBeaconRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is BlockchainTezosRequest -> toJson(json) - is BlockchainSubstrateRequest -> toJson(json) - else -> failWithUnknownBlockchainBeaconRequest(this) - } - -fun BeaconResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is PermissionBeaconResponse -> toJson(json) - is BlockchainBeaconResponse -> toJson(json) - is AcknowledgeBeaconResponse -> toJson(json) - is ErrorBeaconResponse -> toJson(json) - } - -fun PermissionBeaconResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is PermissionTezosResponse -> toJson(json) - is PermissionSubstrateResponse -> toJson(json) - else -> failWithUnknownPermissionBeaconResponse(this) - } - -fun BlockchainBeaconResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is BlockchainTezosResponse -> toJson(json) - is BlockchainSubstrateResponse -> toJson(json) - else -> failWithUnknownBlockchainBeaconResponse(this) - } - -fun AcknowledgeBeaconResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("acknowledge_response"), - "id" to json.encodeToJsonElement(id), - "senderId" to json.encodeToJsonElement(senderId), - "version" to json.encodeToJsonElement(version), - ) - ) - -fun ErrorBeaconResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("error_response"), - "id" to json.encodeToJsonElement(id), - "errorType" to json.encodeToJsonElement(BeaconError.serializer(errorType.blockchainIdentifier), errorType), - "version" to json.encodeToJsonElement(version), - ) - ) - -fun DisconnectBeaconMessage.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "id" to json.encodeToJsonElement(id), - "senderId" to json.encodeToJsonElement(senderId), - "version" to json.encodeToJsonElement(version), - "origin" to origin.toJson(json), - ) - ) - -// -- Tezos -- - -fun PermissionTezosRequest.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_permission_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "network" to json.encodeToJsonElement(network), - "scopes" to json.encodeToJsonElement(scopes), - ) - ) - -fun BlockchainTezosRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is OperationTezosRequest -> toJson(json) - is SignPayloadTezosRequest -> toJson(json) - is BroadcastTezosRequest -> toJson(json) - } - -fun OperationTezosRequest.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_operation_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "network" to json.encodeToJsonElement(network), - "operationDetails" to json.encodeToJsonElement(operationDetails), - "sourceAddress" to json.encodeToJsonElement(sourceAddress), - ) - ) - -fun SignPayloadTezosRequest.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_sign_payload_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "signingType" to json.encodeToJsonElement(signingType), - "payload" to json.encodeToJsonElement(payload), - "sourceAddress" to json.encodeToJsonElement(sourceAddress), - ) - ) - -fun BroadcastTezosRequest.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_broadcast_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "network" to json.encodeToJsonElement(network), - "signedTransaction" to json.encodeToJsonElement(signedTransaction), - ) - ) - -fun PermissionTezosResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_permission_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "account" to json.encodeToJsonElement(account), - "scopes" to json.encodeToJsonElement(scopes), - ) - ) - -fun BlockchainTezosResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is OperationTezosResponse -> toJson(json) - is SignPayloadTezosResponse -> toJson(json) - is BroadcastTezosResponse -> toJson(json) - } - -fun OperationTezosResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_operation_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "transactionHash" to json.encodeToJsonElement(transactionHash), - ) - ) - -fun SignPayloadTezosResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_sign_payload_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "signingType" to json.encodeToJsonElement(signingType), - "signature" to json.encodeToJsonElement(signature), - ) - ) - -fun BroadcastTezosResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("tezos_broadcast_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "transactionHash" to json.encodeToJsonElement(transactionHash), - ) - ) - -// -- Substrate -- - -fun PermissionSubstrateRequest.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_permission_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "origin" to origin.toJson(json), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "scopes" to json.encodeToJsonElement(scopes), - "networks" to json.encodeToJsonElement(networks), - ) - ) - -fun BlockchainSubstrateRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is TransferSubstrateRequest -> toJson(json) - is SignPayloadSubstrateRequest -> toJson(json) - } - -fun TransferSubstrateRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is TransferSubstrateRequest.Submit -> toJson(json) - is TransferSubstrateRequest.SubmitAndReturn -> toJson(json) - is TransferSubstrateRequest.Return -> toJson(json) - } - -fun SignPayloadSubstrateRequest.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is SignPayloadSubstrateRequest.Submit -> toJson(json) - is SignPayloadSubstrateRequest.SubmitAndReturn -> toJson(json) - is SignPayloadSubstrateRequest.Return -> toJson(json) - } - -fun TransferSubstrateRequest.Submit.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_transfer_broadcast_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "accountId" to json.encodeToJsonElement(accountId), - "scope" to json.encodeToJsonElement(scope), - "sourceAddress" to json.encodeToJsonElement(sourceAddress), - "amount" to json.encodeToJsonElement(amount), - "recipient" to json.encodeToJsonElement(recipient), - "network" to json.encodeToJsonElement(network), - ) - ) - -fun TransferSubstrateRequest.SubmitAndReturn.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_transfer_broadcast_and_return_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "accountId" to json.encodeToJsonElement(accountId), - "scope" to json.encodeToJsonElement(scope), - "sourceAddress" to json.encodeToJsonElement(sourceAddress), - "amount" to json.encodeToJsonElement(amount), - "recipient" to json.encodeToJsonElement(recipient), - "network" to json.encodeToJsonElement(network), - ) - ) - -fun TransferSubstrateRequest.Return.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_transfer_return_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "accountId" to json.encodeToJsonElement(accountId), - "scope" to json.encodeToJsonElement(scope), - "sourceAddress" to json.encodeToJsonElement(sourceAddress), - "amount" to json.encodeToJsonElement(amount), - "recipient" to json.encodeToJsonElement(recipient), - "network" to json.encodeToJsonElement(network), - ) - ) - -fun SignPayloadSubstrateRequest.Submit.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_sign_payload_broadcast_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "accountId" to json.encodeToJsonElement(accountId), - "scope" to json.encodeToJsonElement(scope), - "address" to json.encodeToJsonElement(address), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -fun SignPayloadSubstrateRequest.SubmitAndReturn.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_sign_payload_broadcast_and_return_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "accountId" to json.encodeToJsonElement(accountId), - "scope" to json.encodeToJsonElement(scope), - "address" to json.encodeToJsonElement(address), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -fun SignPayloadSubstrateRequest.Return.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_sign_payload_return_request"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "senderId" to json.encodeToJsonElement(senderId), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "origin" to origin.toJson(json), - "accountId" to json.encodeToJsonElement(accountId), - "scope" to json.encodeToJsonElement(scope), - "address" to json.encodeToJsonElement(address), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -fun PermissionSubstrateResponse.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_permission_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "appMetadata" to json.encodeToJsonElement(appMetadata), - "scopes" to json.encodeToJsonElement(scopes), - "accounts" to json.encodeToJsonElement(accounts), - ) - ) - -fun BlockchainSubstrateResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is TransferSubstrateResponse -> toJson(json) - is SignPayloadSubstrateResponse -> toJson(json) - } - -fun TransferSubstrateResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is TransferSubstrateResponse.Submit -> toJson(json) - is TransferSubstrateResponse.SubmitAndReturn -> toJson(json) - is TransferSubstrateResponse.Return -> toJson(json) - } - -fun SignPayloadSubstrateResponse.toJson(json: Json = Json.Default): JsonElement = - when (this) { - is SignPayloadSubstrateResponse.Submit -> toJson(json) - is SignPayloadSubstrateResponse.SubmitAndReturn -> toJson(json) - is SignPayloadSubstrateResponse.Return -> toJson(json) - } - -fun TransferSubstrateResponse.Submit.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_transfer_broadcast_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "transactionHash" to json.encodeToJsonElement(transactionHash), - ) - ) - -fun TransferSubstrateResponse.SubmitAndReturn.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_transfer_broadcast_and_return_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "transactionHash" to json.encodeToJsonElement(transactionHash), - "signature" to json.encodeToJsonElement(signature), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -fun TransferSubstrateResponse.Return.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_transfer_return_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "signature" to json.encodeToJsonElement(signature), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -fun SignPayloadSubstrateResponse.Submit.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_sign_payload_broadcast_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "transactionHash" to json.encodeToJsonElement(transactionHash), - ) - ) - -fun SignPayloadSubstrateResponse.SubmitAndReturn.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_sign_payload_broadcast_and_return_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "transactionHash" to json.encodeToJsonElement(transactionHash), - "signature" to json.encodeToJsonElement(signature), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -fun SignPayloadSubstrateResponse.Return.toJson(json: Json = Json.Default): JsonElement = - JsonObject( - mapOf( - "type" to json.encodeToJsonElement("substrate_sign_payload_return_response"), - "id" to json.encodeToJsonElement(id), - "version" to json.encodeToJsonElement(version), - "destination" to destination.toJson(json), - "blockchainIdentifier" to json.encodeToJsonElement(blockchainIdentifier), - "signature" to json.encodeToJsonElement(signature), - "payload" to json.encodeToJsonElement(payload), - ) - ) - -private fun Connection.Id.toJson(json: Json = Json.Default): JsonElement { - val type = when (this) { - is Connection.Id.P2P -> "p2p" - } - - return JsonObject( - mapOf( - "type" to json.encodeToJsonElement(type), - "id" to json.encodeToJsonElement(id), - ) - ) -} - -private fun failWithUnknownPermissionBeaconRequest(request: PermissionBeaconRequest): Nothing = - failWithIllegalArgument("Unknown Beacon permission request of type ${request::class}") - -private fun failWithUnknownBlockchainBeaconRequest(request: BlockchainBeaconRequest): Nothing = - failWithIllegalArgument("Unknown Beacon blockchain request of type ${request::class}") - -private fun failWithUnknownPermissionBeaconResponse(response: PermissionBeaconResponse): Nothing = - failWithIllegalArgument("Unknown Beacon permission response of type ${response::class}") - -private fun failWithUnknownBlockchainBeaconResponse(response: BlockchainBeaconResponse): Nothing = - failWithIllegalArgument("Unknown Beacon blockchain response of type ${response::class}") \ No newline at end of file diff --git a/Assets/Plugins/Android/Source/Utils/BeaconMessage.kt.meta b/Assets/Plugins/Android/Source/Utils/BeaconMessage.kt.meta deleted file mode 100644 index a198c79f..00000000 --- a/Assets/Plugins/Android/Source/Utils/BeaconMessage.kt.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 64ebbebe8c6bc184e94166ee931b5faa -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/Utils/LiveData.kt b/Assets/Plugins/Android/Source/Utils/LiveData.kt deleted file mode 100644 index 7b007b09..00000000 --- a/Assets/Plugins/Android/Source/Utils/LiveData.kt +++ /dev/null @@ -1,8 +0,0 @@ -package it.airgap.beaconsdk.utils - -import androidx.lifecycle.MutableLiveData - -fun MutableLiveData.setValue(default: T, update: T.() -> T) { - val state = value ?: default - value = state.update() -} \ No newline at end of file diff --git a/Assets/Plugins/Android/Source/Utils/LiveData.kt.meta b/Assets/Plugins/Android/Source/Utils/LiveData.kt.meta deleted file mode 100644 index 5d4c5f13..00000000 --- a/Assets/Plugins/Android/Source/Utils/LiveData.kt.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: bea0966dd2b5f514abeffea5783e662c -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/blockchain-substrate-3.2.1.aar b/Assets/Plugins/Android/Source/blockchain-substrate-3.2.1.aar deleted file mode 100644 index 578e4f7c..00000000 Binary files a/Assets/Plugins/Android/Source/blockchain-substrate-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/blockchain-substrate-3.2.1.aar.meta b/Assets/Plugins/Android/Source/blockchain-substrate-3.2.1.aar.meta deleted file mode 100644 index 6cbb1fef..00000000 --- a/Assets/Plugins/Android/Source/blockchain-substrate-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 9314ee5121081a44199d49e895ae5270 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/blockchain-tezos-3.2.1.aar b/Assets/Plugins/Android/Source/blockchain-tezos-3.2.1.aar deleted file mode 100644 index e425fc63..00000000 Binary files a/Assets/Plugins/Android/Source/blockchain-tezos-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/blockchain-tezos-3.2.1.aar.meta b/Assets/Plugins/Android/Source/blockchain-tezos-3.2.1.aar.meta deleted file mode 100644 index 894e85c7..00000000 --- a/Assets/Plugins/Android/Source/blockchain-tezos-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 6844fbc0bbd2e524f8304d6d45c285e5 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/client-dapp-3.2.1.aar b/Assets/Plugins/Android/Source/client-dapp-3.2.1.aar deleted file mode 100644 index 95058f9a..00000000 Binary files a/Assets/Plugins/Android/Source/client-dapp-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/client-dapp-3.2.1.aar.meta b/Assets/Plugins/Android/Source/client-dapp-3.2.1.aar.meta deleted file mode 100644 index e1c52edc..00000000 --- a/Assets/Plugins/Android/Source/client-dapp-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 69db4a26ac94bd043a1a158a80376fe1 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/client-wallet-3.2.1.aar b/Assets/Plugins/Android/Source/client-wallet-3.2.1.aar deleted file mode 100644 index 3dad52ec..00000000 Binary files a/Assets/Plugins/Android/Source/client-wallet-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/client-wallet-3.2.1.aar.meta b/Assets/Plugins/Android/Source/client-wallet-3.2.1.aar.meta deleted file mode 100644 index 15aaecf9..00000000 --- a/Assets/Plugins/Android/Source/client-wallet-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: cd5cfe1e811cc1e4083791941f74700b -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/client-wallet-compat-3.2.1.aar b/Assets/Plugins/Android/Source/client-wallet-compat-3.2.1.aar deleted file mode 100644 index 7ce115ac..00000000 Binary files a/Assets/Plugins/Android/Source/client-wallet-compat-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/client-wallet-compat-3.2.1.aar.meta b/Assets/Plugins/Android/Source/client-wallet-compat-3.2.1.aar.meta deleted file mode 100644 index 1ced5e8a..00000000 --- a/Assets/Plugins/Android/Source/client-wallet-compat-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 753e41213cd32344795588b708724c7e -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/core-3.2.1.aar b/Assets/Plugins/Android/Source/core-3.2.1.aar deleted file mode 100644 index 22a002f8..00000000 Binary files a/Assets/Plugins/Android/Source/core-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/core-3.2.1.aar.meta b/Assets/Plugins/Android/Source/core-3.2.1.aar.meta deleted file mode 100644 index 742f8f26..00000000 --- a/Assets/Plugins/Android/Source/core-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: cc8e91f2c972a5c4babd54c535799817 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/dapp.meta b/Assets/Plugins/Android/Source/dapp.meta deleted file mode 100644 index a63e7965..00000000 --- a/Assets/Plugins/Android/Source/dapp.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 90e56c05a4899c04f92cf59ba06274ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/dapp/DAppViewModel.kt b/Assets/Plugins/Android/Source/dapp/DAppViewModel.kt deleted file mode 100644 index 1776f1c4..00000000 --- a/Assets/Plugins/Android/Source/dapp/DAppViewModel.kt +++ /dev/null @@ -1,266 +0,0 @@ -package it.airgap.beaconsdk.dapp - -import androidx.lifecycle.viewModelScope -import android.util.Log -import it.airgap.beaconsdk.blockchain.substrate.substrate -import it.airgap.beaconsdk.blockchain.tezos.data.TezosNetwork -import it.airgap.beaconsdk.blockchain.tezos.data.TezosPermission -import it.airgap.beaconsdk.blockchain.tezos.data.operation.MichelineMichelsonV1Expression -import it.airgap.beaconsdk.blockchain.tezos.data.operation.TezosOperation -import it.airgap.beaconsdk.blockchain.tezos.data.operation.TezosTransactionOperation -import it.airgap.beaconsdk.blockchain.tezos.extension.requestTezosBroadcast -import it.airgap.beaconsdk.blockchain.tezos.extension.requestTezosOperation -import it.airgap.beaconsdk.blockchain.tezos.extension.requestTezosPermission -import it.airgap.beaconsdk.blockchain.tezos.extension.requestTezosSignPayload -import it.airgap.beaconsdk.blockchain.tezos.message.response.BroadcastTezosResponse -import it.airgap.beaconsdk.blockchain.tezos.message.response.OperationTezosResponse -import it.airgap.beaconsdk.blockchain.tezos.message.response.SignPayloadTezosResponse -import it.airgap.beaconsdk.blockchain.tezos.tezos -import it.airgap.beaconsdk.client.dapp.BeaconDAppClient -import it.airgap.beaconsdk.core.data.Connection -import it.airgap.beaconsdk.core.data.SigningType -import it.airgap.beaconsdk.core.message.* -import it.airgap.beaconsdk.transport.p2p.matrix.p2pMatrix -import kotlinx.coroutines.* -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.flow.onStart -import kotlinx.coroutines.flow.onCompletion -import kotlinx.coroutines.launch -import kotlinx.serialization.decodeFromString -import kotlinx.serialization.json.Json -import com.unity3d.player.UnityPlayer; -import it.airgap.beaconsdk.utils.toJson - -class DAppViewModel -{ - private var beaconClient: BeaconDAppClient? = null - private var awaitingResponse: BeaconResponse? = null - - //Starts up a Beacon client - fun startBeacon(){ - CoroutineScope(Dispatchers.Default).launch { - val client = BeaconDAppClient("Beacon SDK Demo (DApp)", clientId = "__dapp__") { - support(tezos(), substrate()) - use(p2pMatrix()) - - ignoreUnsupportedBlockchains = true - }.also { beaconClient = it } - client.connect() - .onStart { - checkForActiveAccount() - UnityPlayer.UnitySendMessage("UnityBeacon", "OnClientCreated", "client Created") - } - .onCompletion { UnityPlayer.UnitySendMessage("UnityBeacon", "OnPairingCompleted", "Pairing Completed") } - .collect { result -> - result.getOrNull()?.let { onBeaconResponse( it) } - result.exceptionOrNull()?.let { onError( it) } - } - } - } - - fun stopBeacon(){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.removeAllPeers() - beaconClient?.removeAllPermissions() - startBeacon() - UnityPlayer.UnitySendMessage("UnityBeacon", "OnAccountDisconnected", "Disconnected from wallets") - } - } - - //Makes a handshake request for QR and DeepLink. Spits out serializerPairingRequest to receiver - fun requestHandshake(){ - Log.w("requestHandshake", "IN REQUEST HANDSHAKE: beaconClient = $beaconClient") - val beaconClient = beaconClient ?: return - CoroutineScope(Dispatchers.Default).launch { - val pairingRequest = beaconClient.pair() - val serializerPairingRequest = beaconClient.serializePairingData(pairingRequest) - - requestTezosPermission() - UnityPlayer.UnitySendMessage("UnityBeacon", "OnHandshakeReceived", serializerPairingRequest) - } - } - - //Allows waiting for permissions to be granted for pairing. Use this one if you want to use default settings. - fun requestTezosPermission(){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosPermission() - } - } - - //Allows waiting for permissions to be granted for pairing. Use this one if you want to define a network. - fun requestTezosPermission( networkName: String = "", networkRPC: String){ - val network: TezosNetwork = TezosNetwork.Custom(networkName, networkRPC) - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosPermission(network) - } - } - - //Allows waiting for permissions to be granted for pairing. Use this one if you want to define a network, scope, and connection type. - fun requestTezosPermission(networkName: String = "", networkRPC: String, scopes: List, transportType: Connection.Type = Connection.Type.P2P){ - val network: TezosNetwork = TezosNetwork.Custom(networkName, networkRPC) - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosPermission(network, scopes, transportType) - } - } - - //Allows requesting a new operation. This version will use full default values for the parameters. (So should only be used for testing) - fun requestTezosOperation(){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosOperation() - } - "--=--Tezos Operation Requested--=--" - } - - //Allows requesting a new operation. This version will only allow for a single operation but all portions of the operation will be fillable through C#. - fun requestTezosOperation(destination: String = "tz1RmqagvEGJxVwPwf94m2vcGmhJRh7uiexS", amount: String = "1", entrypoint: String = "default", arg: String? = null, networkName: String = "", networkRPC: String = ""){ - val network: TezosNetwork = TezosNetwork.Custom(networkName, networkRPC) - - CoroutineScope(Dispatchers.Default).launch { - val parameters = arg?.let { - val expression = Json.decodeFromString(it) - TezosTransactionOperation.Parameters(entrypoint, expression) - } - - beaconClient?.requestTezosOperation( - listOf( - TezosTransactionOperation(amount = amount, destination = destination, parameters = parameters), - ), network - ) - } - } - //Allows requesting a new operation. This version will allow for multiple TezosOperations as well as network and connection types. - fun requestTezosOperation(operationDetails: List = emptyList(), transportType: Connection.Type = Connection.Type.P2P, networkName: String = "", networkRPC: String = ""){ - val network: TezosNetwork = TezosNetwork.Custom(networkName, networkRPC) - - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosOperation(operationDetails, network, transportType) - } - } - - //Allows for changing an int to a SigningType for use in C#. - fun getSingingType(index: Int): SigningType { - return when (index){ - 0 -> SigningType.Raw - 1 -> SigningType.Operation - 2 -> SigningType.Micheline - else -> SigningType.Micheline - } - } - - //Allows Signing of a Payload. This version will assume it's in P2P. - fun requestTezosSignPayload(signingType: Int, payload: String){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosSignPayload( - getSingingType(signingType), - payload, - Connection.Type.P2P - ) - } - } - - //Allows Signing of a Payload. This version will allow the Connection Type to be selected. - fun requestTezosSignPayload(signingType: Int, payload: String, transportType: Connection.Type = Connection.Type.P2P){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosSignPayload( - getSingingType(signingType), - payload, - transportType - ) - } - } - - //Allows Signing of a Payload. This version will allow for full default parameters in case a method of calling it in c# is found. - fun requestTezosSignPayload(signingType: SigningType, payload: String, transportType: Connection.Type = Connection.Type.P2P){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosSignPayload( - signingType, - payload, - transportType) - } - } - - //Allows requesting a new broadcast. This version will use full default values for the parameters. (So should only be used for testing) - fun requestTezosBroadcast(signedTransaction: String){ - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosBroadcast(signedTransaction) - } - } - - //Allows requesting a new broadcast. This version will take in custom values for the network so it's callable from C# - fun requestTezosBroadcast( signedTransaction: String, networkName: String = "", networkRPC: String = "", transportType: Connection.Type = Connection.Type.P2P){ - val network: TezosNetwork = TezosNetwork.Custom(networkName, networkRPC) - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosBroadcast(signedTransaction, network, transportType) - } - } - - //Allows requesting a new broadcast. This version will work just as it does in BeaconSDK - fun requestTezosBroadcast( signedTransaction: String, transportType: Connection.Type = Connection.Type.P2P, networkName: String = "", networkRPC: String = ""){ - val network: TezosNetwork = TezosNetwork.Custom(networkName, networkRPC) - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.requestTezosBroadcast(signedTransaction, network, transportType) - } - } - - //Stops the wait for a response - fun clearResponse() { - awaitingResponse = null - checkForAwaitingResponses() - } - - //Resets the beacon client. - fun reset() { - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.reset() - checkForActiveAccount() - } - } - - //Checks if there is an active account paired. Returns the full account info. - private fun checkForActiveAccount():String = runBlocking{ - val activeAccount = beaconClient?.getActiveAccount().toString() - - activeAccount - } - - //Checks if there is an active account paired. Returns only the account address. - fun getActiveAccountAddress():String = runBlocking{ - val activeAccountAddress = beaconClient?.getActiveAccount()?.address.toString() - - activeAccountAddress - } - - //Not implimented - private fun checkForAwaitingResponses() { - } - - //Not sure what it does but it was in the Demo. - private fun saveAwaitingResponse(message: BeaconMessage) { - awaitingResponse = if (message is BeaconResponse) message else null - checkForAwaitingResponses() - } - - //Does something when a BeaconResponse is triggered. - private suspend fun onBeaconResponse(response: BeaconResponse) { - when(response) - { - is OperationTezosResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnContractCallCompleted", response.toJson().toString()) - is SignPayloadTezosResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnPayloadSigned", response.toJson().toString()) - is BroadcastTezosResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnBroadcastResponse", response.toString()) - is PermissionBeaconResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnAccountConnected", response.toJson().toString()) - //is BlockchainBeaconResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnHandshakeReceived", response.destination.id) - is AcknowledgeBeaconResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnAcknowledgeResponse", response.toString()) - is ErrorBeaconResponse -> UnityPlayer.UnitySendMessage("UnityBeacon", "OnErrorResponse", response.toJson().toString()) - } - - awaitingResponse = response - checkForActiveAccount() - } - - //Does something when there is an error. - private fun onError(error: Throwable) { - UnityPlayer.UnitySendMessage("UnityBeacon", "OnErrorResponse", error.toString()) - } -} diff --git a/Assets/Plugins/Android/Source/dapp/DAppViewModel.kt.meta b/Assets/Plugins/Android/Source/dapp/DAppViewModel.kt.meta deleted file mode 100644 index a666ec2d..00000000 --- a/Assets/Plugins/Android/Source/dapp/DAppViewModel.kt.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 8a77c32f1d8b60240bb63fa9fee948d5 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/transport-p2p-matrix-3.2.1.aar b/Assets/Plugins/Android/Source/transport-p2p-matrix-3.2.1.aar deleted file mode 100644 index 63701871..00000000 Binary files a/Assets/Plugins/Android/Source/transport-p2p-matrix-3.2.1.aar and /dev/null differ diff --git a/Assets/Plugins/Android/Source/transport-p2p-matrix-3.2.1.aar.meta b/Assets/Plugins/Android/Source/transport-p2p-matrix-3.2.1.aar.meta deleted file mode 100644 index 1e1fbe46..00000000 --- a/Assets/Plugins/Android/Source/transport-p2p-matrix-3.2.1.aar.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 128b554e49861274286b5636c2828764 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/wallet.meta b/Assets/Plugins/Android/Source/wallet.meta deleted file mode 100644 index cf8ba18c..00000000 --- a/Assets/Plugins/Android/Source/wallet.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 460bc228bd52d224d9e6acdd31fc6fbd -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt b/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt deleted file mode 100644 index 3db59302..00000000 --- a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt +++ /dev/null @@ -1,138 +0,0 @@ -package it.airgap.beaconsdk.dapp - -import androidx.lifecycle.* -import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateAccount -import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateNetwork -import it.airgap.beaconsdk.blockchain.substrate.message.request.PermissionSubstrateRequest -import it.airgap.beaconsdk.blockchain.substrate.message.response.PermissionSubstrateResponse -import it.airgap.beaconsdk.blockchain.substrate.substrate -import it.airgap.beaconsdk.blockchain.tezos.data.TezosAccount -import it.airgap.beaconsdk.blockchain.tezos.data.TezosError -import it.airgap.beaconsdk.blockchain.tezos.data.TezosNetwork -import it.airgap.beaconsdk.blockchain.tezos.extension.from -import it.airgap.beaconsdk.blockchain.tezos.message.request.BroadcastTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.request.OperationTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.request.PermissionTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.request.SignPayloadTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.response.PermissionTezosResponse -import it.airgap.beaconsdk.blockchain.tezos.tezos -import it.airgap.beaconsdk.client.wallet.BeaconWalletClient -import it.airgap.beaconsdk.core.client.BeaconClient -import it.airgap.beaconsdk.core.data.BeaconError -import it.airgap.beaconsdk.core.message.BeaconMessage -import it.airgap.beaconsdk.core.message.BeaconRequest -import it.airgap.beaconsdk.core.message.ErrorBeaconResponse -import it.airgap.beaconsdk.transport.p2p.matrix.p2pMatrix -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch - -class WalletViewModel -{ - private var beaconClient: BeaconWalletClient? = null - private var awaitingRequest: BeaconRequest? = null - - fun startBeacon(): LiveData> = liveData { - beaconClient = BeaconWalletClient("Beacon SDK Demo (Wallet)", clientId = "__wallet__") { - support(tezos(), substrate()) - use(p2pMatrix()) - - ignoreUnsupportedBlockchains = true - } - - checkForPeers() - - beaconClient?.connect() - ?.onEach { result -> result.getOrNull()?.let { saveAwaitingRequest(it) } } - ?.collect { emit(it) } - } - - //fun stopBeacon() - //{ - // beaconClient?.disconnect() - //} - // - //fun pauseBeacon() - //{ - // beaconClient?.pause() - //} - // - //fun resumeBeacon() - //{ - // beaconClient?.resume() - //} - - fun respondExample() { - val request = awaitingRequest ?: return - val beaconClient = beaconClient ?: return - - CoroutineScope(Dispatchers.Default).launch { - val response = when (request) { - - /* Tezos */ - - is PermissionTezosRequest -> PermissionTezosResponse.from(request, exampleTezosAccount(request.network, beaconClient)) - is OperationTezosRequest -> ErrorBeaconResponse.from(request, BeaconError.Aborted) - is SignPayloadTezosRequest -> ErrorBeaconResponse.from(request, TezosError.SignatureTypeNotSupported) - is BroadcastTezosRequest -> ErrorBeaconResponse.from(request, TezosError.BroadcastError) - - /* Substrate*/ - - is PermissionSubstrateRequest -> PermissionSubstrateResponse.from(request, listOf(exampleSubstrateAccount(request.networks.first(), beaconClient))) - - /* Others */ - else -> ErrorBeaconResponse.from(request, BeaconError.Unknown) - } - beaconClient.respond(response) - removeAwaitingRequest() - } - } - - fun pair(pairingRequest: String) { - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.pair(pairingRequest) - checkForPeers() - } - } - - fun removePeers() { - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.removeAllPeers() - checkForPeers() - } - } - - private suspend fun checkForPeers() { - val peers = beaconClient?.getPeers() - } - - private fun checkForAwaitingRequest() { - } - - private fun saveAwaitingRequest(message: BeaconMessage) { - awaitingRequest = if (message is BeaconRequest) message else null - checkForAwaitingRequest() - } - - private fun removeAwaitingRequest() { - awaitingRequest = null - checkForAwaitingRequest() - } - - companion object { - fun exampleTezosAccount(network: TezosNetwork, client: BeaconClient<*>): TezosAccount = TezosAccount( - "edpktpzo8UZieYaJZgCHP6M6hKHPdWBSNqxvmEt6dwWRgxDh1EAFw9", - "tz1Mg6uXUhJzuCh4dH2mdBdYBuaiVZCCZsak", - network, - client, - ) - - fun exampleSubstrateAccount(network: SubstrateNetwork, client: BeaconClient<*>): SubstrateAccount = SubstrateAccount( - "724867a19e4a9422ac85f3b9a7c4bf5ccf12c2df60d858b216b81329df716535", - "13aqy7vzMjuS2Nd6TYahHHetGt7dTgaqijT6Tpw3NS2MDFug", - network, - client, - ) - } -} \ No newline at end of file diff --git a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.bak b/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.bak deleted file mode 100644 index c2b0f3cf..00000000 --- a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.bak +++ /dev/null @@ -1,138 +0,0 @@ -package it.airgap.beaconsdk.dapp - -import androidx.lifecycle.* -import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateAccount -import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateNetwork -import it.airgap.beaconsdk.blockchain.substrate.message.request.PermissionSubstrateRequest -import it.airgap.beaconsdk.blockchain.substrate.message.response.PermissionSubstrateResponse -import it.airgap.beaconsdk.blockchain.substrate.substrate -import it.airgap.beaconsdk.blockchain.tezos.data.TezosAccount -import it.airgap.beaconsdk.blockchain.tezos.data.TezosError -import it.airgap.beaconsdk.blockchain.tezos.data.TezosNetwork -import it.airgap.beaconsdk.blockchain.tezos.extension.from -import it.airgap.beaconsdk.blockchain.tezos.message.request.BroadcastTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.request.OperationTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.request.PermissionTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.request.SignPayloadTezosRequest -import it.airgap.beaconsdk.blockchain.tezos.message.response.PermissionTezosResponse -import it.airgap.beaconsdk.blockchain.tezos.tezos -import it.airgap.beaconsdk.client.wallet.BeaconWalletClient -import it.airgap.beaconsdk.core.client.BeaconClient -import it.airgap.beaconsdk.core.data.BeaconError -import it.airgap.beaconsdk.core.message.BeaconMessage -import it.airgap.beaconsdk.core.message.BeaconRequest -import it.airgap.beaconsdk.core.message.ErrorBeaconResponse -import it.airgap.beaconsdk.transport.p2p.matrix.p2pMatrix -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch - -class WalletViewModel -{ - private var beaconClient: BeaconWalletClient? = null - private var awaitingRequest: BeaconRequest? = null - - fun startBeacon(): LiveData> = liveData { - beaconClient = BeaconWalletClient("Beacon SDK Demo (Wallet)", clientId = "__wallet__") { - support(tezos(), substrate()) - use(p2pMatrix()) - - ignoreUnsupportedBlockchains = true - } - - checkForPeers() - - beaconClient?.connect() - ?.onEach { result -> result.getOrNull()?.let { saveAwaitingRequest(it) } } - ?.collect { emit(it) } - } - - fun stopBeacon() - { - beaconClient?.disconnect() - } - - fun pauseBeacon() - { - beaconClient?.pause() - } - - fun resumeBeacon() - { - beaconClient?.resume() - } - - fun respondExample() { - val request = awaitingRequest ?: return - val beaconClient = beaconClient ?: return - - CoroutineScope(Dispatchers.Default).launch { - val response = when (request) { - - /* Tezos */ - - is PermissionTezosRequest -> PermissionTezosResponse.from(request, exampleTezosAccount(request.network, beaconClient)) - is OperationTezosRequest -> ErrorBeaconResponse.from(request, BeaconError.Aborted) - is SignPayloadTezosRequest -> ErrorBeaconResponse.from(request, TezosError.SignatureTypeNotSupported) - is BroadcastTezosRequest -> ErrorBeaconResponse.from(request, TezosError.BroadcastError) - - /* Substrate*/ - - is PermissionSubstrateRequest -> PermissionSubstrateResponse.from(request, listOf(exampleSubstrateAccount(request.networks.first(), beaconClient))) - - /* Others */ - else -> ErrorBeaconResponse.from(request, BeaconError.Unknown) - } - beaconClient.respond(response) - removeAwaitingRequest() - } - } - - fun pair(pairingRequest: String) { - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.pair(pairingRequest) - checkForPeers() - } - } - - fun removePeers() { - CoroutineScope(Dispatchers.Default).launch { - beaconClient?.removeAllPeers() - checkForPeers() - } - } - - private suspend fun checkForPeers() { - val peers = beaconClient?.getPeers() - } - - private fun checkForAwaitingRequest() { - } - - private fun saveAwaitingRequest(message: BeaconMessage) { - awaitingRequest = if (message is BeaconRequest) message else null - checkForAwaitingRequest() - } - - private fun removeAwaitingRequest() { - awaitingRequest = null - checkForAwaitingRequest() - } - - companion object { - fun exampleTezosAccount(network: TezosNetwork, client: BeaconClient<*>): TezosAccount = TezosAccount( - "edpktpzo8UZieYaJZgCHP6M6hKHPdWBSNqxvmEt6dwWRgxDh1EAFw9", - "tz1Mg6uXUhJzuCh4dH2mdBdYBuaiVZCCZsak", - network, - client, - ) - - fun exampleSubstrateAccount(network: SubstrateNetwork, client: BeaconClient<*>): SubstrateAccount = SubstrateAccount( - "724867a19e4a9422ac85f3b9a7c4bf5ccf12c2df60d858b216b81329df716535", - "13aqy7vzMjuS2Nd6TYahHHetGt7dTgaqijT6Tpw3NS2MDFug", - network, - client, - ) - } -} \ No newline at end of file diff --git a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.meta b/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.meta deleted file mode 100644 index cb744289..00000000 --- a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 91e8e9fd7497f5748b6f4ad850a5e155 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Android: Android - second: - enabled: 1 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/baseProjectTemplate.gradle b/Assets/Plugins/Android/baseProjectTemplate.gradle deleted file mode 100644 index 35eda618..00000000 --- a/Assets/Plugins/Android/baseProjectTemplate.gradle +++ /dev/null @@ -1,32 +0,0 @@ -allprojects { - buildscript { - repositories {**ARTIFACTORYREPOSITORY** - google() - jcenter() - } - - dependencies { - // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity - // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html - // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle - // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version - classpath 'com.android.tools.build:gradle:4.0.1' - **BUILD_SCRIPT_DEPS** - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0' - classpath "org.jetbrains.kotlin:kotlin-serialization:1.6.0" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.20" - } - } - - repositories {**ARTIFACTORYREPOSITORY** - google() - jcenter() - flatDir { - dirs "${project(':unityLibrary').projectDir}/libs" - } - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/Assets/Plugins/Android/gradleTemplate.properties b/Assets/Plugins/Android/gradleTemplate.properties deleted file mode 100644 index 4c48010c..00000000 --- a/Assets/Plugins/Android/gradleTemplate.properties +++ /dev/null @@ -1,8 +0,0 @@ -org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M -org.gradle.parallel=true -android.enableR8=**MINIFY_WITH_R_EIGHT** -unityStreamingAssets=**STREAMING_ASSETS** -**ADDITIONAL_PROPERTIES** - -android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file diff --git a/Assets/Plugins/Android/gradleTemplate.properties.meta b/Assets/Plugins/Android/gradleTemplate.properties.meta deleted file mode 100644 index 16d9b719..00000000 --- a/Assets/Plugins/Android/gradleTemplate.properties.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 72c92b00d50f52647b4dc155b4c66169 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/launcherTemplate.gradle b/Assets/Plugins/Android/launcherTemplate.gradle deleted file mode 100644 index bd87614c..00000000 --- a/Assets/Plugins/Android/launcherTemplate.gradle +++ /dev/null @@ -1,94 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -dependencies -{ - implementation project(':unityLibrary') - - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.5.30") - implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.30") - - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1") - implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") - implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1") - - implementation("io.ktor:ktor-client-okhttp:1.6.2") - implementation("io.ktor:ktor-client-json:1.6.2") - implementation("io.ktor:ktor-client-serialization-jvm:1.6.2") - implementation("io.ktor:ktor-client-logging-jvm:1.6.2") - - implementation("androidx.core:core-ktx:1.6.0") - - implementation("androidx.appcompat:appcompat:1.3.1") - implementation("androidx.constraintlayout:constraintlayout:2.1.0") - - implementation("androidx.activity:activity-ktx:1.3.1") - implementation("androidx.fragment:fragment-ktx:1.5.1") - - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.3.1") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") - - implementation("androidx.security:security-crypto:1.0.0") - - implementation("com.google.android.material:material:1.4.0") - - implementation("com.goterl:lazysodium-android:5.0.2@aar") - implementation("net.java.dev.jna:jna:5.9.0@aar") -} - -android -{ - compileSdkVersion **APIVERSION** - buildToolsVersion '**BUILDTOOLS**' - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - minSdkVersion **MINSDKVERSION** - targetSdkVersion **TARGETSDKVERSION** - applicationId '**APPLICATIONID**' - ndk { - abiFilters **ABIFILTERS** - } - versionCode **VERSIONCODE** - versionName '**VERSIONNAME**' - } - - aaptOptions { - noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') - ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" - }**SIGN** - - lintOptions { - abortOnError false - } - - buildTypes { - debug { - minifyEnabled **MINIFY_DEBUG** - proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** - jniDebuggable true - } - release { - minifyEnabled **MINIFY_RELEASE** - proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** - } - }**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS** -**BUILT_APK_LOCATION** - bundle { - language { - enableSplit = false - } - density { - enableSplit = false - } - abi { - enableSplit = true - } - } -}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP** diff --git a/Assets/Plugins/Android/launcherTemplate.gradle.meta b/Assets/Plugins/Android/launcherTemplate.gradle.meta deleted file mode 100644 index 923e33ac..00000000 --- a/Assets/Plugins/Android/launcherTemplate.gradle.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 71c5c7b45f3236341943b4545dd388e3 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/mainTemplate.gradle b/Assets/Plugins/Android/mainTemplate.gradle deleted file mode 100644 index 9c23caae..00000000 --- a/Assets/Plugins/Android/mainTemplate.gradle +++ /dev/null @@ -1,53 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -**APPLY_PLUGINS** - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation("androidx.appcompat:appcompat:1.4.2") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0") - implementation("androidx.core:core-ktx:1.8.0") - implementation("com.goterl:lazysodium-android:5.0.2@aar") - implementation("net.java.dev.jna:jna:4.5.1@aar") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2") - implementation("androidx.security:security-crypto:1.0.0") - implementation("androidx.browser:browser:1.4.0") - implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") - implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1") -**DEPS**} - -android { - compileSdkVersion **APIVERSION** - buildToolsVersion '**BUILDTOOLS**' - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - minSdkVersion **MINSDKVERSION** - targetSdkVersion **TARGETSDKVERSION** - ndk { - abiFilters **ABIFILTERS** - } - versionCode **VERSIONCODE** - versionName '**VERSIONNAME**' - consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD** - } - - lintOptions { - abortOnError false - } - - aaptOptions { - noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') - ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" - }**PACKAGING_OPTIONS** -}**REPOSITORIES** -**IL_CPP_BUILD_SETUP** -**SOURCE_BUILD_SETUP** -**EXTERNAL_SOURCES** diff --git a/Assets/Plugins/Android/mainTemplate.gradle.meta b/Assets/Plugins/Android/mainTemplate.gradle.meta deleted file mode 100644 index dede7317..00000000 --- a/Assets/Plugins/Android/mainTemplate.gradle.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 400a7c16becb2874c9de6b5ad81911d9 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/BeaconDotNet.meta b/Assets/Plugins/BeaconDotNet.meta deleted file mode 100644 index 9459c9a5..00000000 --- a/Assets/Plugins/BeaconDotNet.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eb73d8c48e6ce450ba9233ebd34b497c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/BeaconDotNet/Beacon.Sdk.dll b/Assets/Plugins/BeaconDotNet/Beacon.Sdk.dll deleted file mode 100644 index 98c0ef8a..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Beacon.Sdk.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.Abstractions.dll deleted file mode 100644 index 84aaf391..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.Abstractions.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.dll deleted file mode 100644 index f0962433..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Http.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Http.dll deleted file mode 100644 index 1d76b1c6..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Http.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.Abstractions.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.Abstractions.dll deleted file mode 100644 index 2c87f798..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.Abstractions.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.dll deleted file mode 100644 index 6df35e18..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Options.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Options.dll deleted file mode 100644 index cd6dc020..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Options.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Primitives.dll b/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Primitives.dll deleted file mode 100644 index e63c5a9e..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Primitives.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/Netezos.dll b/Assets/Plugins/BeaconDotNet/Netezos.dll deleted file mode 100644 index 19d1d9c7..00000000 Binary files a/Assets/Plugins/BeaconDotNet/Netezos.dll and /dev/null differ diff --git a/Assets/Plugins/BeaconDotNet/System.Diagnostics.DiagnosticSource.dll b/Assets/Plugins/BeaconDotNet/System.Diagnostics.DiagnosticSource.dll deleted file mode 100644 index cfbca537..00000000 Binary files a/Assets/Plugins/BeaconDotNet/System.Diagnostics.DiagnosticSource.dll and /dev/null differ diff --git a/Assets/Plugins/Desktop.meta b/Assets/Plugins/Desktop.meta deleted file mode 100644 index f1dc4de4..00000000 --- a/Assets/Plugins/Desktop.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 806181814a096594d9915818d67695c6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Desktop/blockchain-substrate-3.0.0-beta01.jar b/Assets/Plugins/Desktop/blockchain-substrate-3.0.0-beta01.jar deleted file mode 100644 index f15bce09..00000000 Binary files a/Assets/Plugins/Desktop/blockchain-substrate-3.0.0-beta01.jar and /dev/null differ diff --git a/Assets/Plugins/Desktop/blockchain-substrate-3.0.0-beta01.jar.meta b/Assets/Plugins/Desktop/blockchain-substrate-3.0.0-beta01.jar.meta deleted file mode 100644 index e4834ccd..00000000 --- a/Assets/Plugins/Desktop/blockchain-substrate-3.0.0-beta01.jar.meta +++ /dev/null @@ -1,68 +0,0 @@ -fileFormatVersion: 2 -guid: d8672dc47b0c6db4d9f7f500713062a4 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 1 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Desktop/blockchain-tezos-3.0.0-beta01.jar b/Assets/Plugins/Desktop/blockchain-tezos-3.0.0-beta01.jar deleted file mode 100644 index 02e800a3..00000000 Binary files a/Assets/Plugins/Desktop/blockchain-tezos-3.0.0-beta01.jar and /dev/null differ diff --git a/Assets/Plugins/Desktop/blockchain-tezos-3.0.0-beta01.jar.meta b/Assets/Plugins/Desktop/blockchain-tezos-3.0.0-beta01.jar.meta deleted file mode 100644 index 288884b3..00000000 --- a/Assets/Plugins/Desktop/blockchain-tezos-3.0.0-beta01.jar.meta +++ /dev/null @@ -1,68 +0,0 @@ -fileFormatVersion: 2 -guid: 6d825ea1c75b2e748a92882ad823e407 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 1 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Desktop/client-dapp-3.0.0-beta01.jar b/Assets/Plugins/Desktop/client-dapp-3.0.0-beta01.jar deleted file mode 100644 index 01908d3c..00000000 Binary files a/Assets/Plugins/Desktop/client-dapp-3.0.0-beta01.jar and /dev/null differ diff --git a/Assets/Plugins/Desktop/client-dapp-3.0.0-beta01.jar.meta b/Assets/Plugins/Desktop/client-dapp-3.0.0-beta01.jar.meta deleted file mode 100644 index 44a860d4..00000000 --- a/Assets/Plugins/Desktop/client-dapp-3.0.0-beta01.jar.meta +++ /dev/null @@ -1,68 +0,0 @@ -fileFormatVersion: 2 -guid: 302e58872517f8642ae652bde867c396 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 1 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Desktop/client-wallet-3.0.0-beta01.jar b/Assets/Plugins/Desktop/client-wallet-3.0.0-beta01.jar deleted file mode 100644 index 712c05a9..00000000 Binary files a/Assets/Plugins/Desktop/client-wallet-3.0.0-beta01.jar and /dev/null differ diff --git a/Assets/Plugins/Desktop/client-wallet-3.0.0-beta01.jar.meta b/Assets/Plugins/Desktop/client-wallet-3.0.0-beta01.jar.meta deleted file mode 100644 index d8e59097..00000000 --- a/Assets/Plugins/Desktop/client-wallet-3.0.0-beta01.jar.meta +++ /dev/null @@ -1,68 +0,0 @@ -fileFormatVersion: 2 -guid: 1a6c9fd0ec0c9eb43a6629ac3e10c2b3 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 1 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Desktop/core-3.0.0-beta01.jar b/Assets/Plugins/Desktop/core-3.0.0-beta01.jar deleted file mode 100644 index 09e29ddf..00000000 Binary files a/Assets/Plugins/Desktop/core-3.0.0-beta01.jar and /dev/null differ diff --git a/Assets/Plugins/Desktop/core-3.0.0-beta01.jar.meta b/Assets/Plugins/Desktop/core-3.0.0-beta01.jar.meta deleted file mode 100644 index ed7abed6..00000000 --- a/Assets/Plugins/Desktop/core-3.0.0-beta01.jar.meta +++ /dev/null @@ -1,68 +0,0 @@ -fileFormatVersion: 2 -guid: 93eba2fe45c6a1440990648c0ba84f69 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 1 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Desktop/transport-p2p-matrix-3.0.0-beta01.jar b/Assets/Plugins/Desktop/transport-p2p-matrix-3.0.0-beta01.jar deleted file mode 100644 index ed64b7fe..00000000 Binary files a/Assets/Plugins/Desktop/transport-p2p-matrix-3.0.0-beta01.jar and /dev/null differ diff --git a/Assets/Plugins/Desktop/transport-p2p-matrix-3.0.0-beta01.jar.meta b/Assets/Plugins/Desktop/transport-p2p-matrix-3.0.0-beta01.jar.meta deleted file mode 100644 index 82d8f67e..00000000 --- a/Assets/Plugins/Desktop/transport-p2p-matrix-3.0.0-beta01.jar.meta +++ /dev/null @@ -1,68 +0,0 @@ -fileFormatVersion: 2 -guid: 316ebe310b4d3a647ab7e8c2292f5760 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 1 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: {} - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Netezos.meta b/Assets/Plugins/Netezos.meta deleted file mode 100644 index cb319c63..00000000 --- a/Assets/Plugins/Netezos.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d4b6e24eebe234006b5dbdf3aefd3d88 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS.meta b/Assets/Plugins/iOS.meta deleted file mode 100644 index 1e11424c..00000000 --- a/Assets/Plugins/iOS.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b85cc76b9ff03471e92e0f7a05a0634d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Editor.meta b/Assets/Plugins/iOS/Editor.meta deleted file mode 100644 index 3473f864..00000000 --- a/Assets/Plugins/iOS/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4425eeff1defc47f1980def7dac420fb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Editor/SwiftPostProcess.cs b/Assets/Plugins/iOS/Editor/SwiftPostProcess.cs deleted file mode 100644 index 1608dbd3..00000000 --- a/Assets/Plugins/iOS/Editor/SwiftPostProcess.cs +++ /dev/null @@ -1,39 +0,0 @@ -#if UNITY_IOS -using UnityEditor; -using UnityEditor.Callbacks; -using UnityEditor.iOS.Xcode; - -// https://habibur-rahman-ovie.medium.com/unity-native-ios-plugin-bridge-between-swift-and-unity3d-d88861d0f456 -public static class SwiftPostProcess -{ - [PostProcessBuild] - public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath) - { - if (buildTarget != BuildTarget.iOS) return; - - var projPath = buildPath + "/Unity-Iphone.xcodeproj/project.pbxproj"; - var proj = new PBXProject(); - proj.ReadFromFile(projPath); - - var targetGuid = proj.TargetGuidByName(PBXProject.GetUnityTestTargetName()); - - proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); - - //proj.SetBuildProperty(targetGuid, "SWIFT_OBJC_BRIDGING_HEADER", "Libraries/Plugins/iOS/UnityIosPlugin/Source/UnityPlugin-Bridging-Header.h"); - //proj.SetBuildProperty(targetGuid, "SWIFT_OBJC_INTERFACE_HEADER_NAME", "UnityIosPlugin-Swift.h"); - - proj.AddBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", "@executable_path/Frameworks $(PROJECT_DIR)/lib/$(CONFIGURATION) $(inherited)"); - proj.AddBuildProperty(targetGuid, "FRAMERWORK_SEARCH_PATHS", - "$(inherited) $(PROJECT_DIR) $(PROJECT_DIR)/Frameworks"); - proj.AddBuildProperty(targetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES"); - proj.AddBuildProperty(targetGuid, "DYLIB_INSTALL_NAME_BASE", "@rpath"); - proj.AddBuildProperty(targetGuid, "LD_DYLIB_INSTALL_NAME", - "@executable_path/../Frameworks/$(EXECUTABLE_PATH)"); - proj.AddBuildProperty(targetGuid, "DEFINES_MODULE", "YES"); - proj.AddBuildProperty(targetGuid, "SWIFT_VERSION", "4.0"); - proj.AddBuildProperty(targetGuid, "COREML_CODEGEN_LANGUAGE", "Swift"); - - proj.WriteToFile(projPath); - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/iOS/Source.meta b/Assets/Plugins/iOS/Source.meta deleted file mode 100644 index 4cf49118..00000000 --- a/Assets/Plugins/iOS/Source.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1f75834430573472db05a6336b7f9e96 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Source/UnityPlugin.swift b/Assets/Plugins/iOS/Source/UnityPlugin.swift deleted file mode 100644 index 45d92082..00000000 --- a/Assets/Plugins/iOS/Source/UnityPlugin.swift +++ /dev/null @@ -1,451 +0,0 @@ -// -// UnityPlugin.swift -// beacon_framework -// -// Created by Victor Apihtin on 08/07/2022. -// - -import Foundation -import Base58Swift -import BeaconClientDApp - -import BeaconCore -//import BeaconBlockchainSubstrate -import BeaconBlockchainTezos -import BeaconClientDApp -import BeaconTransportP2PMatrix - -@objc public class UnityPlugin : NSObject { - @objc public static let shared = UnityPlugin() - - @Published private(set) var started: Bool = false - @Published private(set) var beaconResponse: String? = nil - @Published private(set) var pairingRequest: String? = nil - - let encoder = JSONEncoder() - - public var beaconClient: Beacon.DAppClient? = nil { - didSet { - started = beaconClient != nil - } - } - - var pairingBackgroundTaskID: UIBackgroundTaskIdentifier? - - var onNativeSendMessage:UnsafeRawPointer? - var onUnitySendMessage:UnsafeRawPointer? - - enum MessageType : Int - { - case Log - case Initialization - case Handshake - case Account - case Signature - case PublicKey - case Pairing - case Operation - } - - public func NativeSendMessage(type: Int, str:String, length: Int) - { - let c = unsafeBitCast(onNativeSendMessage, to: (@convention(c) (Int, UnsafePointer, Int) -> ()).self) - c(type, str, length); - } - - - public func UnitySendMessage(clbck:String, msg: String) - { - let c = unsafeBitCast(onUnitySendMessage, to: (@convention(c) (UnsafePointer, UnsafePointer) -> ()).self) - c(clbck, msg) - } - - @objc public func RegisterNativeSendMessage(callback: UnsafeRawPointer?) - { - onNativeSendMessage = callback; - } - - @objc public func RegisterUnitySendMessage(callback: UnsafeRawPointer?) - { - onUnitySendMessage = callback; - } - - @objc public func start() - { - guard beaconClient == nil else { - listenForResponses() - return - } - - do { - Beacon.DAppClient.create( - with: .init( - name: "iOS Beacon SDK Demo (DApp)", - blockchains: [Tezos.factory/*, Substrate.factory*/], - connections: [try Transport.P2P.Matrix.connection()] - ) - ) { result in - switch result { - case let .success(client): - print("Beacon client created") - - DispatchQueue.main.async { - self.beaconClient = client - self.listenForResponses() - } - case let .failure(error): - print("Could not create Beacon client, got error: \(error)") - } - } - } catch { - print("Could not create Beacon client, got error: \(error)") - } - } - - private func listenForResponses() { - beaconClient?.connect { result in - switch result { - case .success(_): - print("Beacon client connected") - self.beaconClient?.listen(onResponse: self.onTezosResponse) - - self.UnitySendMessage(clbck: "OnClientCreated", msg: "success") - - case let .failure(error): - print("Error while connecting for messages \(error)") - } - } - } - - @objc public func stop() - { - beaconClient?.disconnect { - print("disconnected \($0)") - - self.UnitySendMessage(clbck: "OnAccountDisconnected", msg: "disconnected") - } - } - - func clearResponse() { - DispatchQueue.main.async { - self.beaconResponse = nil - } - } - - @objc public func pair() { - - self.beaconClient?.pair(using: .p2p) { result in - switch result { - case let .success(pairingMessage): - switch pairingMessage { - case let .request(pairingRequest): - if let serializedRequest = try? self.beaconClient?.serializePairingData(.request(pairingRequest)) { - - self.pairingBackgroundTaskID = UIApplication.shared.beginBackgroundTask(withName: "Pair") { - guard let backgroundTaskID = self.pairingBackgroundTaskID, backgroundTaskID != .invalid else { - return - } - - UIApplication.shared.endBackgroundTask(backgroundTaskID) - self.pairingBackgroundTaskID = .invalid - } - - - DispatchQueue.main.async { - self.pairingRequest = serializedRequest - let txt = self.pairingRequest! - - self.UnitySendMessage(clbck: "OnHandshakeReceived", msg: txt) - //self.NativeSendMessage(type:MessageType.Handshake.rawValue, str: txt, length:txt.count) - } - - } else { - print("Failed to pair, unable to serialize a pairing request") - } - case let .response(pairingResponse): - print("pairing response:") - print(pairingResponse) - DispatchQueue.main.async { - - let data = try? self.encoder.encode(pairingResponse) - let json = String(data: data!, encoding: .utf8)! - - //self.UnitySendMessage(clbck: "OnPairingCompleted", msg: json) - self.NativeSendMessage(type: MessageType.Pairing.rawValue, str: json, length: json.count) - } - } - case let .failure(error): - print("Failed to pair, got error: \(error)") - } - } - } - - @objc public func unpair() - { - beaconClient?.removeAllPeers { result in - switch result { - case .success(_): - print("Successfully removed peers") - self.UnitySendMessage(clbck: "OnAccountDisconnected", msg: "disconnected") - case let .failure(error): - print("Failed to remove peers, got error: \(error)") - } - } - } - - /* should be performed AFTER a successful pairing */ - @objc public func requestPermission( - networkName:UnsafePointer, - networkRPC:UnsafePointer - ) { - let networkNameString = String(cString: UnsafePointer(networkName)) - let rpcString = String(cString: UnsafePointer(networkRPC)) - - let network = Tezos.Network.init(type:.custom, name:networkNameString, rpcURL:rpcString) - - /* should be performed AFTER a successful pairing */ - beaconClient?.requestTezosPermission(on: network) { result in - - switch result { - case .success(_): - - if let backgroundTaskID = self.pairingBackgroundTaskID, backgroundTaskID != .invalid { - UIApplication.shared.endBackgroundTask(backgroundTaskID) - self.pairingBackgroundTaskID = nil - } - - print("Sent the request") - case let .failure(error): - print("Failed to send the request, got error: \(error)") - } - } - } - - @objc public func RequestTezosOperation( - destination:UnsafePointer, - entryPoint:UnsafePointer, - arg:UnsafePointer, - amount:UnsafePointer - , networkName:UnsafePointer - , networkRPC:UnsafePointer - ) { - - let destinationString = String(cString: UnsafePointer(destination)) - let amountString = String(cString: UnsafePointer(amount)) - let entryPointString = String(cString: UnsafePointer(entryPoint)) - let argString = String(cString: UnsafePointer(arg)) - - let netNameString = String(cString: UnsafePointer(networkName)) - let netRPCString = String(cString: UnsafePointer(networkRPC)) - - var contractParameter : Tezos.Operation.Parameters? = nil; - - let entry : Tezos.Operation.Parameters.Entrypoint = .custom(entryPointString) - - let decoder = JSONDecoder() - do { - let expression = try decoder.decode(Micheline.MichelsonV1Expression.self, from: Data(argString.utf8)) - contractParameter = .init(entrypoint: entry , value: expression) - } - catch - { - print(error) - } - - let network = Tezos.Network.init(type:.custom, name:netNameString, rpcURL:netRPCString) - - beaconClient?.requestTezosOperation(operationDetails: [ - .transaction(.init( - amount: amountString, - destination: destinationString, - parameters: contractParameter - )) - ], on: network - ) { result in - switch result { - case let .success(message): - print(message) - case let .failure(error): - print(error) - } - } - } - - @objc public func RequestTezosSignPayload( - signingType:Int, - payload:UnsafePointer - ) { - let data = String(cString: UnsafePointer(payload)) - - var type = Tezos.SigningType.raw; - - switch signingType { - case 1: - type = Tezos.SigningType.operation; - case 2: - type = Tezos.SigningType.micheline; - default: - type = Tezos.SigningType.raw; - } - - print("Request sign payload with type " + type.rawValue) - beaconClient?.requestTezosSignPayload(signingType:type, payload:data) { result in - switch result { - case let .success(message): - print(message) - - case let .failure(error): - print(error) - } - } - } - - @objc public func RequestTezosBroadcast( - signedTransaction:UnsafePointer, - networkName:UnsafePointer, - networkRPC:UnsafePointer - ) { - let transaction = String(cString: UnsafePointer(signedTransaction)) - let network = String(cString: UnsafePointer(networkName)) - let rpc = String(cString: UnsafePointer(networkRPC)) - - beaconClient?.requestTezosBroadcast(signedTransaction:transaction) { result in - switch result { - case let .success(message): - print(message) - case let .failure(error): - print(error) - } - } - } - - @objc public func GetActiveAccount() - { - beaconClient?.getActiveAccount { accountResult in - do { - - if let value = try accountResult.get() - { - DispatchQueue.main.async { - - let data = try? self.encoder.encode(value) - let json = String(data: data!, encoding: .utf8)! - - print(json) - self.UnitySendMessage(clbck: "OnAccountReceived", msg: json) - //self.NativeSendMessage(type: MessageType.Account.rawValue, str: json, length: json.count) - } - - } - else - { - - } - - } catch { - print("Error retrieving the value: \(error)") - } - } - } - - private func onTezosResponse(_ responseResult: Result, Beacon.Error>) { - - switch responseResult { - case let .success(request): - - switch request { - - case let .blockchain(chain): - - switch chain { - - case let .signPayload(payload): - print(payload) - DispatchQueue.main.async { - - let data = try? self.encoder.encode(payload) - let json = String(data: data!, encoding: .utf8)! - - self.UnitySendMessage(clbck: "OnPayloadSigned", msg: json) - } - case let .broadcast(broadcast): - print(broadcast) - - case let .operation(operation): - DispatchQueue.main.async { - let data = try? self.encoder.encode(operation) - let json = String(data: data!, encoding: .utf8)! - - self.UnitySendMessage(clbck: "OnContractCallCompleted", msg: json) - } - print(operation) - } - - case let .acknowledge(acknowledge): - print("acknowledge:") - print(acknowledge) - - case let .permission(permission): - DispatchQueue.main.async { - //let key = permission.account.publicKey; - - - let data = try? self.encoder.encode(permission) - let json = String(data: data!, encoding: .utf8)! - - print("permission:") - print(permission) - - self.UnitySendMessage(clbck: "OnAccountConnected", msg: json) - //self.NativeSendMessage(type: MessageType.PublicKey.rawValue, str: json, length: json.count); - } - case let .error(error): - print(error) - } - /* - let requestData = try? encoder.encode(request) - - DispatchQueue.main.async { - self.beaconResponse = requestData.flatMap { String(data: $0, encoding: .utf8) } - let response = self.beaconResponse! - } - */ - - case let .failure(error): - print("Error while processing incoming messages: \(error)") - //completion(.failure(error)) - } - } -} - -extension BeaconResponse: Encodable { - - public func encode(to encoder: Encoder) throws { - if let tezosResponse = self as? BeaconResponse { - switch tezosResponse { - case let .permission(content): - try content.encode(to: encoder) - case let .blockchain(blockchain): - switch blockchain { - case let .operation(content): - try content.encode(to: encoder) - case let .signPayload(content): - try content.encode(to: encoder) - case let .broadcast(content): - try content.encode(to: encoder) - } - case let .acknowledge(content): - try content.encode(to: encoder) - case let .error(content): - try content.encode(to: encoder) - } - } - else { - throw Error.unsupportedBlockchain - } - } - - enum Error: Swift.Error { - case unsupportedBlockchain - } -} diff --git a/Assets/Plugins/iOS/Source/UnityPlugin.swift.meta b/Assets/Plugins/iOS/Source/UnityPlugin.swift.meta deleted file mode 100644 index 2d1614eb..00000000 --- a/Assets/Plugins/iOS/Source/UnityPlugin.swift.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 9180b6d3ef38f44399f407ccac0f837c -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/iOS/Source/UnityPluginBridge.mm b/Assets/Plugins/iOS/Source/UnityPluginBridge.mm deleted file mode 100644 index e667f99d..00000000 --- a/Assets/Plugins/iOS/Source/UnityPluginBridge.mm +++ /dev/null @@ -1,92 +0,0 @@ -// -// UnityPluginBridge.m -// beacon_framework -// -// Created by Victor Apihtin on 08/07/2022. -// - -#import -#include "UnityFramework/UnityFramework-Swift.h" - - -extern "C" { - typedef void (*ReceiveCallback)(int type, const char* msg, int length); -} - -ReceiveCallback receiveMessageCallback; - -static void NativeSendMessageToUnity(int type, const char* msg, int length) -{ - if (receiveMessageCallback != NULL) { - receiveMessageCallback(type, msg, length); - } -} - -static void UnitySendMessageToUnity(const char* func, const char* msg) -{ - UnitySendMessage("UnityBeacon", func, msg); -} - -extern "C" { - - void _RegisterReceiveMessageCallback(ReceiveCallback callback) { - receiveMessageCallback = callback; - - const void *n =(const void*)&NativeSendMessageToUnity; - [[UnityPlugin shared] RegisterNativeSendMessageWithCallback:(n)]; - - const void *u =(const void*)&UnitySendMessageToUnity; - [[UnityPlugin shared] RegisterUnitySendMessageWithCallback:(u)]; - } - - void _IOSConnectAccount() { - [[UnityPlugin shared] start]; - } - - void _IOSDisconnectAccount() { - [[UnityPlugin shared] unpair]; - //[[UnityPlugin shared] stop]; - } - - void _IOSPair() { - [[UnityPlugin shared] pair]; - } - - void _IOSRequestTezosOperation( - char* destination, - char* entryPoint, - char* arg, - char* amount, - char* networkName, - char* networkRPC - ) { - [[UnityPlugin shared] RequestTezosOperationWithDestination:destination entryPoint:entryPoint arg:arg amount:amount networkName:networkName networkRPC:networkRPC]; - } - - void _IOSRequestTezosPermission( - char* networkName, - char* networkRPC - ) { - [[UnityPlugin shared] requestPermissionWithNetworkName:networkName networkRPC:networkRPC]; - } - - void _IOSRequestTezosSignPayload( - int signingType, - char* payload - ) { - [[UnityPlugin shared] RequestTezosSignPayloadWithSigningType:signingType payload:payload]; - } - - void _IOSRequestTezosBroadcast( - char* signedTransaction, - char* networkName, - char* networkRPC - ) { - [[UnityPlugin shared] RequestTezosBroadcastWithSignedTransaction:signedTransaction networkName:networkName networkRPC:networkRPC]; - } - - void _IOSGetActiveAccount() - { - [[UnityPlugin shared] GetActiveAccount]; - } -} diff --git a/Assets/Plugins/iOS/Source/UnityPluginBridge.mm.meta b/Assets/Plugins/iOS/Source/UnityPluginBridge.mm.meta deleted file mode 100644 index 9b99a7b5..00000000 --- a/Assets/Plugins/iOS/Source/UnityPluginBridge.mm.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 835bf10ee614d427a95ed62fe4c2e0ba -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta deleted file mode 100644 index 1835d37a..00000000 --- a/Assets/Scripts.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -<<<<<<<< HEAD:UnityTezosAirgap/Assets/WebGLCopyAndPaste/Scripts.meta -guid: 6eca3ac97179445708c8bbb1ea490689 -======== -guid: d2c6bd9d1e01c46ba8b50e1bb4d40b77 ->>>>>>>> netezos_for_michelson:UnityTezosAirgap/Assets/Scripts.meta -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs b/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs deleted file mode 100644 index 9f787b36..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs +++ /dev/null @@ -1,65 +0,0 @@ -#if UNITY_ANDROID -using UnityEngine; - -namespace BeaconSDK -{ - /// - /// Android implementation of the BeaconConnector. - /// Binds the functions implemented inside the file BeaconConnection.jslib - /// - public class BeaconConnectorAndroid : IBeaconConnector - { - private AndroidJavaObject _beaconWalletViewModel = new AndroidJavaObject("it.airgap.beaconsdk.dapp.WalletViewModel"); - private AndroidJavaObject _beaconDAppViewModel = new AndroidJavaObject("it.airgap.beaconsdk.dapp.DAppViewModel"); - - public void SetNetwork(string network, string rpc) - { - } - - public string GetActiveAccountAddress() - { - return _beaconDAppViewModel.Call("getActiveAccountAddress"); - } - - public void ConnectAccount() - { - _beaconDAppViewModel.Call("startBeacon"); - } - - public void DisconectAccount() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void RequestTezosPermission(string networkName = "", string networkRPC = "") - { - _beaconDAppViewModel.Call("requestTezosPermission", networkName, networkRPC); - } - - public void RequestTezosOperation(string destination, string entryPoint = "default", string arg = null, ulong amount = 0, string networkName = "", string networkRPC = "") - { - _beaconDAppViewModel.Call("requestTezosOperation", destination, $"{amount}", entryPoint, arg, networkName, networkRPC); - } - - public void RequestTezosSignPayload(int signingType, string payload) - { - _beaconDAppViewModel.Call("requestTezosSignPayload", signingType, payload); - } - - public void RequestTezosBroadcast(string signedTransaction, string networkName = "", string networkRPC = "") - { - _beaconDAppViewModel.Call("requestTezosBroadcast", signedTransaction, networkName, networkRPC); - } - - public void DisconnectAccount() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void RequestHandshake() - { - _beaconDAppViewModel.Call("requestHandshake"); - } - } -} -#endif diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.bak b/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.bak deleted file mode 100644 index 628be516..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.bak +++ /dev/null @@ -1,162 +0,0 @@ -#if UNITY_ANDROID -using UnityEngine; - -namespace BeaconSDK -{ - /// - /// Android implementation of the BeaconConnector. - /// Binds the functions implemented inside the file BeaconConnection.jslib - /// - public class BeaconConnectorAndroid : IBeaconConnector - { - private AndroidJavaObject _beaconWalletViewModel = new AndroidJavaObject("it.airgap.beaconsdk.dapp.WalletViewModel"); - private AndroidJavaObject _beaconDAppViewModel = new AndroidJavaObject("it.airgap.beaconsdk.dapp.DAppViewModel"); - - public static string NativeMessage = string.Empty; - - private QRCodeView _qrCodeView; - - private AndroidPluginCallback _androidCallbacks = new AndroidPluginCallback(); - - private BeaconMessageReceiver _messageReceiver; - - public void SetNetwork(string network, string rpc) - { - throw new System.NotImplementedException(); - - //network = "jakartanet"; - //rpc = "https://rpc.tzkt.io/jakartanet"; - //SetNetwork(network, rpc); - } - - public string GetActiveAccount() - { - string account = _beaconDAppViewModel.Call("checkForActiveAccount"); - - return account; - } - - public string GetActiveAccountAddress() - { - string address = _beaconDAppViewModel.Call("getActiveAccountAddress"); - - return address; - } - - public void SetQRCodeView(QRCodeView qRCodeView) - { - _qrCodeView = qRCodeView; - } - - private void SetListeners(bool addListenner) - { - if (addListenner) - { - _androidCallbacks.QRPair.AddListener(CallbackToQR); - } - else - { - _androidCallbacks.QRPair.RemoveListener(CallbackToQR); - } - } - public void SetBeaconMessageReceiver(BeaconMessageReceiver messageReceiver) - { - _messageReceiver = messageReceiver; - } - - public void ConnectAccount() - { - SetListeners(true); - - _beaconDAppViewModel.Call("startBeacon"); - } - - public void DisconectAccount() - { - SetListeners(false); - - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void PauseBeacon() - { - SetListeners(false); - - _beaconDAppViewModel.Call("pauseBeacon"); - } - - public void ResumeBeacon() - { - SetListeners(true); - - _beaconDAppViewModel.Call("resumeBeacon"); - } - - public void Pair() - { -<<<<<<< HEAD - _beaconDAppViewModel.Call("qrPair", _androidCallbacks); -======= - // _qrCodeView.SetQrCode(_beaconDAppViewModel.Call("pair")); - var handshake = _beaconDAppViewModel.Call("pair"); - _messageReceiver.OnHandshakeReceived(handshake); ->>>>>>> tarek-dev - } - - public void Unpair() - { - _beaconDAppViewModel.Call("reset"); - } - - public void RequestTezosPermission(string networkName = "", string networkRPC = "") - { - Debug.Log(_beaconDAppViewModel.Call("requestTezosPermission", networkName, networkRPC)); - } - - public void RequestTezosOperation(string destination, string entryPoint = "default", string arg = null, ulong amount = 0, string networkName = "", string networkRPC = "") - { - Debug.Log(_beaconDAppViewModel.Call("requestTezosOperation", destination, $"{amount}", entryPoint, arg, networkName, networkRPC)); - } - - public void RequestTezosSignPayload(int signingType, string payload) - { - _beaconDAppViewModel.Call("requestTezosSignPayload", signingType, payload); - } - - public void RequestTezosBroadcast(string signedTransaction, string networkName = "", string networkRPC = "") - { - Debug.Log(_beaconDAppViewModel.Call("requestTezosBroadcast", signedTransaction, networkName, networkRPC)); - } - - public void DisconnectAccount() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void SwitchAccounts() - { - throw new System.NotImplementedException(); - } - - public void Reset() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void TestString(string str) - { - throw new System.NotImplementedException(); - } - - public void Deeplink() - { - Application.OpenURL($"tezos://?type=tzip10&data={_beaconDAppViewModel.Call("dlPair")}"); - } - - private void CallbackToQR() - { - _qrCodeView.SetQrCode(_androidCallbacks.PairResult); - } - } -} -#endif diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.bak.meta b/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.bak.meta deleted file mode 100644 index 445edcbc..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.bak.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: e2b6edffe84b6cf4a9a9bd799cb0898c -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.meta b/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.meta deleted file mode 100644 index f30d4768..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorAndroid.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -<<<<<<<< HEAD:UnityTezosAirgap/Assets/Scripts/BeaconConnectorAndroid.cs.meta -guid: 9b8e8b1bb3effe5488c53af694412ca1 -======== -guid: e257a0251d68743a6a1407d9ee4867ae ->>>>>>>> netezos_for_michelson:UnityTezosAirgap/Assets/Scripts/Helpers/CoroutineWrapper.cs.meta -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorDesktop.cs b/Assets/Scripts/BeaconSDK/BeaconConnectorDesktop.cs deleted file mode 100644 index b7e408c7..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorDesktop.cs +++ /dev/null @@ -1,155 +0,0 @@ -#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN -using UnityEngine; - -namespace BeaconSDK -{ - /// - /// Android implementation of the BeaconConnector. - /// Binds the functions implemented inside the file BeaconConnection.jslib - /// - public class BeaconConnectorDesktop : IBeaconConnector - { - private AndroidJavaObject _beaconWalletViewModel = new AndroidJavaObject("it.airgap.beaconsdk.dapp.WalletViewModel"); - private AndroidJavaObject _beaconDAppViewModel = new AndroidJavaObject("it.airgap.beaconsdk.dapp.DAppViewModel"); - - public static string NativeMessage = string.Empty; - - private QRCodeView _qrCodeView; - private BeaconMessageReceiver _messageReceiver; - - public void SetNetwork(string network, string rpc) - { - throw new System.NotImplementedException(); - - //network = "jakartanet"; - //rpc = "https://rpc.tzkt.io/jakartanet"; - //SetNetwork(network, rpc); - } - - public string GetActiveAccount() - { - string account = _beaconDAppViewModel.Call("checkForActiveAccount"); - Debug.LogError($"Account spits out -=-{account}-=-"); - - return account; - } - - public string GetActiveAccountAddress() - { - string address = _beaconDAppViewModel.Call("getActiveAccountAddress"); - Debug.LogError($"Address spits out -=-{address}-=-"); - - return address; - } - - public void SetQRCodeView(QRCodeView qRCodeView) - { - _qrCodeView = qRCodeView; - } - - public void SetBeaconMessageReceiver(BeaconMessageReceiver messageReceiver) - { - _messageReceiver = messageReceiver; - } - - public void ConnectAccount() - { - _beaconDAppViewModel.Call("startBeacon"); - } - - public void DisconectAccount() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void PauseBeacon() - { - _beaconDAppViewModel.Call("pauseBeacon"); - } - - public void ResumeBeacon() - { - _beaconDAppViewModel.Call("resumeBeacon"); - } - - public void QRCode(string handshake) - { - _qrCodeView.SetQrCode(_beaconDAppViewModel.Call("pair")); - } - - public void Unpair() - { - _beaconDAppViewModel.Call("reset"); - } - - public void SendRequestPermissions() - { - Debug.Log(_beaconDAppViewModel.Call("requestPermission")); - } - - public void SendResponse() - { - //Now done somewhere else - throw new System.NotImplementedException(); - } - - public void CallContract(string destination, string entryPoint, string arg, long amount = 0) - { - entryPoint = "main"; - amount = 0; - //destination = "KT1E4xgc9iniojkZqs1BDs117bzaYfMHZcPs"; // my structs contract - //arg = "(PAIR \"str\" 2)"; - destination = "KT1DCcniV9tatQFVLnPv15i4kGYNgpdE6GhS"; // my counter contract - arg = "8"; - throw new System.NotImplementedException(); - //AndSendContractCall(destination, amount.ToString(), entryPoint, arg); - } - - public void DisconnectAccount() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void SendMutez(long amount, string address) - { - _beaconDAppViewModel.Call("requestOperation", address, $"{amount}", "default", null); - } - - public void SwitchAccounts() - { - throw new System.NotImplementedException(); - } - - public void Reset() - { - _beaconDAppViewModel.Call("stopBeacon"); - } - - public void RequestTezosPermission(string networkName = "", string networkRPC = "") - { - throw new System.NotImplementedException(); - } - - public void RequestTezosOperation(string destination, string entryPoint = "default", string arg = null, - ulong amount = 0, string networkName = "", string networkRPC = "") - { - throw new System.NotImplementedException(); - } - - public void RequestTezosSignPayload(int signingType, string payload) - { - throw new System.NotImplementedException(); - } - - public void RequestTezosBroadcast(string signedTransaction, string networkName = "", string networkRPC = "") - { - throw new System.NotImplementedException(); - } - - public void RequestHandshake() - { - throw new System.NotImplementedException(); - } - } -} -#endif diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorDesktop.cs.meta b/Assets/Scripts/BeaconSDK/BeaconConnectorDesktop.cs.meta deleted file mode 100644 index 00696ce2..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorDesktop.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -<<<<<<<< HEAD:UnityTezosAirgap/Assets/Scripts/BeaconConnectorAndroid.cs.meta -guid: 6adb551b90204eb46be3efd030f215c9 -======== -guid: e257a0251d68743a6a1407d9ee4867ae ->>>>>>>> netezos_for_michelson:UnityTezosAirgap/Assets/Scripts/Helpers/CoroutineWrapper.cs.meta -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorIOS.cs b/Assets/Scripts/BeaconSDK/BeaconConnectorIOS.cs deleted file mode 100644 index 8c7cfbd9..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorIOS.cs +++ /dev/null @@ -1,208 +0,0 @@ -#if UNITY_IOS -using System; -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; -using System.Text.Json; - -namespace BeaconSDK -{ - public class BeaconConnectorIOS : IBeaconConnector - { - #region ObjC Beacon interface - - [DllImport("__Internal")] - private static extern void _IOSConnectAccount(); - - [DllImport("__Internal")] - private static extern void _IOSPair(); - - [DllImport("__Internal")] - private static extern void _IOSDisconnectAccount(); - - [DllImport("__Internal")] - private static extern void _IOSGetActiveAccount(); - - [DllImport("__Internal")] - private static extern void _IOSRequestTezosPermission( - string networkName, - string networkRPC - ); - - [DllImport("__Internal")] - private static extern void _IOSRequestTezosOperation( - string destination, - string entryPoint, - string arg, - string amount, - string networkName, - string networkRPC - ); - - [DllImport("__Internal")] - private static extern void _IOSRequestTezosSignPayload( - int signingType, - string payload - ); - - [DllImport("__Internal")] - private static extern void _IOSRequestTezosBroadcast( - string signedTransaction, - string networkName, - string networkRPC - ); - - #endregion - - #region ObjC to C# callback - - - private unsafe delegate void ReceiveMessageDelegate(int type, char* encodedMessage, int length); - - [DllImport("__Internal")] - private static extern void _RegisterReceiveMessageCallback(ReceiveMessageDelegate callback); - - #endregion - - public enum NativeMessageType - { - Log = 1, - Handshake, - Account, - Signature, - PublicKey, - Pairing, - Operation - } - - private static string _activeAccount; - - private static BeaconMessageReceiver _messageReceiver; - - #region IBeaconConnector - - public void ConnectAccount() - { - if (_activeAccount != null) - return; - - unsafe - { - _RegisterReceiveMessageCallback(ReceiveMessage); - } - - _messageReceiver.AccountReceived += OnAccountReceived; - _messageReceiver.AccountConnected += OnPermissionsReceived; - - _IOSConnectAccount(); - // _IOSGetActiveAccount(); - } - - private void OnAccountReceived(string account) - { - var json = JsonSerializer.Deserialize(account); - _activeAccount = json.GetProperty("address").GetString(); - Debug.Log("my address: " + _activeAccount); - } - - private void OnPermissionsReceived(string account) - { - var json = JsonSerializer.Deserialize(account); - if (json.TryGetProperty("account", out json)) - { - _activeAccount = json.GetProperty("address").GetString(); - } - } - - public string GetActiveAccountAddress() - { - // TODO: make _IOSGetActiveAccount to synchronously return a string - _IOSGetActiveAccount(); // async - return _activeAccount; - } - - public void DisconnectAccount() - { - _messageReceiver.AccountReceived -= OnAccountReceived; - _messageReceiver.AccountConnected -= OnPermissionsReceived; - - _activeAccount = null; - _IOSDisconnectAccount(); - } - - public void SetNetwork(string network, string rpc) {} - public void SwitchAccounts() {} - - public void SetBeaconMessageReceiver(BeaconMessageReceiver messageReceiver) - { - _messageReceiver = messageReceiver; - } - - public void RequestHandshake() => _IOSPair(); - - #endregion - - // has to be static in order to pass callback to native - [AOT.MonoPInvokeCallback(typeof(ReceiveMessageDelegate))] - static unsafe void ReceiveMessage(int type, char* str, int length) - { - // alternatively to sending length, one could Trim the new string from 0 to '\0' symbol - var msg = Encoding.UTF8.GetString((byte*)str, length); - - switch ((NativeMessageType)type) - { - case NativeMessageType.Log: - Debug.Log("-- Log -- " + msg); - break; - case NativeMessageType.Handshake: - Debug.Log("-- Handshake -- " + msg); - _messageReceiver.OnHandshakeReceived(msg); - break; - case NativeMessageType.Account: - Debug.Log("-- Account -- " + msg); - // _activeAccount = msg; - break; - case NativeMessageType.Signature: - Debug.Log("-- Signature -- " + msg + " of length:" + length); - _messageReceiver.OnPayloadSigned(msg); - break; - case NativeMessageType.PublicKey: - Debug.Log("-- Public key -- " + msg); - _messageReceiver.OnAccountConnected(msg); - break; - case NativeMessageType.Pairing: - Debug.Log("-- Pairing complete -- " + msg); - _messageReceiver.OnPairingCompleted(msg); - break; - case NativeMessageType.Operation: - Debug.Log("-- Operation complete -- " + msg); - _messageReceiver.OnContractCallCompleted(msg); - break; - } - } - - public void RequestTezosPermission(string networkName = "", string networkRPC = "") - { - _IOSRequestTezosPermission(networkName, networkRPC); - } - - public void RequestTezosOperation(string destination, string entryPoint = "default", string arg = null, - ulong amount = 0, string networkName = "", string networkRPC = "") - { - _IOSRequestTezosOperation(destination, entryPoint, arg, amount.ToString(), networkName, networkRPC); - } - - public void RequestTezosSignPayload(int signingType, string payload) - { - _IOSRequestTezosSignPayload(signingType, payload); - } - - public void RequestTezosBroadcast(string signedTransaction, string networkName = "", string networkRPC = "") - { - _IOSRequestTezosBroadcast(signedTransaction, networkName, networkRPC); - } - } -} -#endif diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorIOS.cs.meta b/Assets/Scripts/BeaconSDK/BeaconConnectorIOS.cs.meta deleted file mode 100644 index bfa76dff..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorIOS.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4d98ab0c326b9434bb4cc4075386bfe6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/BeaconSDK/BeaconMessageReceiver.cs b/Assets/Scripts/BeaconSDK/BeaconMessageReceiver.cs deleted file mode 100644 index e540aaa4..00000000 --- a/Assets/Scripts/BeaconSDK/BeaconMessageReceiver.cs +++ /dev/null @@ -1,132 +0,0 @@ -using UnityEngine; -using System; -using System.Collections; -using System.Text.Json; -using UnityEngine.Networking; - -/// -/// Receives external messages -/// - -public class BeaconMessageReceiver : MonoBehaviour -{ - public event Action ClientCreated; - public event Action AccountConnected; - public event Action AccountConnectionFailed; - public event Action AccountDisconnected; - public event Action ContractCallCompleted; - public event Action ContractCallInjected; - public event Action ContractCallFailed; - public event Action PayloadSigned; - public event Action HandshakeReceived; - public event Action PairingCompleted; - public event Action AccountReceived; - - public void OnClientCreated(string result) - { - Debug.LogWarning("From unity, OnClientCreated: " + result); - ClientCreated?.Invoke(result); - } - - public void OnAccountConnected(string result) - { - // result is the json permission response - Debug.Log("From unity, OnAccountConnected: " + result); - AccountConnected?.Invoke(result); - } - - public void OnAccountFailedToConnect(string result) - { - // result is the json error - Debug.Log("From unity, OnAccountFailedToConnect: " + result); - AccountConnectionFailed?.Invoke(result); - } - - public void OnAccountDisconnected(string result) - { - Debug.Log("From unity, OnAccountDisconnect: " + result); - AccountDisconnected?.Invoke(result); - } - - public void OnContractCallCompleted(string result) - { - // result is the json of transaction response - Debug.Log("From unity, OnContractCallCompleted: " + result); - ContractCallCompleted?.Invoke(result); - } - - [Serializable] - struct ContractCallInjectionResult - { - public bool success; - public string transactionHash; - } - - public IEnumerator ContractCallInjection(string uri, string transactionHash) - { - var success = false; - var timeout = 30f; // seconds - var timestamp = Time.time; - - // keep making requests until time out or success - while (!success && Time.time - timestamp < timeout) - { - uri = string.Format(uri, transactionHash); - Debug.Log("WebRequest into " + uri); - using UnityWebRequest webRequest = UnityWebRequest.Get(uri); - yield return webRequest.SendWebRequest(); - - var resultText = webRequest.downloadHandler.text; - - if (!string.IsNullOrEmpty(webRequest.error)) - { - Debug.LogError(webRequest.error); - break; - } - - if (!string.IsNullOrEmpty(resultText)) - { - success = JsonSerializer.Deserialize(resultText); - } - } - - ContractCallInjectionResult result; - result.success = success; - result.transactionHash = transactionHash; - Debug.Log("Operation injected into blockchain: " + success); - ContractCallInjected?.Invoke(JsonUtility.ToJson(result)); - } - - public void OnContractCallFailed(string result) - { - // result is error or empty - Debug.Log("From unity, OnContractCallFailed: " + result); - ContractCallFailed?.Invoke(result); - } - - public void OnPayloadSigned(string signature) - { - // result is the json string of payload signing result - Debug.Log("From unity, OnPayloadSigned: " + signature); - PayloadSigned?.Invoke(signature); - } - - public void OnHandshakeReceived(string handshake) - { - // result is serialized p2p pairing request - Debug.Log("From unity, OnHandshakeReceived: " + handshake); - HandshakeReceived?.Invoke(handshake); - } - - public void OnPairingCompleted(string message) - { - Debug.Log("From unity, OnPairingCompleted: " + message); - PairingCompleted?.Invoke(message); - } - - public void OnAccountReceived(string message) - { - Debug.Log("From unity, OnAccountReceived: " + message); - AccountReceived?.Invoke(message); - } -} diff --git a/Assets/Scripts/DemoExample/UIManager.cs.orig b/Assets/Scripts/DemoExample/UIManager.cs.orig deleted file mode 100644 index 268e2dbe..00000000 --- a/Assets/Scripts/DemoExample/UIManager.cs.orig +++ /dev/null @@ -1,192 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class UIManager : MonoBehaviour -{ - [Header("References:")] - [SerializeField] private GameObject loginPanel; - [SerializeField] private GameObject welcomePanel; - [SerializeField] private TMPro.TextMeshProUGUI welcomeText; - [SerializeField] private TabButton inventoryButton; - [SerializeField] private TabButton marketButton; - [SerializeField] private InventoryManager inventory; - [SerializeField] private MarketManager market; - [SerializeField] private GameObject loadingPanel; - [SerializeField] private TMPro.TextMeshProUGUI accountText; - [SerializeField] private TMPro.TextMeshProUGUI balanceText; - [SerializeField] private TMPro.TextMeshProUGUI softBalanceText; - [Header("Settings:")] - [SerializeField, Range(0.1f,10)] private float _walletUpdateTime = 3; - - private DateTime _lastCheck; - - private void Start() - { - AllowUIAccess(false); - inventoryButton.OnTabSelected.AddListener(AccessInventory); - marketButton.OnTabSelected.AddListener(AccessMarket); - - inventory.onInventoryRefresh.AddListener(AccessInventory); - inventory.onItemMint.AddListener(MintItem); - - _lastCheck = DateTime.Now; - - // Is this neccessary? "GetBeaconConnector()" accessor lazyly Inits beacon - //DatabaseFactory.Instance.GetDatabase().Init(); - } - - private void Update() - { - if (DatabaseFactory.Instance.GetDatabase().GetCurrentUser() == null || - (DateTime.Now - _lastCheck).TotalSeconds < _walletUpdateTime || - Input.GetMouseButtonDown(0)|| - Input.touchCount > 0) - { - return; - } - - //Every X number of seconds(ignoring while the player is currently dragging), update the displayed info and inventory - InventoryWalletCheck(); - _lastCheck = DateTime.Now; - } - - private void AccessInventory() - { - loadingPanel.SetActive(true); - InventoryWalletCheck(); - } - - private void AccessMarket() - { - loadingPanel.SetActive(true); - InventoryWalletCheck(); - } - - /// - /// Updates the information being displayed for the paired wallet and inventory - /// - private void InventoryWalletCheck() - { - if (inventory.gameObject.activeSelf) - { - DatabaseFactory.Instance.GetDatabase().FetchInventoryItems(PopulateInventory); - } - if (market.gameObject.activeSelf) - { - DatabaseFactory.Instance.GetDatabase().FetchMarketItems(PopulateMarket); - } - - // refresh wallet data - DisplayWalletData(); - } - -<<<<<<< HEAD - void SetBalanceText(float balance) - { - // balance is in mutez (one millionth of tezos) - var floatBalance = (float)balance * 0.000001; - Debug.Log("Balance: " + floatBalance + " || " + balance); - balanceText.text = (floatBalance).ToString(); - } - - void SetSoftBalanceText(int balance) - { - // balance is in mutez (one millionth of tezos) - softBalanceText.text = balance.ToString(); - } -======= - private void MintItem() - { - var id = UnityEngine.Random.Range(0, 100000); - DatabaseFactory.Instance.GetDatabase().MintItem(id, null); - } ->>>>>>> airgap - - public void GetCoins() - { - DatabaseFactory.Instance.GetDatabase().Login(); - } - - public void OnSignIn(bool success) - { - AllowUIAccess(success); - //TODO: GetActiveAccount() in the BeaconConnector SHOULD be returning stuff from the paired account. - //Something in there might be usable to populate the User info I removed if we still want this. - welcomeText.text = success? "Welcome!" : "Pairing failed or timed out"; - DisplayWalletData(); - } - - public void AllowUIAccess(bool allow) - { - loginPanel.SetActive(!allow); - welcomePanel.SetActive(allow); - inventoryButton.gameObject.SetActive(allow); - marketButton.gameObject.SetActive(allow); - } - - private void PopulateInventory(List items) - { - Action action = () => - { - inventory.Init(items); - loadingPanel.SetActive(false); - }; - StartCoroutine(DoActionNextFrame(action)); - } - - private void PopulateMarket(List items) - { - Action action = () => - { - market.Init(items); - loadingPanel.SetActive(false); - }; - StartCoroutine(DoActionNextFrame(action)); - } - - IEnumerator DoActionNextFrame(Action action) - { - yield return new WaitForEndOfFrame(); - action?.Invoke(); - } - - /// - /// Resets the data in the UI to default values. For use in logout - /// - public void ResetWalletData() - { - SetAccountText("0"); - SetBalanceText(0); - SetSoftBalanceText(0); - } - - private void DisplayWalletData() - { - IDatabase db = DatabaseFactory.Instance.GetDatabase(); - string accountNum = db.GetCurrentUser().Address; - SetAccountText(accountNum); - db.GetBalance(SetBalanceText); - db.GetSoftBalance(SetSoftBalanceText); - } - - void SetBalanceText(int balance) - { - // balance is in mutez (one millionth of tezos) - var floatBalance = (float)balance * 0.000001; - balanceText.text = (floatBalance) .ToString(); - } - - void SetSoftBalanceText(int balance) - { - // balance is in mutez (one millionth of tezos) - softBalanceText.text = balance.ToString(); - } - - void SetAccountText(string account) - { - accountText.text = account; - } -} diff --git a/Assets/Scripts/DemoExample/UIManager.cs.orig.meta b/Assets/Scripts/DemoExample/UIManager.cs.orig.meta deleted file mode 100644 index 1a191f4b..00000000 --- a/Assets/Scripts/DemoExample/UIManager.cs.orig.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 5a114e1288213644ab5b105e30fa9384 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Helpers/CoroutineWrapper.cs b/Assets/Scripts/Helpers/CoroutineWrapper.cs deleted file mode 100644 index b30a4773..00000000 --- a/Assets/Scripts/Helpers/CoroutineWrapper.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections; -using UnityEngine; - -/// -/// Wraps a coroutine allowing to extract the result when it's completed -/// -/// Type of result expected -public class CoroutineWrapper: IEnumerator -{ - /// - /// Event raised when the coroutine is complete - /// - public Action Completed; - - private IEnumerator _targetCoroutine; - - private Exception _exception; - /// - /// Exception triggered during the execution of the coroutine. - /// - public Exception Exeption => _exception; - - /// - public object Current => _current; - public object _current; - - private T _result; - /// - /// Result extracted from the coroutine when it's complete - /// - public T Result => _result; - - /// - /// Create an instance of the wrapper - /// - /// Coroutine that will be executed - /// Callback that will be called when the coroutine is complete - public CoroutineWrapper(IEnumerator coroutine, Action callback = null) - { - _targetCoroutine = coroutine; - if (callback != null) - { - Completed += callback; - } - } - - /// - public bool MoveNext() - { - try - { - if (_targetCoroutine.MoveNext()) - { - _current = _targetCoroutine.Current; - - return true; - } - else - { - _result = (T)_targetCoroutine.Current; - _current = _targetCoroutine.Current; - - Completed?.Invoke(_result); - return false; - } - } - catch (Exception e) - { - Debug.LogError("Exception " + e.Message); - _exception = e; - Completed?.Invoke(default); - return false; - } - } - - /// - public void Reset() - { - _targetCoroutine.Reset(); - } -} - -/// -/// Helper class that will allow to run a coroutine -/// -public class CoroutineRunner : MonoBehaviour -{ - private static CoroutineRunner _instance; - public static CoroutineRunner Instance - { - get - { - if (_instance == null) - _instance = (new GameObject("CoroutineRunner")).AddComponent(); - - return _instance; - } - } - private void Awake() - { - DontDestroyOnLoad(gameObject); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Helpers/CoroutineWrapper.cs.meta b/Assets/Scripts/Helpers/CoroutineWrapper.cs.meta deleted file mode 100644 index 244cf57c..00000000 --- a/Assets/Scripts/Helpers/CoroutineWrapper.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -<<<<<<<< HEAD:UnityTezosAirgap/Assets/Scripts/BeaconConnectorAndroid.cs.meta -guid: a9a829b00a9c9451e8ad974559f41a6e -======== -guid: e257a0251d68743a6a1407d9ee4867ae ->>>>>>>> netezos_for_michelson:UnityTezosAirgap/Assets/Scripts/Helpers/CoroutineWrapper.cs.meta -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Helpers/NetezosExtensions.cs b/Assets/Scripts/Helpers/NetezosExtensions.cs deleted file mode 100644 index d01313a1..00000000 --- a/Assets/Scripts/Helpers/NetezosExtensions.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text.Json; -using Netezos.Contracts; -using Netezos.Encoding; -using Netezos.Forging.Models; -using Netezos.Rpc; -using Netezos.Rpc.Queries; -using Netezos.Rpc.Queries.Post; -using UnityEngine; -using BeaconSDK; -using Netezos.Keys; - -namespace BeaconSDK -{ - public static class NetezosExtensions - { - private static Dictionary _contracts = new Dictionary(); - - public static IEnumerator ReadTZBalance(string rpcUri, string sender, Action callback) - { - TezosRpc rpc = new TezosRpc( - rpcUri - ); - var getCounter = rpc.Blocks.Head.Context.Contracts[sender].Balance.GetAsync(); - yield return RpcRequest(getCounter, callback); - } - - public static IEnumerator ReadView(string rpcUri, string destination, string entrypoint, - object input, Action onComplete = null) - { - TezosRpc rpc = new TezosRpc( - rpcUri - ); - var runViewOp = rpc.Blocks.Head.Helpers.Scripts.RunView() - .PostAsync(destination, entrypoint, input); - - yield return RpcRequest(runViewOp, (JsonElement result) => - { - if (result.ValueKind != JsonValueKind.Null && result.ValueKind != JsonValueKind.Undefined && - result.TryGetProperty("data", out JsonElement val)) - onComplete(val); - else - Debug.LogError("Invalid data"); - }); - } - - public static IEnumerator HumanizeValue(JsonElement val, string rpcUri, string destination, - string humanizeEntrypoint, Action onComplete) - { - yield return FetchContractCode(rpcUri, destination); - var cs = _contracts[destination]; - - // getting parameters section as readable json: - var json = cs.HumanizeParameter(humanizeEntrypoint, Micheline.FromJson(val)); - var readResult = JsonSerializer.Deserialize(json); - onComplete?.Invoke(readResult); - } - - private static IEnumerator FetchContractCode(string rpcUri, string contract) - { - if (!_contracts.ContainsKey(contract)) - { - TezosRpc rpc = new TezosRpc( - rpcUri - ); - var scriptOp = rpc.Blocks.Head.Context.Contracts[contract].Script.GetAsync(); - yield return RpcRequest(scriptOp, - (JsonElement script) => - { - var codeElement = script.GetProperty("code").GetRawText(); - var code = Micheline.FromJson(codeElement); - _contracts[contract] = new ContractScript(code); - }); - } - } - - private static IEnumerator RpcRequest(IEnumerator op, Action callback) - { - var counterRoutine = new CoroutineWrapper(op); - yield return counterRoutine; - var counter = counterRoutine.Result; - callback?.Invoke(counter); - } - - public static IEnumerator CompileToJSONMichelson(string rpcUri, string destination, - string entry, object objArg, Action onComplete) - { - yield return FetchContractCode(rpcUri, destination); - var cs = _contracts[destination]; - - var asMichelson = cs.BuildParameter(entry, objArg); - onComplete?.Invoke(asMichelson.ToJson()); - } - - public static bool VerifySignature(string pubKey, string payload, string signature) - { - var pubkey = PubKey.FromBase58(pubKey); - var payloadBytes = Hex.Parse(payload); - return pubkey.Verify(payloadBytes, signature); - } - } -} diff --git a/Assets/Scripts/Helpers/RunViewQuery.cs b/Assets/Scripts/Helpers/RunViewQuery.cs deleted file mode 100644 index 9cd108ea..00000000 --- a/Assets/Scripts/Helpers/RunViewQuery.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using Netezos.Rpc.Queries.Post; -using UnityEngine; - -namespace Netezos.Rpc.Queries -{ - public static class ScriptsQueryExtensions - { - public static RunViewQuery RunView(this ScriptsQuery query) => new RunViewQuery(query, "run_script_view/"); - } -} - -namespace Netezos.Rpc.Queries.Post -{ - public class RunViewQuery : RpcMethod - { - //private const string ChainID = "NetXdQprcVkpaWU"; // mainnet - //private const string ChainID = "NetXLH1uAxK7CCh"; // jakarta (no Views support on kztk) - private const string ChainID = "NetXnHfVqm9iesp"; // ghostnet - - public enum UnparsingMode - { - Readable, - Optimized, - Optimized_legacy - } - - internal RunViewQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Runs a piece of code in the current context and returns the storage, operations and big_map data - /// - /// Contract handler - /// View entry point of the contract - /// Input(micheline michelson expression) - /// Base58-check encoded network identifier - /// Gas limit (optional) - /// Source (optional) - /// Payer (optional) - /// Gas limit (optional) - /// Gas limit (optional) - /// Gas limit (optional) - /// - public IEnumerator PostAsync(string contract, string view, object input, UnparsingMode unparsing_mode = UnparsingMode.Readable, string source = null, string payer = null, long? gas = null) - => PostAsync(new - { - contract, - view, - input, - chain_id = ChainID, - source, - payer, - gas = gas?.ToString(), - unparsing_mode = unparsing_mode.ToString() - //"now": "string", - //"level": "string" - }); - } -} diff --git a/Assets/Scripts/Helpers/RunViewQuery.cs.meta b/Assets/Scripts/Helpers/RunViewQuery.cs.meta deleted file mode 100644 index 5ddaf263..00000000 --- a/Assets/Scripts/Helpers/RunViewQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 52bf6c79d9ebf4740930677870ce4d90 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Helpers/UnityMainThreadDispatcher.cs b/Assets/Scripts/Helpers/UnityMainThreadDispatcher.cs deleted file mode 100644 index b0c18e1e..00000000 --- a/Assets/Scripts/Helpers/UnityMainThreadDispatcher.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2015 Pim de Witte All Rights Reserved. -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. -*/ - -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; -using System.Threading.Tasks; - -/// Author: Pim de Witte (pimdewitte.com) and contributors, https://github.com/PimDeWitte/UnityMainThreadDispatcher -/// -/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for -/// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling -/// -public class UnityMainThreadDispatcher : MonoBehaviour { - - private static readonly Queue _executionQueue = new Queue(); - - public void Update() { - lock(_executionQueue) { - while (_executionQueue.Count > 0) { - _executionQueue.Dequeue().Invoke(); - } - } - } - - /// - /// Locks the queue and adds the IEnumerator to the queue - /// - /// IEnumerator function that will be executed from the main thread. - public void Enqueue(IEnumerator action) { - lock (_executionQueue) { - _executionQueue.Enqueue (() => { - StartCoroutine (action); - }); - } - } - - /// - /// Locks the queue and adds the Action to the queue - /// - /// function that will be executed from the main thread. - public void Enqueue(Action action) - { - Enqueue(ActionWrapper(action)); - } - - /// - /// Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes - /// - /// function that will be executed from the main thread. - /// A Task that can be awaited until the action completes - public Task EnqueueAsync(Action action) - { - var tcs = new TaskCompletionSource(); - - void WrappedAction() { - try - { - action(); - tcs.TrySetResult(true); - } catch (Exception ex) - { - tcs.TrySetException(ex); - } - } - - Enqueue(ActionWrapper(WrappedAction)); - return tcs.Task; - } - - - IEnumerator ActionWrapper(Action a) - { - a(); - yield return null; - } - - - private static UnityMainThreadDispatcher _instance = null; - - public static bool Exists() { - return _instance != null; - } - - public static UnityMainThreadDispatcher Instance() { - if (!Exists ()) { - throw new Exception ("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); - } - return _instance; - } - - - void Awake() { - if (_instance == null) { - _instance = this; - DontDestroyOnLoad(this.gameObject); - } - } - - void OnDestroy() { - _instance = null; - } - - -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos.meta b/Assets/Scripts/Netezos.meta deleted file mode 100644 index 3b151794..00000000 --- a/Assets/Scripts/Netezos.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dd6c77d30802846e285b56f0458e6b00 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts.meta b/Assets/Scripts/Netezos/Contracts.meta deleted file mode 100644 index af339d10..00000000 --- a/Assets/Scripts/Netezos/Contracts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2fe25669b353c4474b20a47c78f2bf92 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/ContractParameter.cs b/Assets/Scripts/Netezos/Contracts/ContractParameter.cs deleted file mode 100644 index 47197829..00000000 --- a/Assets/Scripts/Netezos/Contracts/ContractParameter.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public class ContractParameter - { - public Dictionary Entrypoints { get; } - - public Schema Default => Entrypoints["default"]; - - public ContractParameter(IMicheline parameter) - { - if ((parameter as MichelinePrim)?.Prim != PrimType.parameter) - throw new ArgumentException("Invalid micheline: expected prim parameter"); - - var root = new ParameterSchema(parameter as MichelinePrim); - Entrypoints = new Dictionary { { "default", root.Schema } }; - - if (root.Field?.Length > 0) - Entrypoints[root.Field] = root.Schema; - - ExtractEntrypoints(root.Schema); - } - - public IMicheline Build(string entrypoint, object value) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return schema.MapObject(value, true); - } - - public IMicheline Build(string entrypoint, params object[] values) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return schema.MapObject(values, true); - } - - public IMicheline BuildOptimized(string entrypoint, object value) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - var res = schema.MapObject(value, true); - return schema.Optimize(res); - } - - public IMicheline BuildOptimized(string entrypoint, params object[] values) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - var res = schema.MapObject(values, true); - return schema.Optimize(res); - } - - public IMicheline Optimize(string entrypoint, IMicheline value, bool immutable = true) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return schema.Optimize(immutable ? Micheline.FromBytes(value.ToBytes()) : value); - } - - public string Humanize(string entrypoint, JsonWriterOptions options = default) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return schema.Humanize(options); - } - - public string Humanize(string entrypoint, IMicheline value, JsonWriterOptions options = default) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return schema.Humanize(value, options); - } - - public string GetJsonSchema(string entrypoint, JsonWriterOptions options = default) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return schema.GetJsonSchema(options); - } - - public (string, IMicheline) Normalize(string entrypoint, IMicheline value) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - var resultEntypoint = entrypoint; - var resultValue = value; - - while (schema is OrSchema or - && value is MichelinePrim prim && (prim.Prim == PrimType.Left || prim.Prim == PrimType.Right) && prim.Args?.Count == 1) - { - schema = prim.Prim == PrimType.Left ? or.Left : or.Right; - value = prim.Args[0]; - - if (schema.Field?.Length > 0) - { - resultEntypoint = schema.Field; - resultValue = value; - } - } - - return (resultEntypoint, resultValue); - } - - public bool IsEntrypointUseful(string entrypoint) - { - if (!Entrypoints.TryGetValue(entrypoint, out var schema)) - throw new ArgumentException("Entrypoint doesn't exist"); - - return !(schema is OrSchema or && or.Children().All(x => x.Field?.Length > 0)); - } - - void ExtractEntrypoints(Schema schema) - { - if (schema.Field?.Length > 0) - Entrypoints[schema.Field] = schema; - - if (schema is OrSchema or) - { - ExtractEntrypoints(or.Left); - ExtractEntrypoints(or.Right); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/ContractParameter.cs.meta b/Assets/Scripts/Netezos/Contracts/ContractParameter.cs.meta deleted file mode 100644 index ae791776..00000000 --- a/Assets/Scripts/Netezos/Contracts/ContractParameter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d53e49ad387cd4c68a1023fadb2f12f6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/ContractScript.cs b/Assets/Scripts/Netezos/Contracts/ContractScript.cs deleted file mode 100644 index a881e116..00000000 --- a/Assets/Scripts/Netezos/Contracts/ContractScript.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using Netezos.Encoding; -using UnityEngine; - -namespace Netezos.Contracts -{ - public class ContractScript - { - public ContractParameter Parameter { get; } - public ContractStorage Storage { get; } - - public Dictionary Entrypoints => Parameter.Entrypoints; - - public ContractScript(IMicheline script) - { - if (!(script is MichelineArray array) || array.Count < 3) - throw new FormatException("Invalid micheline"); - - var parameter = array.FirstOrDefault(x => (x as MichelinePrim)?.Prim == PrimType.parameter) as MichelinePrim - ?? throw new FormatException("Invalid micheline parameters"); - - var storage = array.FirstOrDefault(x => (x as MichelinePrim)?.Prim == PrimType.storage) as MichelinePrim - ?? throw new FormatException("Invalid micheline storage"); - - Parameter = new ContractParameter(parameter); - Storage = new ContractStorage(storage); - } - - public ContractScript(IMicheline parameter, IMicheline storage) - { - Parameter = new ContractParameter(parameter); - Storage = new ContractStorage(storage); - } - - public IMicheline BuildParameter(string entrypoint, object value) - => Parameter.Build(entrypoint, value); - - public IMicheline BuildParameter(string entrypoint, params object[] values) - => Parameter.Build(entrypoint, values); - - public IMicheline BuildOptimizedParameter(string entrypoint, object value) - => Parameter.BuildOptimized(entrypoint, value); - - public IMicheline BuildOptimizedParameter(string entrypoint, params object[] values) - => Parameter.BuildOptimized(entrypoint, values); - - public IMicheline OptimizeParameter(string entrypoint, IMicheline value, bool immutable = true) - => Parameter.Optimize(entrypoint, value, immutable); - - public (string, IMicheline) NormalizeParameter(string entrypoint, IMicheline value) - => Parameter.Normalize(entrypoint, value); - - public string HumanizeParameter(string entrypoint, IMicheline value, JsonWriterOptions options = default) - => Parameter.Humanize(entrypoint, value, options); - - public IMicheline OptimizeStorage(IMicheline value, bool immutable = true) - => Storage.Optimize(value, immutable); - - public string HumanizeStorage(IMicheline value, JsonWriterOptions options = default) - => Storage.Humanize(value, options); - } -} diff --git a/Assets/Scripts/Netezos/Contracts/ContractScript.cs.meta b/Assets/Scripts/Netezos/Contracts/ContractScript.cs.meta deleted file mode 100644 index 6e0a5812..00000000 --- a/Assets/Scripts/Netezos/Contracts/ContractScript.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1cd77c499a91f477db7c333bb9fc765c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/ContractStorage.cs b/Assets/Scripts/Netezos/Contracts/ContractStorage.cs deleted file mode 100644 index b19d9a51..00000000 --- a/Assets/Scripts/Netezos/Contracts/ContractStorage.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public class ContractStorage - { - public Schema Schema { get; } - - public ContractStorage(IMicheline storage) - { - if ((storage as MichelinePrim)?.Prim != PrimType.storage) - throw new ArgumentException("Invalid micheline: expected prim storage"); - - Schema = new StorageSchema(storage as MichelinePrim).Schema; - } - - public IMicheline Optimize(IMicheline value, bool immutable = true) - { - return Schema.Optimize(immutable ? Micheline.FromBytes(value.ToBytes()) : value); - } - - public string Humanize(JsonWriterOptions options = default) - { - return Schema.Humanize(options); - } - - public string Humanize(IMicheline value, JsonWriterOptions options = default) - { - return Schema.Humanize(value, options); - } - - public string GetJsonSchema(JsonWriterOptions options = default) - { - return Schema.GetJsonSchema(options); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/ContractStorage.cs.meta b/Assets/Scripts/Netezos/Contracts/ContractStorage.cs.meta deleted file mode 100644 index 17c22f35..00000000 --- a/Assets/Scripts/Netezos/Contracts/ContractStorage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 185f54c2d4a50415ab73c93af0385526 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schema.cs b/Assets/Scripts/Netezos/Contracts/Schema.cs deleted file mode 100644 index 58143d0c..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schema.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public abstract class Schema - { - #region static - public static Schema Create(MichelinePrim micheline) - { - switch (micheline.Prim) - { - case PrimType.address: return new AddressSchema(micheline); - case PrimType.bls12_381_fr: return new Bls12381FrSchema(micheline); - case PrimType.bls12_381_g1: return new Bls12381G1Schema(micheline); - case PrimType.bls12_381_g2: return new Bls12381G2Schema(micheline); - case PrimType.big_map: return new BigMapSchema(micheline); - case PrimType.@bool: return new BoolSchema(micheline); - case PrimType.bytes: return new BytesSchema(micheline); - case PrimType.chest: return new ChestSchema(micheline); - case PrimType.chest_key: return new ChestKeySchema(micheline); - case PrimType.chain_id: return new ChainIdSchema(micheline); - case PrimType.constant: return new ConstantSchema(micheline); - case PrimType.contract: return new ContractSchema(micheline); - case PrimType.@int: return new IntSchema(micheline); - case PrimType.key: return new KeySchema(micheline); - case PrimType.key_hash: return new KeyHashSchema(micheline); - case PrimType.lambda: return new LambdaSchema(micheline); - case PrimType.list: return new ListSchema(micheline); - case PrimType.map: return new MapSchema(micheline); - case PrimType.mutez: return new MutezSchema(micheline); - case PrimType.nat: return new NatSchema(micheline); - case PrimType.never: return new NeverSchema(micheline); - case PrimType.option: return new OptionSchema(micheline); - case PrimType.or: return new OrSchema(micheline); - case PrimType.pair: return new PairSchema(micheline); - case PrimType.sapling_state: return new SaplingStateSchema(micheline); - case PrimType.sapling_transaction: return new SaplingTransactionSchema(micheline); - case PrimType.sapling_transaction_deprecated: return new SaplingTransactionDeprecatedSchema(micheline); - case PrimType.set: return new SetSchema(micheline); - case PrimType.signature: return new SignatureSchema(micheline); - case PrimType.@string: return new StringSchema(micheline); - case PrimType.ticket: return new TicketSchema(micheline); - case PrimType.timestamp: return new TimestampSchema(micheline); - case PrimType.tx_rollup_l2_address: return new TxRollupL2AddressSchema(micheline); - case PrimType.unit: return new UnitSchema(micheline); - case PrimType.operation: return new OperationSchema(micheline); - case PrimType.view: return new ViewSchema(micheline); - default: - throw new NotImplementedException($"Schema for prim {micheline.Prim} is not implemented"); - } - } - #endregion - - public abstract PrimType Prim { get; } - - public string Field { get; } - public string Type { get; } - - internal int Index = -1; - internal string Annot = null; - - internal string Suffix => Index > -1 ? $"_{Index}" : string.Empty; - - public virtual string Name => (Annot ?? Prim.ToString()) + Suffix; - public virtual string Signature => Prim.ToString(); - - protected Schema(MichelinePrim micheline) - { - if (micheline.Annots?.Count > 0) - { - Field = micheline.Annots.FirstOrDefault(x => x.Type == AnnotationType.Field && x.Value.Length > 0)?.Value; - Type = micheline.Annots.FirstOrDefault(x => x.Type == AnnotationType.Type && x.Value.Length > 0)?.Value; - Annot = (Field ?? Type)?.ToAlphaNumeric(); - } - } - - public TreeView ToTreeView(IMicheline value) - { - return GetTreeView(null, value); - } - - public string Humanize(JsonWriterOptions options = default) - { - using (var mem = new MemoryStream()) - using (var writer = new Utf8JsonWriter(mem, options)) - { - writer.WriteStartObject(); - writer.WritePropertyName($"schema:{Signature}"); - WriteValue(writer); - writer.WriteEndObject(); - writer.Flush(); - - return Utf8.Convert(mem.ToArray()); - } - } - - public string Humanize(IMicheline value, JsonWriterOptions options = default) - { - using (var mem = new MemoryStream()) - using (var writer = new Utf8JsonWriter(mem, options)) - { - WriteValue(writer, value); - writer.Flush(); - - return Utf8.Convert(mem.ToArray()); - } - } - - public string GetJsonSchema(JsonWriterOptions options = default) - { - using (var mem = new MemoryStream()) - using (var writer = new Utf8JsonWriter(mem, options)) - { - writer.WriteStartObject(); - writer.WriteString("$schema", "http://json-schema.org/draft/2019-09/schema#"); - WriteJsonSchema(writer); - writer.WriteEndObject(); - writer.Flush(); - - return Utf8.Convert(mem.ToArray()); - } - } - - public IMicheline ToMicheline() - { - return new MichelinePrim - { - Prim = Prim, - Args = GetArgs(), - Annots = GetAnnotations() - }; - } - - public virtual IMicheline Optimize(IMicheline value) - { - return value; - } - - public virtual IMicheline MapObject(object obj, bool isValue = false) - { - if (isValue) - return MapValue(obj); - - switch (obj) - { - case IEnumerator enumerator: - if (!enumerator.MoveNext()) - throw MapFailedException($"enumerable is over"); - return MapValue(enumerator.Current); - case IEnumerable enumerable: - var e = enumerable.GetEnumerator(); - if (!e.MoveNext()) - throw MapFailedException($"enumerable is empty"); - return MapValue(e.Current); - case JsonElement json: - if (!json.TryGetProperty(Name, out var jsonProp)) - throw MapFailedException($"no such property"); - return MapValue(jsonProp); - default: - var prop = obj?.GetType()?.GetProperty(Name) - ?? throw MapFailedException($"no such property"); - return MapValue(prop.GetValue(obj)); - } - } - - protected virtual IMicheline MapValue(object value) - { - throw new NotImplementedException(); - } - - protected virtual List GetArgs() - { - return null; - } - - protected List GetAnnotations() - { - if (Type != null) - { - return Field != null - ? new List(2) { new TypeAnnotation(Type), new FieldAnnotation(Field) } - : new List(1) { new TypeAnnotation(Type) }; - } - else - { - return Field != null - ? new List(1) { new FieldAnnotation(Field) } - : null; - } - } - - internal virtual void WriteProperty(Utf8JsonWriter writer) - { - writer.WritePropertyName($"{Name}:{Signature}"); - WriteValue(writer); - } - - internal virtual void WriteValue(Utf8JsonWriter writer) - { - writer.WriteStringValue(Prim.ToString()); - } - - internal virtual void WriteProperty(Utf8JsonWriter writer, IMicheline value) - { - writer.WritePropertyName(Name); - WriteValue(writer, value); - } - - internal virtual void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal virtual void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteString("type", "string"); - writer.WriteString("$comment", Prim.ToString()); - } - - internal virtual TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - return new TreeView - { - Name = name ?? Name, - Schema = schema ?? this, - Value = value, - Parent = parent - }; - } - - protected FormatException FormatException(IMicheline value) - { - var type = (value as MichelinePrim)?.Prim.ToString() ?? value.Type.ToString(); - return new FormatException($"Failed to map {type} into {Prim}"); - } - - protected FormatException MapFailedException(string message) - { - return new FormatException($"Failed to map {Name}: {message}"); - } - } - - interface IFlat - { - string Flatten(IMicheline value); - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schema.cs.meta deleted file mode 100644 index 0ed8fcae..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 74d434d42704b40eebd7e6eec9dddb53 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas.meta b/Assets/Scripts/Netezos/Contracts/Schemas.meta deleted file mode 100644 index d6e638c2..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a17197e1396e543f69c05d288a562c02 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/AddressSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/AddressSchema.cs deleted file mode 100644 index 0c9bd549..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/AddressSchema.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class AddressSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.address; - - public AddressSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - if (micheBytes.Value.Length < 22) - return Hex.Convert(micheBytes.Value); - - byte[] prefix; - if (micheBytes.Value[0] == 0) - { - if (micheBytes.Value[1] == 0) - prefix = Prefix.tz1; - else if (micheBytes.Value[1] == 1) - prefix = Prefix.tz2; - else if (micheBytes.Value[1] == 2) - prefix = Prefix.tz3; - else - return Hex.Convert(micheBytes.Value); - } - else if (micheBytes.Value[0] == 1) - { - if (micheBytes.Value[21] == 0) - prefix = Prefix.KT1; - else - return Hex.Convert(micheBytes.Value); - } - else if (micheBytes.Value[0] == 2) - { - if (micheBytes.Value[21] == 0) - prefix = Prefix.txr1; - else - return Hex.Convert(micheBytes.Value); - } - else - { - return Hex.Convert(micheBytes.Value); - } - - var bytes = micheBytes.Value[0] == 0 - ? micheBytes.Value.GetBytes(2, 20) - : micheBytes.Value.GetBytes(1, 20); - - var address = Base58.Convert(bytes, prefix); - var entrypoint = micheBytes.Value.Length > 22 - ? Utf8.Convert(micheBytes.Value.GetBytes(22, micheBytes.Value.Length - 22)) - : string.Empty; - - return entrypoint.Length == 0 ? address : $"{address}%{entrypoint}"; - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is not MichelineString micheStr) - return value; - - string address; - byte[] addressBytes; - byte[] entrypointBytes; - - if (micheStr.Value.StartsWith("txr1")) - { - address = micheStr.Value.Length > 37 ? micheStr.Value.Substring(0, 37) : micheStr.Value; - addressBytes = Base58.Parse(address, 4); - entrypointBytes = micheStr.Value.Length > 38 - ? Utf8.Parse(micheStr.Value.Substring(38)) - : null; - } - else - { - address = micheStr.Value.Length > 36 ? micheStr.Value.Substring(0, 36) : micheStr.Value; - addressBytes = Base58.Parse(address, 3); - entrypointBytes = micheStr.Value.Length > 37 - ? Utf8.Parse(micheStr.Value.Substring(37)) - : null; - } - - var res = new byte[22 + (entrypointBytes?.Length ?? 0)]; - - switch (address.Substring(0, 3)) - { - case "tz1": - addressBytes.CopyTo(res, 2); - res[0] = 0; - res[1] = 0; - break; - case "tz2": - addressBytes.CopyTo(res, 2); - res[0] = 0; - res[1] = 1; - break; - case "tz3": - addressBytes.CopyTo(res, 2); - res[0] = 0; - res[1] = 2; - break; - case "KT1": - addressBytes.CopyTo(res, 1); - res[0] = 1; - res[21] = 0; - break; - case "txr" when address.StartsWith("txr1"): - addressBytes.CopyTo(res, 1); - res[0] = 2; - res[21] = 0; - break; - default: - throw FormatException(value); - } - - if (entrypointBytes != null) - entrypointBytes.CopyTo(res, 22); - - return new MichelineBytes(res); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/AddressSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/AddressSchema.cs.meta deleted file mode 100644 index 7efc6eea..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/AddressSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0e525cec50bbd41df8c392542406357a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/BigMapSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/BigMapSchema.cs deleted file mode 100644 index 92ef58d8..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/BigMapSchema.cs +++ /dev/null @@ -1,315 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; -using Netezos.Forging; -using Netezos.Utils; - -namespace Netezos.Contracts -{ - public sealed class BigMapSchema : Schema - { - public override PrimType Prim => PrimType.big_map; - - public override string Name => (Annot ?? Value.Annot ?? Prim.ToString()) + Suffix; - - public override string Signature => - $"{(Key is IFlat ? "big_map_flat" : "big_map")}:{Key.Signature}:{Value.Signature}"; - - public Schema Key { get; } - public Schema Value { get; } - - public BigMapSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 2 - || !(micheline.Args[0] is MichelinePrim key) - || !(micheline.Args[1] is MichelinePrim value)) - throw new FormatException($"Invalid {Prim} schema format"); - - Key = Create(key); - Value = Create(value); - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - if (value is MichelineInt) - return base.GetTreeView(parent, value, name, schema); - - if (!(value is MichelineArray micheArray)) - throw FormatException(value); - - var treeView = base.GetTreeView(parent, value, name, schema); - treeView.Children = new List(micheArray.Count); - - if (Key is IFlat key) - { - foreach (var item in micheArray) - { - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - treeView.Children.Add(Value.GetTreeView(treeView, elt.Args[1], key.Flatten(elt.Args[0]))); - } - } - else - { - foreach (var item in micheArray) - { - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - var keyStr = Key.Humanize(elt.Args[0], new JsonWriterOptions { Indented = false }); - treeView.Children.Add(Value.GetTreeView(treeView, elt.Args[1], keyStr)); - } - } - - return treeView; - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - if (Key is IFlat) - { - writer.WriteStartObject(); - writer.WritePropertyName(Key.Prim.ToString()); - Value.WriteValue(writer); - writer.WriteEndObject(); - } - else - { - writer.WriteStartArray(); - writer.WriteStartObject(); - writer.WritePropertyName($"key:{Key.Signature}"); - Key.WriteValue(writer); - writer.WritePropertyName($"value:{Value.Signature}"); - Value.WriteValue(writer); - writer.WriteEndObject(); - writer.WriteEndArray(); - } - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (value is MichelineInt micheInt) - { - writer.WriteNumberValue((long)micheInt.Value); - } - else if (value is MichelineArray micheArray) - { - if (Key is IFlat key) - WriteMap(writer, key, micheArray); - else - WriteKeyValues(writer, micheArray); - } - else - { - throw FormatException(value); - } - } - - void WriteMap(Utf8JsonWriter writer, IFlat key, MichelineArray items) - { - writer.WriteStartObject(); - - foreach (var item in items) - { - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid big_map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - writer.WritePropertyName(key.Flatten(elt.Args[0])); - Value.WriteValue(writer, elt.Args[1]); - } - - writer.WriteEndObject(); - } - - void WriteKeyValues(Utf8JsonWriter writer, MichelineArray items) - { - writer.WriteStartArray(); - - foreach (var item in items) - { - writer.WriteStartObject(); - - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid big_map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - writer.WritePropertyName("key"); - Key.WriteValue(writer, elt.Args[0]); - - writer.WritePropertyName("value"); - Value.WriteValue(writer, elt.Args[1]); - - writer.WriteEndObject(); - } - - writer.WriteEndArray(); - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteStartArray("oneOf"); - { - writer.WriteStartObject(); - writer.WriteString("type", "integer"); - writer.WriteString("$comment", "int"); - writer.WriteEndObject(); - - writer.WriteStartObject(); - if (Key is IFlat) - { - writer.WriteString("type", "object"); - - writer.WriteStartObject("propertyNames"); - Key.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteStartObject("additionalProperties"); - Value.WriteJsonSchema(writer); - writer.WriteEndObject(); - } - else - { - writer.WriteString("type", "array"); - writer.WriteStartObject("items"); - { - writer.WriteString("type", "object"); - - writer.WriteStartObject("properties"); - { - writer.WriteStartObject("key"); - Key.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteStartObject("value"); - Value.WriteJsonSchema(writer); - writer.WriteEndObject(); - } - writer.WriteEndObject(); - - writer.WriteStartArray("required"); - writer.WriteStringValue("key"); - writer.WriteStringValue("value"); - writer.WriteEndArray(); - - writer.WriteBoolean("additionalProperties", false); - } - writer.WriteEndObject(); - } - writer.WriteEndObject(); - } - writer.WriteEndArray(); - - if (Key is IFlat) - { - writer.WriteStartObject("default"); - writer.WriteEndObject(); - } - else - { - writer.WriteStartArray("default"); - writer.WriteEndArray(); - } - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(2) { Key.ToMicheline(), Value.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case IEnumerable e: - var arr1 = new MichelineArray(); - foreach (var item in e) - { - var type = item.GetType(); - var keyProp = type.GetProperty("Key") ?? type.GetProperty("key") - ?? throw MapFailedException("missed 'key' property"); - var valueProp = type.GetProperty("Value") ?? type.GetProperty("value") - ?? throw MapFailedException("missed 'value' property"); - - arr1.Add(new MichelinePrim - { - Prim = PrimType.Elt, - Args = new List(2) - { - Key.MapObject(keyProp.GetValue(item), true), - Value.MapObject(valueProp.GetValue(item), true) - } - }); - } - return arr1; - - case JsonElement json when json.ValueKind == JsonValueKind.Object: - var arr2 = new MichelineArray(); - foreach (var item in json.EnumerateObject()) - { - arr2.Add(new MichelinePrim - { - Prim = PrimType.Elt, - Args = new List(2) - { - Key.MapObject(item.Name, true), - Value.MapObject(item.Value, true) - } - }); - } - return arr2; - - case JsonElement json when json.ValueKind == JsonValueKind.Array: - var arr3 = new MichelineArray(); - foreach (var item in json.EnumerateArray()) - { - if (!item.TryGetProperty("key", out var key) && !item.TryGetProperty("Key", out key)) - throw MapFailedException("missed 'key' property"); - if (!item.TryGetProperty("value", out var val) && !item.TryGetProperty("Value", out val)) - throw MapFailedException("missed 'value' property"); - - arr3.Add(new MichelinePrim - { - Prim = PrimType.Elt, - Args = new List(2) - { - Key.MapObject(key, true), - Value.MapObject(val, true) - } - }); - } - return arr3; - - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineArray micheArray) - { - foreach (var item in micheArray) - { - var elt = item as MichelinePrim; - elt.Args[0] = Key.Optimize(elt.Args[0]); - elt.Args[1] = Value.Optimize(elt.Args[1]); - } - } - - return value; - } - - public string GetKeyHash(IMicheline key) - { - var optimized = Key.Optimize(Micheline.FromBytes(key.ToBytes())); - var packed = new byte[] { 5 }.Concat(LocalForge.ForgeMicheline(optimized)); - var hash = Blake2b.GetDigest(packed); - - return Base58.Convert(hash, Prefix.expr); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/BigMapSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/BigMapSchema.cs.meta deleted file mode 100644 index 38399264..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/BigMapSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 83a43d9f664c04be780cafc39417f59e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381FrSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381FrSchema.cs deleted file mode 100644 index 2ff3b644..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381FrSchema.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class Bls12381FrSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.bls12_381_fr; - - BigInteger Order => new BigInteger(new byte[] - { - 1, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, - 5, 216, 161, 9, 8, 216, 57, 51, 72, 125, 157, 41, 83, 167, 237, 115 - }); - - public Bls12381FrSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineInt micheInt) - { - var el = (micheInt.Value % Order + Order) % Order; - return Hex.Convert(el.ToByteArray()); - } - - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case BigInteger b: - return new MichelineBytes(b.ToByteArray()); - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineInt micheInt) - { - var el = (micheInt.Value % Order + Order) % Order; - return new MichelineBytes(el.ToByteArray()); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381FrSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381FrSchema.cs.meta deleted file mode 100644 index c08e4389..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381FrSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0e90d4526501848f6bf4761a5c56d2ee -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G1Schema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G1Schema.cs deleted file mode 100644 index b99d9f01..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G1Schema.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class Bls12381G1Schema : Schema, IFlat - { - public override PrimType Prim => PrimType.bls12_381_g1; - - public Bls12381G1Schema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G1Schema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G1Schema.cs.meta deleted file mode 100644 index b6fd14d5..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G1Schema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a2bc8f6532fe84ae7bfdc4cc7d410a34 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G2Schema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G2Schema.cs deleted file mode 100644 index bd8ece65..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G2Schema.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class Bls12381G2Schema : Schema, IFlat - { - public override PrimType Prim => PrimType.bls12_381_g2; - - public Bls12381G2Schema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G2Schema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G2Schema.cs.meta deleted file mode 100644 index b4b32d8a..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/Bls12381G2Schema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6547c5b5a812f4580af56ffcef3ae13e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/BoolSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/BoolSchema.cs deleted file mode 100644 index f6dfde0d..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/BoolSchema.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class BoolSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.@bool; - - public BoolSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (!(value is MichelinePrim michePrim) - || (michePrim.Prim != PrimType.True && michePrim.Prim != PrimType.False)) - throw FormatException(value); - - writer.WriteBooleanValue(michePrim.Prim == PrimType.True); - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteString("type", "boolean"); - writer.WriteString("$comment", Prim.ToString()); - } - - public string Flatten(IMicheline value) - { - if (value is MichelinePrim michePrim - && (michePrim.Prim == PrimType.True || michePrim.Prim == PrimType.False)) - return (michePrim.Prim == PrimType.True).ToString().ToLower(); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case bool b: - return new MichelinePrim { Prim = b ? PrimType.True : PrimType.False }; - case JsonElement json when json.ValueKind == JsonValueKind.True: - return new MichelinePrim { Prim = PrimType.True }; - case JsonElement json when json.ValueKind == JsonValueKind.False: - return new MichelinePrim { Prim = PrimType.False }; - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/BoolSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/BoolSchema.cs.meta deleted file mode 100644 index c982b611..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/BoolSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5445eb3fc1a2e4cce86e15ad2bdde873 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/BytesSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/BytesSchema.cs deleted file mode 100644 index 9541d4d9..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/BytesSchema.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class BytesSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.bytes; - - public BytesSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/BytesSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/BytesSchema.cs.meta deleted file mode 100644 index 65828ce2..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/BytesSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 69aca65106093420186035833ca81b7c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ChainIdSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ChainIdSchema.cs deleted file mode 100644 index 3c105475..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ChainIdSchema.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ChainIdSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.chain_id; - - public ChainIdSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - if (micheBytes.Value.Length != 4) - return Hex.Convert(micheBytes.Value); - - return Base58.Convert(micheBytes.Value, Prefix.Net); - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineString micheStr) - { - var bytes = Base58.Parse(micheStr.Value, 3); - return new MichelineBytes(bytes); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ChainIdSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ChainIdSchema.cs.meta deleted file mode 100644 index a74fdda8..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ChainIdSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d4c59bb0a5cf34270819728ead7a8000 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ChestKeySchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ChestKeySchema.cs deleted file mode 100644 index cfc98fa8..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ChestKeySchema.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ChestKeySchema : Schema, IFlat - { - public override PrimType Prim => PrimType.chest_key; - - public ChestKeySchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ChestKeySchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ChestKeySchema.cs.meta deleted file mode 100644 index e8cb03ea..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ChestKeySchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 293d57008f8954996a29d7ee32405706 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ChestSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ChestSchema.cs deleted file mode 100644 index 214b25b3..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ChestSchema.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ChestSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.chest; - - public ChestSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ChestSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ChestSchema.cs.meta deleted file mode 100644 index 31615dd4..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ChestSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1c05ae52c07a6425485b8d2b35bfccdb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ConstantSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ConstantSchema.cs deleted file mode 100644 index 5da28d81..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ConstantSchema.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Text.Json; -using Netezos.Encoding; -using Netezos.Forging; -using Netezos.Utils; - -namespace Netezos.Contracts -{ - public sealed class ConstantSchema : Schema - { - public override PrimType Prim => PrimType.constant; - - public ConstantSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - public override IMicheline MapObject(object obj, bool isValue = false) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - protected override IMicheline MapValue(object value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - public static string GetGlobalAddress(IMicheline value) - { - var bytes = LocalForge.ForgeMicheline(value); - var hash = Blake2b.GetDigest(bytes); - return Base58.Convert(hash, Prefix.expr); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ConstantSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ConstantSchema.cs.meta deleted file mode 100644 index d93790ec..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ConstantSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e735f614d566b427997aef65bbf55a34 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ContractSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ContractSchema.cs deleted file mode 100644 index 3df00658..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ContractSchema.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ContractSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.contract; - - public Schema Parameters { get; } - - public ContractSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelinePrim type)) - throw new FormatException($"Invalid {Prim} schema format"); - - Parameters = Create(type); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - if (micheBytes.Value.Length < 22) - return Hex.Convert(micheBytes.Value); - - byte[] prefix; - if (micheBytes.Value[0] == 0) - { - if (micheBytes.Value[1] == 0) - prefix = Prefix.tz1; - else if (micheBytes.Value[1] == 1) - prefix = Prefix.tz2; - else if (micheBytes.Value[1] == 2) - prefix = Prefix.tz3; - else - return Hex.Convert(micheBytes.Value); - } - else if (micheBytes.Value[0] == 1) - { - if (micheBytes.Value[21] == 0) - prefix = Prefix.KT1; - else - return Hex.Convert(micheBytes.Value); - } - else if (micheBytes.Value[0] == 2) - { - if (micheBytes.Value[21] == 0) - prefix = Prefix.txr1; - else - return Hex.Convert(micheBytes.Value); - } - else - { - return Hex.Convert(micheBytes.Value); - } - - var bytes = micheBytes.Value[0] == 0 - ? micheBytes.Value.GetBytes(2, 20) - : micheBytes.Value.GetBytes(1, 20); - - var address = Base58.Convert(bytes, prefix); - var entrypoint = micheBytes.Value.Length > 22 - ? Utf8.Convert(micheBytes.Value.GetBytes(22, micheBytes.Value.Length - 22)) - : string.Empty; - - return entrypoint.Length == 0 ? address : $"{address}%{entrypoint}"; - } - else - { - throw FormatException(value); - } - } - - protected override List GetArgs() - { - return new List(1) { Parameters.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is not MichelineString micheStr) - return value; - - string address; - byte[] addressBytes; - byte[] entrypointBytes; - - if (micheStr.Value.StartsWith("txr1")) - { - address = micheStr.Value.Substring(0, 37); - addressBytes = Base58.Parse(address, 4); - entrypointBytes = micheStr.Value.Length > 38 - ? Utf8.Parse(micheStr.Value.Substring(38)) - : null; - } - else - { - address = micheStr.Value.Substring(0, 36); - addressBytes = Base58.Parse(address, 3); - entrypointBytes = micheStr.Value.Length > 37 - ? Utf8.Parse(micheStr.Value.Substring(37)) - : null; - } - - var res = new byte[22 + (entrypointBytes?.Length ?? 0)]; - - switch (address.Substring(0, 3)) - { - case "tz1": - addressBytes.CopyTo(res, 2); - res[0] = 0; - res[1] = 0; - break; - case "tz2": - addressBytes.CopyTo(res, 2); - res[0] = 0; - res[1] = 1; - break; - case "tz3": - addressBytes.CopyTo(res, 2); - res[0] = 0; - res[1] = 2; - break; - case "KT1": - addressBytes.CopyTo(res, 1); - res[0] = 1; - res[21] = 0; - break; - case "txr" when address.StartsWith("txr1"): - addressBytes.CopyTo(res, 1); - res[0] = 2; - res[21] = 0; - break; - default: - throw FormatException(value); - } - - if (entrypointBytes != null) - entrypointBytes.CopyTo(res, 22); - - return new MichelineBytes(res); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ContractSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ContractSchema.cs.meta deleted file mode 100644 index 7eaac41d..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ContractSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0dab663e1255349759bfb251565748b3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/IntSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/IntSchema.cs deleted file mode 100644 index 4424f277..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/IntSchema.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class IntSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.@int; - - public IntSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineInt micheInt) - return micheInt.Value.ToString(); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case BigInteger b: - return new MichelineInt(b); - case int i: - return new MichelineInt(new BigInteger(i)); - case long l: - return new MichelineInt(new BigInteger(l)); - case string s: - // TODO: validation - return new MichelineInt(BigInteger.Parse(s)); - case JsonElement json when json.ValueKind == JsonValueKind.Number: - // TODO: validation - return new MichelineInt(new BigInteger(json.GetInt64())); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation - return new MichelineInt(BigInteger.Parse(json.GetString())); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/IntSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/IntSchema.cs.meta deleted file mode 100644 index b2bc259a..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/IntSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 700d0cb49faa44cb9b6862edbaac9014 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/KeyHashSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/KeyHashSchema.cs deleted file mode 100644 index 5d1c5080..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/KeyHashSchema.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class KeyHashSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.key_hash; - - public KeyHashSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - if (micheBytes.Value.Length != 21) - return Hex.Convert(micheBytes.Value); - - var prefix = micheBytes.Value[0] == 0 - ? Prefix.tz1 - : micheBytes.Value[0] == 1 - ? Prefix.tz2 - : micheBytes.Value[0] == 2 - ? Prefix.tz3 - : null; - - if (prefix == null) - return Hex.Convert(micheBytes.Value); - - var bytes = micheBytes.Value.GetBytes(1, micheBytes.Value.Length - 1); - return Base58.Convert(bytes, prefix); - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineString micheStr) - { - var bytes = Base58.Parse(micheStr.Value, 3); - var res = new byte[21]; - - switch (micheStr.Value.Substring(0, 3)) - { - case "tz1": - res[0] = 0; - break; - case "tz2": - res[0] = 1; - break; - case "tz3": - res[0] = 2; - break; - default: - throw FormatException(value); - } - - bytes.CopyTo(res, 1); - return new MichelineBytes(res); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/KeyHashSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/KeyHashSchema.cs.meta deleted file mode 100644 index a5e529cd..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/KeyHashSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e0e5734c03d004d3da170ded3aa57621 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/KeySchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/KeySchema.cs deleted file mode 100644 index f62506e4..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/KeySchema.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class KeySchema : Schema, IFlat - { - public override PrimType Prim => PrimType.key; - - public KeySchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - var prefix = micheBytes.Value[0] == 0 && micheBytes.Value.Length == 33 - ? Prefix.edpk - : micheBytes.Value[0] == 1 && micheBytes.Value.Length == 34 - ? Prefix.sppk - : micheBytes.Value[0] == 2 && micheBytes.Value.Length == 34 - ? Prefix.p2pk - : null; - - if (prefix == null) - return Hex.Convert(micheBytes.Value); - - var bytes = micheBytes.Value.GetBytes(1, micheBytes.Value.Length - 1); - return Base58.Convert(bytes, prefix); - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineString micheStr) - { - var bytes = Base58.Parse(micheStr.Value, 4); - byte[] res; - - switch (micheStr.Value.Substring(0, 4)) - { - case "edpk": - res = new byte[33]; - res[0] = 0; - break; - case "sppk": - res = new byte[34]; - res[0] = 1; - break; - case "p2pk": - res = new byte[34]; - res[0] = 2; - break; - default: - throw FormatException(value); - } - - bytes.CopyTo(res, 1); - return new MichelineBytes(res); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/KeySchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/KeySchema.cs.meta deleted file mode 100644 index 58dd9db1..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/KeySchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 92fddc39f436d42b88e6c5fc9d1ad41c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/LambdaSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/LambdaSchema.cs deleted file mode 100644 index 1ca48719..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/LambdaSchema.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class LambdaSchema : Schema - { - public override PrimType Prim => PrimType.lambda; - - public Schema In { get; } - public Schema Out { get; } - - public LambdaSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 2 - || !(micheline.Args[0] is MichelinePrim input) - || !(micheline.Args[1] is MichelinePrim output)) - throw new FormatException($"Invalid {Prim} schema format"); - - In = Create(input); - Out = Create(output); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - // TODO: convert lambda to Michelson - writer.WriteStringValue(Micheline.ToJson(value)); - } - - protected override List GetArgs() - { - return new List(2) { In.ToMicheline(), Out.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case IMicheline m: - return m; - case string s: - // TODO: validation - return Micheline.FromJson(s); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation - return Micheline.FromJson(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/LambdaSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/LambdaSchema.cs.meta deleted file mode 100644 index 7ed360b9..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/LambdaSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1ccb36d7025e9400a9e6956470235d9f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ListSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ListSchema.cs deleted file mode 100644 index 98655611..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ListSchema.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ListSchema : Schema - { - public override PrimType Prim => PrimType.list; - - public override string Name => (Annot ?? Item.Annot ?? Prim.ToString()) + Suffix; - - public override string Signature => $"list:{Item.Signature}"; - - public Schema Item { get; } - - public ListSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelinePrim item)) - throw new FormatException($"Invalid {Prim} schema format"); - - Item = Create(item); - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - if (!(value is MichelineArray micheArray)) - throw FormatException(value); - - var treeView = base.GetTreeView(parent, value, name, schema); - - treeView.Children = new List(micheArray.Count); - for (int i = 0; i < micheArray.Count; i++) - treeView.Children.Add(Item.GetTreeView(treeView, micheArray[i], i.ToString())); - - return treeView; - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - writer.WriteStartArray(); - Item.WriteValue(writer); - writer.WriteEndArray(); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (value is MichelineArray micheArray) - { - writer.WriteStartArray(); - - foreach (var item in micheArray) - Item.WriteValue(writer, item); - - writer.WriteEndArray(); - } - else - { - throw FormatException(value); - } - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteString("type", "array"); - - writer.WriteStartObject("items"); - Item.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(1) { Item.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case IEnumerable e: - var arr1 = new MichelineArray(); - foreach (var item in e) - arr1.Add(Item.MapObject(item, true)); - return arr1; - - case JsonElement json when json.ValueKind == JsonValueKind.Array: - var arr2 = new MichelineArray(); - foreach (var item in json.EnumerateArray()) - arr2.Add(Item.MapObject(item, true)); - return arr2; - - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineArray micheArray) - { - var res = new MichelineArray(micheArray.Count); - foreach (var item in micheArray) - res.Add(Item.Optimize(item)); - return res; - } - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ListSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ListSchema.cs.meta deleted file mode 100644 index 0182018d..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ListSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 527700a3066674449919d002041d3c9d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/MapSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/MapSchema.cs deleted file mode 100644 index 5c008b5c..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/MapSchema.cs +++ /dev/null @@ -1,275 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class MapSchema : Schema - { - public override PrimType Prim => PrimType.map; - - public override string Name => (Annot ?? Value.Annot ?? Prim.ToString()) + Suffix; - - public override string Signature => - $"{(Key is IFlat ? "map_flat" : "map")}:{Key.Signature}:{Value.Signature}"; - - public Schema Key { get; } - public Schema Value { get; } - - public MapSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 2 - || !(micheline.Args[0] is MichelinePrim key) - || !(micheline.Args[1] is MichelinePrim value)) - throw new FormatException($"Invalid {Prim} schema format"); - - Key = Create(key); - Value = Create(value); - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - if (!(value is MichelineArray micheArray)) - throw FormatException(value); - - var treeView = base.GetTreeView(parent, value, name, schema); - treeView.Children = new List(micheArray.Count); - - if (Key is IFlat key) - { - foreach (var item in micheArray) - { - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - treeView.Children.Add(Value.GetTreeView(treeView, elt.Args[1], key.Flatten(elt.Args[0]))); - } - } - else - { - foreach (var item in micheArray) - { - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - var keyStr = Key.Humanize(elt.Args[0], new JsonWriterOptions { Indented = false }); - treeView.Children.Add(Value.GetTreeView(treeView, elt.Args[1], keyStr)); - } - } - - return treeView; - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - if (Key is IFlat) - { - writer.WriteStartObject(); - writer.WritePropertyName(Key.Prim.ToString()); - Value.WriteValue(writer); - writer.WriteEndObject(); - } - else - { - writer.WriteStartArray(); - writer.WriteStartObject(); - writer.WritePropertyName($"key:{Key.Signature}"); - Key.WriteValue(writer); - writer.WritePropertyName($"value:{Value.Signature}"); - Value.WriteValue(writer); - writer.WriteEndObject(); - writer.WriteEndArray(); - } - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (value is MichelineArray micheArray) - { - if (Key is IFlat key) - WriteMap(writer, key, micheArray); - else - WriteKeyValues(writer, micheArray); - } - else - { - throw FormatException(value); - } - } - - void WriteMap(Utf8JsonWriter writer, IFlat key, MichelineArray items) - { - writer.WriteStartObject(); - - foreach (var item in items) - { - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - writer.WritePropertyName(key.Flatten(elt.Args[0])); - Value.WriteValue(writer, elt.Args[1]); - } - - writer.WriteEndObject(); - } - - void WriteKeyValues(Utf8JsonWriter writer, MichelineArray items) - { - writer.WriteStartArray(); - - foreach (var item in items) - { - writer.WriteStartObject(); - - if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2) - throw new FormatException($"Invalid map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}"); - - writer.WritePropertyName("key"); - Key.WriteValue(writer, elt.Args[0]); - - writer.WritePropertyName("value"); - Value.WriteValue(writer, elt.Args[1]); - - writer.WriteEndObject(); - } - - writer.WriteEndArray(); - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - if (Key is IFlat) - { - writer.WriteString("type", "object"); - - writer.WriteStartObject("propertyNames"); - Key.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteStartObject("additionalProperties"); - Value.WriteJsonSchema(writer); - writer.WriteEndObject(); - } - else - { - writer.WriteString("type", "array"); - writer.WriteStartObject("items"); - { - writer.WriteString("type", "object"); - - writer.WriteStartObject("properties"); - { - writer.WriteStartObject("key"); - Key.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteStartObject("value"); - Value.WriteJsonSchema(writer); - writer.WriteEndObject(); - } - writer.WriteEndObject(); - - writer.WriteStartArray("required"); - writer.WriteStringValue("key"); - writer.WriteStringValue("value"); - writer.WriteEndArray(); - - writer.WriteBoolean("additionalProperties", false); - } - writer.WriteEndObject(); - } - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(2) { Key.ToMicheline(), Value.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case IEnumerable e: - var arr1 = new MichelineArray(); - foreach (var item in e) - { - var type = item.GetType(); - var keyProp = type.GetProperty("Key") ?? type.GetProperty("key") - ?? throw MapFailedException("missed 'key' property"); - var valueProp = type.GetProperty("Value") ?? type.GetProperty("value") - ?? throw MapFailedException("missed 'value' property"); - - arr1.Add(new MichelinePrim - { - Prim = PrimType.Elt, - Args = new List(2) - { - Key.MapObject(keyProp.GetValue(item), true), - Value.MapObject(valueProp.GetValue(item), true) - } - }); - } - return arr1; - - case JsonElement json when json.ValueKind == JsonValueKind.Object: - var arr2 = new MichelineArray(); - foreach (var item in json.EnumerateObject()) - { - arr2.Add(new MichelinePrim - { - Prim = PrimType.Elt, - Args = new List(2) - { - Key.MapObject(item.Name, true), - Value.MapObject(item.Value, true) - } - }); - } - return arr2; - - case JsonElement json when json.ValueKind == JsonValueKind.Array: - var arr3 = new MichelineArray(); - foreach (var item in json.EnumerateArray()) - { - if (!item.TryGetProperty("key", out var key) && !item.TryGetProperty("Key", out key)) - throw MapFailedException("missed 'key' property"); - if (!item.TryGetProperty("value", out var val) && !item.TryGetProperty("Value", out val)) - throw MapFailedException("missed 'value' property"); - - arr3.Add(new MichelinePrim - { - Prim = PrimType.Elt, - Args = new List(2) - { - Key.MapObject(key, true), - Value.MapObject(val, true) - } - }); - } - return arr3; - - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineArray micheArray) - { - foreach (var item in micheArray) - { - var elt = item as MichelinePrim; - elt.Args[0] = Key.Optimize(elt.Args[0]); - elt.Args[1] = Value.Optimize(elt.Args[1]); - } - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/MapSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/MapSchema.cs.meta deleted file mode 100644 index 391007b5..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/MapSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 140692317b6194caab8c1a8dd859d176 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/MutezSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/MutezSchema.cs deleted file mode 100644 index 01a996d1..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/MutezSchema.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class MutezSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.mutez; - - public MutezSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineInt micheInt) - return micheInt.Value.ToString(); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case BigInteger b: - return new MichelineInt(b); - case int i: - return new MichelineInt(new BigInteger(i)); - case long l: - return new MichelineInt(new BigInteger(l)); - case string s: - // TODO: validation - return new MichelineInt(BigInteger.Parse(s)); - case JsonElement json when json.ValueKind == JsonValueKind.Number: - // TODO: validation - return new MichelineInt(new BigInteger(json.GetInt64())); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation - return new MichelineInt(BigInteger.Parse(json.GetString())); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/MutezSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/MutezSchema.cs.meta deleted file mode 100644 index 6fdca969..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/MutezSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a1ff19c8b39ef40a3b079c777238beb7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/NatSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/NatSchema.cs deleted file mode 100644 index d62a5b09..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/NatSchema.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class NatSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.nat; - - public NatSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineInt micheInt) - return micheInt.Value.ToString(); - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case BigInteger b: - return new MichelineInt(b); - case int i: - return new MichelineInt(new BigInteger(i)); - case long l: - return new MichelineInt(new BigInteger(l)); - case string s: - // TODO: validation - return new MichelineInt(BigInteger.Parse(s)); - case JsonElement json when json.ValueKind == JsonValueKind.Number: - // TODO: validation - return new MichelineInt(new BigInteger(json.GetInt64())); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation - return new MichelineInt(BigInteger.Parse(json.GetString())); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/NatSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/NatSchema.cs.meta deleted file mode 100644 index 79723e56..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/NatSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a9da7c5e7f324bb5a4285047f968d11 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/NeverSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/NeverSchema.cs deleted file mode 100644 index 9d4e2d5c..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/NeverSchema.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class NeverSchema : Schema - { - public override PrimType Prim => PrimType.never; - - public NeverSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - public override IMicheline MapObject(object obj, bool isValue = false) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - protected override IMicheline MapValue(object value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/NeverSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/NeverSchema.cs.meta deleted file mode 100644 index 904b0eb1..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/NeverSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d0634916d84254e8da261aa35c78a8a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/OperationSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/OperationSchema.cs deleted file mode 100644 index 65bd3c1e..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/OperationSchema.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class OperationSchema : Schema - { - public override PrimType Prim => PrimType.operation; - - public OperationSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - public override IMicheline MapObject(object obj, bool isValue = false) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - protected override IMicheline MapValue(object value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/OperationSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/OperationSchema.cs.meta deleted file mode 100644 index 5dff648e..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/OperationSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c23d7a6ea4aa84b05aa38ba3e361cfce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/OptionSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/OptionSchema.cs deleted file mode 100644 index 850ac619..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/OptionSchema.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class OptionSchema : Schema - { - public override PrimType Prim => PrimType.option; - - public override string Name => (Annot ?? Some.Annot ?? Some.Prim.ToString()) + Suffix; - - public override string Signature => $"?{Some.Signature}"; - - public Schema Some { get; } - - public OptionSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelinePrim some)) - throw new FormatException($"Invalid {Prim} schema format"); - - Some = Create(some); - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - if (value is not MichelinePrim prim) - throw FormatException(value); - - if (prim.Prim == PrimType.None) - { - return base.GetTreeView(parent, value, name); - } - else if (prim.Prim == PrimType.Some) - { - if (prim.Args?.Count != 1) - throw new FormatException("Invalid 'Some' prim args count"); - - var treeView = base.GetTreeView(parent, value, name); - treeView.Children = new(1); - treeView.Children.Add(Some.GetTreeView(treeView, prim.Args[0], name ?? Name)); - return treeView; - } - else - { - throw FormatException(value); - } - - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - Some.WriteValue(writer); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (!(value is MichelinePrim prim)) - throw FormatException(value); - - if (prim.Prim == PrimType.None) - { - writer.WriteNullValue(); - } - else if (prim.Prim == PrimType.Some) - { - if (prim.Args?.Count != 1) - throw new FormatException("Invalid 'Some' prim args count"); - - Some.WriteValue(writer, prim.Args[0]); - } - else - { - throw FormatException(value); - } - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteStartArray("oneOf"); - { - writer.WriteStartObject(); - Some.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteStartObject(); - writer.WriteString("type", "null"); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(1) { Some.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - return value == null || value is JsonElement json && json.ValueKind == JsonValueKind.Null - ? new MichelinePrim - { - Prim = PrimType.None - } - : new MichelinePrim - { - Prim = PrimType.Some, - Args = new List(1) - { - Some.MapObject(value, true) - } - }; - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelinePrim prim && prim.Prim == PrimType.Some) - { - prim.Args[0] = Some.Optimize(prim.Args[0]); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/OptionSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/OptionSchema.cs.meta deleted file mode 100644 index b054548b..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/OptionSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 44776c199656e43cea8befdd1adbd3c8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/OrSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/OrSchema.cs deleted file mode 100644 index 39da3f9c..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/OrSchema.cs +++ /dev/null @@ -1,279 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class OrSchema : Schema - { - public override PrimType Prim => PrimType.or; - - public Schema Left { get; } - public Schema Right { get; } - - public OrSchema(MichelinePrim micheline, bool nested = false) : base(micheline) - { - if (micheline.Args?.Count != 2 - || !(micheline.Args[0] is MichelinePrim left) - || !(micheline.Args[1] is MichelinePrim right)) - throw new FormatException($"Invalid {Prim} schema format"); - - Left = left.Prim == PrimType.or - ? new OrSchema(left, true) - : Create(left); - - Right = right.Prim == PrimType.or - ? new OrSchema(right, true) - : Create(right); - - if (!nested) - { - var fields = new Dictionary(); - var children = Children(); - foreach (var child in children.Where(x => x.Name != null)) - { - var name = child.Name; - if (fields.ContainsKey(name)) - child.Index = ++fields[name]; - else - fields.Add(name, 0); - } - foreach (var kv in fields.Where(x => x.Value > 0)) - children.First(x => x.Name == kv.Key).Index = 0; - } - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - var (endSchema, endValue, endPath) = JumpToEnd(this, value); - var path = endSchema.Annot != null - ? endSchema.Annot + endSchema.Suffix - : endPath; - - var treeView = base.GetTreeView(parent, value, name, schema); - treeView.Children = new List - { - endSchema.GetTreeView(treeView, endValue, path) - }; - - return treeView; - } - - protected override IMicheline MapValue(object value) - { - if (value is JsonElement json && json.ValueKind == JsonValueKind.Object) - { - foreach (var (path, pathName, child) in ChildrenPaths()) - { - if (json.TryGetProperty(pathName, out var pathValue)) - return MapOr(path, pathValue, child); - } - } - else - { - var type = value?.GetType() - ?? throw MapFailedException("value cannot be null"); - - foreach (var (path, pathName, child) in ChildrenPaths()) - { - var pathValue = type.GetProperty(pathName)?.GetValue(value); - if (pathValue != null) - return MapOr(path, pathValue, child); - } - } - - throw MapFailedException("no paths matched"); - } - - IMicheline MapOr(string path, object value, Schema child) - { - var res = new MichelinePrim - { - Prim = path[0] == 'L' ? PrimType.Left : PrimType.Right, - Args = new List(1) - }; - - var currPath = res; - for (int i = 1; i < path.Length; i++) - { - var or = new MichelinePrim - { - Prim = path[i] == 'L' ? PrimType.Left : PrimType.Right, - Args = new List(1) - }; - currPath.Args.Add(or); - currPath = or; - } - currPath.Args.Add(child.MapObject(value, true)); - - return res; - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - - foreach (var (_, pathName, child) in ChildrenPaths()) - { - writer.WritePropertyName($"{pathName}:{child.Signature}"); - child.WriteValue(writer); - } - - writer.WriteEndObject(); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - var (endSchema, endValue, endPath) = JumpToEnd(this, value); - var path = endSchema.Annot != null - ? endSchema.Annot + endSchema.Suffix - : endPath; - - writer.WriteStartObject(); - - writer.WritePropertyName(path); - endSchema.WriteValue(writer, endValue); - - writer.WriteEndObject(); - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteStartArray("oneOf"); - foreach (var (_, pathName, child) in ChildrenPaths()) - { - writer.WriteStartObject(); - { - writer.WriteString("type", "object"); - - writer.WriteStartObject("properties"); - { - writer.WriteStartObject(pathName); - child.WriteJsonSchema(writer); - writer.WriteEndObject(); - } - writer.WriteEndObject(); - - writer.WriteStartArray("required"); - writer.WriteStringValue(pathName); - writer.WriteEndArray(); - - writer.WriteBoolean("additionalProperties", false); - } - writer.WriteEndObject(); - } - writer.WriteEndArray(); - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(2) { Left.ToMicheline(), Right.ToMicheline() }; - } - - (Schema, IMicheline, string) JumpToEnd(OrSchema or, IMicheline value, string path = "") - { - var currentSchema = (Schema)or; - var currentValue = value; - var currentPath = path; - - while (currentSchema is OrSchema currentOr) - { - if (!(currentValue is MichelinePrim prim) || prim.Args?.Count != 1) - throw FormatException(value); - - if (prim.Prim == PrimType.Left) - { - currentSchema = currentOr.Left; - currentValue = prim.Args[0]; - currentPath += "L"; - } - else if (prim.Prim == PrimType.Right) - { - currentSchema = currentOr.Right; - currentValue = prim.Args[0]; - currentPath += "R"; - } - else - { - throw FormatException(value); - } - } - - return (currentSchema, currentValue, currentPath); - } - - public IEnumerable Children() - { - if (Left is OrSchema leftOr) - { - foreach (var child in leftOr.Children()) - yield return child; - } - else - { - yield return Left; - } - - if (Right is OrSchema rightOr) - { - foreach (var child in rightOr.Children()) - yield return child; - } - else - { - yield return Right; - } - } - - IEnumerable<(string, string, Schema)> ChildrenPaths(string path = "") - { - if (Left is OrSchema leftOr) - { - foreach (var child in leftOr.ChildrenPaths(path + "L")) - yield return child; - } - else - { - var curPath = path + "L"; - var curPathName = Left.Annot != null - ? Left.Annot + Left.Suffix - : curPath; - - yield return (curPath, curPathName, Left); - } - - if (Right is OrSchema rightOr) - { - foreach (var child in rightOr.ChildrenPaths(path + "R")) - yield return child; - } - else - { - var curPath = path + "R"; - var curPathName = Right.Annot != null - ? Right.Annot + Right.Suffix - : curPath; - - yield return (curPath, curPathName, Right); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelinePrim prim) - { - if (prim.Prim == PrimType.Left) - prim.Args[0] = Left.Optimize(prim.Args[0]); - - if (prim.Prim == PrimType.Right) - prim.Args[0] = Right.Optimize(prim.Args[0]); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/OrSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/OrSchema.cs.meta deleted file mode 100644 index 95eeecd5..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/OrSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cb4290fb2676c4e78be48e1d76b0dd98 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/PairSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/PairSchema.cs deleted file mode 100644 index 1f0461e5..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/PairSchema.cs +++ /dev/null @@ -1,350 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class PairSchema : Schema - { - public override PrimType Prim => PrimType.pair; - - public override string Name => Annot; - - public override string Signature => "object"; - - public Schema Left { get; } - public Schema Right { get; } - public PairKind Kind { get; } - - public PairSchema(MichelinePrim micheline, bool nested = false) : base(micheline) - { - #region deoptimize - if (micheline.Args?.Count > 2) - { - micheline = new MichelinePrim - { - Prim = micheline.Prim, - Annots = micheline.Annots, - Args = new List(2) - { - micheline.Args[0], - new MichelinePrim - { - Prim = PrimType.pair, - Args = micheline.Args.Skip(1).ToList() - } - } - }; - } - #endregion - - if (micheline.Args?.Count != 2 - || !(micheline.Args[0] is MichelinePrim left) - || !(micheline.Args[1] is MichelinePrim right)) - throw new FormatException($"Invalid {Prim} schema format"); - - Left = left.Prim == PrimType.pair - ? new PairSchema(left, true) - : Create(left); - - Right = right.Prim == PrimType.pair - ? new PairSchema(right, true) - : Create(right); - - if (nested && Name == null) - { - Kind = PairKind.Nested; - } - else - { - Kind = PairKind.Object; - var fields = new Dictionary(); - var children = Children(); - foreach (var child in children) - { - var name = child.Name; - if (fields.ContainsKey(name)) - child.Index = ++fields[name]; - else - fields.Add(name, 0); - } - foreach (var kv in fields.Where(x => x.Value > 0)) - children.First(x => x.Name == kv.Key).Index = 0; - } - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - var treeView = base.GetTreeView(parent, value, name, schema); - - treeView.Children = Children(value) - .Select(x => x.Item1.GetTreeView(treeView, x.Item2)) - .ToList(); - - return treeView; - } - - public override IMicheline MapObject(object obj, bool isValue = false) - { - if (Kind == PairKind.Object) - { - if (obj is IEnumerable e) - return MapPair(e.GetEnumerator()); - - if (isValue) - return MapPair(obj); - - switch (obj) - { - case IEnumerator enumerator: - if (!enumerator.MoveNext()) - throw MapFailedException($"enumerable is over"); - return MapPair(enumerator.Current); - case JsonElement json: - if (!json.TryGetProperty(Name, out var jsonProp)) - throw MapFailedException($"no such property"); - return MapPair(jsonProp); - default: - var prop = obj?.GetType()?.GetProperty(Name) - ?? throw MapFailedException($"no such property"); - return MapPair(prop.GetValue(obj)); - } - } - else - { - return MapPair(obj); - } - } - - IMicheline MapPair(object value) => new MichelinePrim - { - Prim = PrimType.Pair, - Args = new List(2) - { - Left.MapObject(value), - Right.MapObject(value) - } - }; - - internal override void WriteProperty(Utf8JsonWriter writer) - { - if (Kind == PairKind.Object) - { - writer.WritePropertyName($"{Name}:{Signature}"); - writer.WriteStartObject(); - - Left.WriteProperty(writer); - Right.WriteProperty(writer); - - writer.WriteEndObject(); - } - else - { - Left.WriteProperty(writer); - Right.WriteProperty(writer); - } - } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - { - value = Uncomb(value); - - if (!(value is MichelinePrim pair) || pair.Prim != PrimType.Pair) - throw FormatException(value); - - if (pair.Args?.Count != 2) - throw new FormatException($"Invalid 'pair' prim args count"); - - if (Kind == PairKind.Object) - { - writer.WritePropertyName(Name); - writer.WriteStartObject(); - - Left.WriteProperty(writer, pair.Args[0]); - Right.WriteProperty(writer, pair.Args[1]); - - writer.WriteEndObject(); - } - else - { - Left.WriteProperty(writer, pair.Args[0]); - Right.WriteProperty(writer, pair.Args[1]); - } - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - if (Kind == PairKind.Object) - { - writer.WriteStartObject(); - - Left.WriteProperty(writer); - Right.WriteProperty(writer); - - writer.WriteEndObject(); - } - else - { - Left.WriteValue(writer); - Right.WriteValue(writer); - } - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - value = Uncomb(value); - - if (!(value is MichelinePrim pair) || pair.Prim != PrimType.Pair) - throw FormatException(value); - - if (pair.Args?.Count != 2) - throw new FormatException($"Invalid 'pair' prim args count"); - - if (Kind == PairKind.Object) - { - writer.WriteStartObject(); - - Left.WriteProperty(writer, pair.Args[0]); - Right.WriteProperty(writer, pair.Args[1]); - - writer.WriteEndObject(); - } - else - { - Left.WriteValue(writer, pair.Args[0]); - Right.WriteValue(writer, pair.Args[1]); - } - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteString("type", "object"); - - writer.WriteStartObject("properties"); - foreach (var child in Children()) - { - writer.WriteStartObject(child.Name); - child.WriteJsonSchema(writer); - writer.WriteEndObject(); - } - writer.WriteEndObject(); - - writer.WriteStartArray("required"); - foreach (var child in Children()) - writer.WriteStringValue(child.Name); - writer.WriteEndArray(); - - writer.WriteBoolean("additionalProperties", false); - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(2) { Left.ToMicheline(), Right.ToMicheline() }; - } - - IMicheline Uncomb(IMicheline value) - { - if (value is MichelineArray array) - { - value = new MichelinePrim - { - Prim = PrimType.Pair, - Args = array - }; - } - if (value is MichelinePrim p && p.Prim == PrimType.Pair && p.Args?.Count > 2) - { - value = new MichelinePrim - { - Prim = p.Prim, - Annots = p.Annots, - Args = new List(2) - { - p.Args[0], - new MichelinePrim - { - Prim = PrimType.Pair, - Args = p.Args.Skip(1).ToList() - } - } - }; - } - return value; - } - - IEnumerable Children() - { - if (Left is PairSchema leftPair && Left.Name == null) - { - foreach (var child in leftPair.Children()) - yield return child; - } - else - { - yield return Left; - } - - if (Right is PairSchema rightPair && Right.Name == null) - { - foreach (var child in rightPair.Children()) - yield return child; - } - else - { - yield return Right; - } - } - - IEnumerable<(Schema, IMicheline)> Children(IMicheline value) - { - value = Uncomb(value); - - if (!(value is MichelinePrim pair) || pair.Prim != PrimType.Pair) - throw FormatException(value); - - if (pair.Args?.Count != 2) - throw new FormatException($"Invalid 'pair' prim args count"); - - if (Left is PairSchema leftPair && Left.Name == null) - { - foreach (var child in leftPair.Children(pair.Args[0])) - yield return child; - } - else - { - yield return (Left, pair.Args[0]); - } - - if (Right is PairSchema rightPair && Right.Name == null) - { - foreach (var child in rightPair.Children(pair.Args[1])) - yield return child; - } - else - { - yield return (Right, pair.Args[1]); - } - } - - public override IMicheline Optimize(IMicheline value) - { - value = Uncomb(value); - if (value is MichelinePrim prim) - { - prim.Args[0] = Left.Optimize(prim.Args[0]); - prim.Args[1] = Right.Optimize(prim.Args[1]); - } - return value; - } - } - - public enum PairKind - { - Nested, - Object - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/PairSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/PairSchema.cs.meta deleted file mode 100644 index f8b64b8d..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/PairSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba6a647a947254775b9f64052831d8fc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ParameterSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ParameterSchema.cs deleted file mode 100644 index a2a32253..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ParameterSchema.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ParameterSchema : Schema - { - public override PrimType Prim => PrimType.parameter; - - public override string Signature => Schema.Signature; - - public Schema Schema { get; } - - public ParameterSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 - || !(micheline.Args[0] is MichelinePrim parameter)) - throw new FormatException($"Invalid {Prim} schema format"); - - Schema = Create(parameter); - } - - internal override void WriteProperty(Utf8JsonWriter writer) - { - Schema.WriteProperty(writer); - } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - { - Schema.WriteProperty(writer, value); - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - Schema.WriteValue(writer); - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - Schema.WriteJsonSchema(writer); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - Schema.WriteValue(writer, value); - } - - protected override List GetArgs() - { - return new List(1) { Schema.ToMicheline() }; - } - - public override IMicheline Optimize(IMicheline value) - { - return Schema.Optimize(value); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ParameterSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ParameterSchema.cs.meta deleted file mode 100644 index 0214d0ef..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ParameterSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 56bd7aa94f0c34b9e9369b4968f665f6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingStateSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/SaplingStateSchema.cs deleted file mode 100644 index e4b6db64..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingStateSchema.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class SaplingStateSchema : Schema - { - public override PrimType Prim => PrimType.sapling_state; - - public override string Signature => $"sapling_state:{MemoSize}"; - - public BigInteger MemoSize { get; } - - public SaplingStateSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelineInt micheInt)) - throw new FormatException($"Invalid {Prim} schema format"); - - MemoSize = micheInt.Value; - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (value is MichelineInt micheInt) - { - writer.WriteNumberValue((long)micheInt.Value); - } - else if (value is MichelineArray micheArray) - { - if (micheArray.Count > 0) - throw new NotImplementedException("At the time of creation there was no any documentation on possible values of sapling_state :("); - - writer.WriteStartArray(); - writer.WriteEndArray(); - } - else - { - throw FormatException(value); - } - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteStartArray("oneOf"); - { - writer.WriteStartObject(); - writer.WriteString("type", "integer"); - writer.WriteString("$comment", "int"); - writer.WriteEndObject(); - - writer.WriteStartObject(); - writer.WriteString("type", "array"); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(1) { new MichelineInt(MemoSize) }; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingStateSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/SaplingStateSchema.cs.meta deleted file mode 100644 index 0a334f15..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingStateSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7d908380734be4cc38b44f8628b893e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionDeprecatedSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionDeprecatedSchema.cs deleted file mode 100644 index 540476fd..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionDeprecatedSchema.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class SaplingTransactionDeprecatedSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.sapling_transaction_deprecated; - - public override string Signature => $"sapling_transaction_deprecated:{MemoSize}"; - - public BigInteger MemoSize { get; } - - public SaplingTransactionDeprecatedSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || micheline.Args[0] is not MichelineInt micheInt) - throw new FormatException($"Invalid {Prim} schema format"); - - MemoSize = micheInt.Value; - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override List GetArgs() - { - return new List(1) { new MichelineInt(MemoSize) }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionDeprecatedSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionDeprecatedSchema.cs.meta deleted file mode 100644 index 8af37311..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionDeprecatedSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 577e2925bfe55453896841300f912888 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionSchema.cs deleted file mode 100644 index 38df4be3..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionSchema.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class SaplingTransactionSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.sapling_transaction; - - public override string Signature => $"sapling_transaction:{MemoSize}"; - - public BigInteger MemoSize { get; } - - public SaplingTransactionSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelineInt micheInt)) - throw new FormatException($"Invalid {Prim} schema format"); - - MemoSize = micheInt.Value; - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineBytes micheBytes) - return Hex.Convert(micheBytes.Value); - - throw FormatException(value); - } - - protected override List GetArgs() - { - return new List(1) { new MichelineInt(MemoSize) }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case byte[] bytes: - return new MichelineBytes(bytes); - case string str: - if (!Hex.TryParse(str, out var b1)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b1); - case JsonElement json when json.ValueKind == JsonValueKind.String: - if (!Hex.TryParse(json.GetString(), out var b2)) - throw MapFailedException($"invalid hex string"); - return new MichelineBytes(b2); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionSchema.cs.meta deleted file mode 100644 index 48b1fb90..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SaplingTransactionSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e4ad5665e2aa14304974471378064459 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SetSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/SetSchema.cs deleted file mode 100644 index 4ba339c7..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SetSchema.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class SetSchema : Schema - { - public override PrimType Prim => PrimType.set; - - public override string Name => (Annot ?? Item.Annot ?? Prim.ToString()) + Suffix; - - public override string Signature => $"set:{Item.Signature}"; - - public Schema Item { get; } - - public SetSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelinePrim item)) - throw new FormatException($"Invalid {Prim} schema format"); - - Item = Create(item); - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - if (!(value is MichelineArray micheArray)) - throw FormatException(value); - - var treeView = base.GetTreeView(parent, value, name, schema); - - treeView.Children = new List(micheArray.Count); - for (int i = 0; i < micheArray.Count; i++) - treeView.Children.Add(Item.GetTreeView(treeView, micheArray[i], i.ToString())); - - return treeView; - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - writer.WriteStartArray(); - Item.WriteValue(writer); - writer.WriteEndArray(); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (value is MichelineArray micheArray) - { - writer.WriteStartArray(); - - foreach (var item in micheArray) - Item.WriteValue(writer, item); - - writer.WriteEndArray(); - } - else - { - throw FormatException(value); - } - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteString("type", "array"); - - writer.WriteStartObject("items"); - Item.WriteJsonSchema(writer); - writer.WriteEndObject(); - - writer.WriteString("$comment", Prim.ToString()); - } - - protected override List GetArgs() - { - return new List(1) { Item.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case IEnumerable e: - var arr1 = new MichelineArray(); - foreach (var item in e) - arr1.Add(Item.MapObject(item, true)); - return arr1; - - case JsonElement json when json.ValueKind == JsonValueKind.Array: - var arr2 = new MichelineArray(); - foreach (var item in json.EnumerateArray()) - arr2.Add(Item.MapObject(item, true)); - return arr2; - - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineArray micheArray) - { - var res = new MichelineArray(micheArray.Count); - foreach (var item in micheArray) - res.Add(Item.Optimize(item)); - return res; - } - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SetSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/SetSchema.cs.meta deleted file mode 100644 index 3012d420..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SetSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e3b60d520cd9d49a8a95cf211d930cff -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SignatureSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/SignatureSchema.cs deleted file mode 100644 index 7bd1c2dd..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SignatureSchema.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class SignatureSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.signature; - - public SignatureSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - if (micheBytes.Value.Length != 64) - return Hex.Convert(micheBytes.Value); - - return Base58.Convert(micheBytes.Value, Prefix.sig); - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineString micheStr) - { - byte[] res; - switch (micheStr.Value.Substring(0, 3)) - { - case "eds": - case "sps": - res = Base58.Parse(micheStr.Value, 5); - break; - case "p2s": - res = Base58.Parse(micheStr.Value, 4); - break; - case "sig": - res = Base58.Parse(micheStr.Value, 3); - break; - default: - throw FormatException(value); - } - return new MichelineBytes(res); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/SignatureSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/SignatureSchema.cs.meta deleted file mode 100644 index 76d47e39..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/SignatureSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6c86506abf100431994ca442203ec573 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/StorageSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/StorageSchema.cs deleted file mode 100644 index d9f6b6bf..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/StorageSchema.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class StorageSchema : Schema - { - public override PrimType Prim => PrimType.storage; - - public override string Signature => Schema.Signature; - - public Schema Schema { get; } - - public StorageSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 - || !(micheline.Args[0] is MichelinePrim storage)) - throw new FormatException($"Invalid {Prim} schema format"); - - Schema = Create(storage); - } - - internal override void WriteProperty(Utf8JsonWriter writer) - { - Schema.WriteProperty(writer); - } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - { - Schema.WriteProperty(writer, value); - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - Schema.WriteValue(writer); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - Schema.WriteValue(writer, value); - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - Schema.WriteJsonSchema(writer); - } - - protected override List GetArgs() - { - return new List(1) { Schema.ToMicheline() }; - } - - public override IMicheline Optimize(IMicheline value) - { - return Schema.Optimize(value); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/StorageSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/StorageSchema.cs.meta deleted file mode 100644 index 5b31c3c3..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/StorageSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 274c31a7f526f4dc9a11a5ccd0f575f8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/StringSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/StringSchema.cs deleted file mode 100644 index 9d75576b..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/StringSchema.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class StringSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.@string; - - public StringSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - return micheString.Value; - - throw FormatException(value); - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - return new MichelineString(str); - case JsonElement json when json.ValueKind == JsonValueKind.String: - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/StringSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/StringSchema.cs.meta deleted file mode 100644 index 4019fc7a..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/StringSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 89752a7b07f6b4446a85bf25a8988aec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/TicketSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/TicketSchema.cs deleted file mode 100644 index 62968559..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/TicketSchema.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class TicketSchema : Schema - { - public override PrimType Prim => PrimType.ticket; - - public Schema Data { get; } - - public TicketSchema(MichelinePrim micheline) : base(micheline) - { - if (micheline.Args?.Count != 1 || !(micheline.Args[0] is MichelinePrim type)) - throw new FormatException($"Invalid {Prim} schema format"); - - if (type.Annots == null) - type.Annots = new List(1); - - if (type.Annots.Count == 0) - type.Annots.Add(new FieldAnnotation("data")); - - var data = new MichelinePrim - { - Prim = PrimType.pair, - Args = new List(2) - { - new MichelinePrim - { - Prim = PrimType.address, - Annots = new List(1) { new FieldAnnotation("address") } - }, - new MichelinePrim - { - Prim = PrimType.pair, - Args = new List(2) - { - type, - new MichelinePrim - { - Prim = PrimType.nat, - Annots = new List(1) { new FieldAnnotation("amount") } - } - } - } - } - }; - - Data = Create(data); - } - - internal override TreeView GetTreeView(TreeView parent, IMicheline value, string name = null, Schema schema = null) - { - if (!(value is MichelinePrim prim) || prim.Prim != PrimType.Pair) - throw FormatException(value); - - return Data.GetTreeView(parent, value, name ?? Name, this); - } - - internal override void WriteValue(Utf8JsonWriter writer) - { - Data.WriteValue(writer); - } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (!(value is MichelinePrim prim) || prim.Prim != PrimType.Pair) - throw FormatException(value); - - Data.WriteValue(writer, prim); - } - - protected override List GetArgs() - { - var type = ((Data as PairSchema).Right as PairSchema).Left; - return new List(1) { type.ToMicheline() }; - } - - protected override IMicheline MapValue(object value) - { - return Data.MapObject(value, true); - } - - public override IMicheline Optimize(IMicheline value) - { - return Data.Optimize(value); - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/TicketSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/TicketSchema.cs.meta deleted file mode 100644 index 892c5937..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/TicketSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3f47490ae9de34f33befc131bb14f4cd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/TimestampSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/TimestampSchema.cs deleted file mode 100644 index 5e3b8534..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/TimestampSchema.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Numerics; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class TimestampSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.timestamp; - - public TimestampSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineInt micheInt) - { - if (micheInt.Value > 253_402_300_800 || micheInt.Value < -62_135_596_800) // DateTime overflow - return micheInt.Value.ToString(); - - return new DateTime(1970, 1, 1) - .AddSeconds((long)micheInt.Value) - .ToString("yyyy-MM-ddTHH:mm:ssZ"); - } - else if (value is MichelineString micheString) - { - if (BigInteger.TryParse(micheString.Value, out var seconds)) - { - if (seconds > 253_402_300_800 || seconds < -62_135_596_800) // DateTime overflow - return seconds.ToString(); - - return new DateTime(1970, 1, 1) - .AddSeconds((long)seconds) - .ToString("yyyy-MM-ddTHH:mm:ssZ"); - } - - if (DateTimeOffset.TryParse(micheString.Value, out var datetime)) - return datetime.ToString("yyyy-MM-ddTHH:mm:ssZ"); - - if (micheString.Value?.Length == 0) - return new DateTime(1970, 1, 1).ToString("yyyy-MM-ddTHH:mm:ssZ"); - - return micheString.Value; - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case DateTime dt: - // TODO: optimization - return new MichelineString(dt.ToString("yyyy-MM-ddTHH:mm:ssZ")); - case int i: - return new MichelineInt(new BigInteger(i)); - case long l: - return new MichelineInt(new BigInteger(l)); - case string s: - // TODO: validation & optimization - return new MichelineString(s); - case JsonElement json when json.ValueKind == JsonValueKind.Number: - // TODO: validation - return new MichelineInt(new BigInteger(json.GetInt64())); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineString micheStr) - { - if (BigInteger.TryParse(micheStr.Value, out var timestamp)) - return new MichelineInt(timestamp); - - if (DateTimeOffset.TryParse(micheStr.Value, out var datetime)) - { - var seconds = (long)(datetime - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds; - return new MichelineInt(new BigInteger(seconds)); - } - - if (micheStr.Value?.Length == 0) - return new MichelineInt(0); - - throw FormatException(value); - } - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/TimestampSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/TimestampSchema.cs.meta deleted file mode 100644 index b943677b..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/TimestampSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9106f24e2ad45483fb587d4d816ec0e6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/TxRollupL2AddressSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/TxRollupL2AddressSchema.cs deleted file mode 100644 index bec82a28..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/TxRollupL2AddressSchema.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class TxRollupL2AddressSchema : Schema, IFlat - { - public override PrimType Prim => PrimType.tx_rollup_l2_address; - - public TxRollupL2AddressSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - writer.WriteStringValue(Flatten(value)); - } - - public string Flatten(IMicheline value) - { - if (value is MichelineString micheString) - { - return micheString.Value; - } - else if (value is MichelineBytes micheBytes) - { - if (micheBytes.Value.Length != 20) - return Hex.Convert(micheBytes.Value); - - return Base58.Convert(micheBytes.Value, Prefix.tz4); - } - else - { - throw FormatException(value); - } - } - - protected override IMicheline MapValue(object value) - { - switch (value) - { - case string str: - // TODO: validation & optimization - return new MichelineString(str); - case byte[] bytes: - // TODO: validation - return new MichelineBytes(bytes); - case JsonElement json when json.ValueKind == JsonValueKind.String: - // TODO: validation & optimization - return new MichelineString(json.GetString()); - default: - throw MapFailedException("invalid value"); - } - } - - public override IMicheline Optimize(IMicheline value) - { - if (value is MichelineString micheStr) - return new MichelineBytes(Base58.Parse(micheStr.Value, 3)); - - return value; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/TxRollupL2AddressSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/TxRollupL2AddressSchema.cs.meta deleted file mode 100644 index 388704b8..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/TxRollupL2AddressSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c77429dea26c54e6f93b946156c76eb2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/UnitSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/UnitSchema.cs deleted file mode 100644 index e6bc1c2e..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/UnitSchema.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class UnitSchema : Schema - { - public override PrimType Prim => PrimType.unit; - - public UnitSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - { - if (value is MichelinePrim prim && prim.Prim == PrimType.Unit) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - else - { - throw FormatException(value); - } - } - - internal override void WriteJsonSchema(Utf8JsonWriter writer) - { - writer.WriteString("type", "object"); - writer.WriteBoolean("additionalProperties", false); - writer.WriteString("$comment", Prim.ToString()); - } - - public override IMicheline MapObject(object value, bool isValue = false) - { - return new MichelinePrim { Prim = PrimType.Unit }; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/UnitSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/UnitSchema.cs.meta deleted file mode 100644 index e80e3770..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/UnitSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cb9f8801fbb5242ffa517591af4e2d54 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ViewSchema.cs b/Assets/Scripts/Netezos/Contracts/Schemas/ViewSchema.cs deleted file mode 100644 index 3ffee733..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ViewSchema.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Text.Json; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public sealed class ViewSchema : Schema - { - public override PrimType Prim => PrimType.view; - - public ViewSchema(MichelinePrim micheline) : base(micheline) { } - - internal override void WriteProperty(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - internal override void WriteValue(Utf8JsonWriter writer, IMicheline value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - public override IMicheline MapObject(object obj, bool isValue = false) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - - protected override IMicheline MapValue(object value) - => throw new InvalidOperationException($"Value of type {Prim} is not allowed"); - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Schemas/ViewSchema.cs.meta b/Assets/Scripts/Netezos/Contracts/Schemas/ViewSchema.cs.meta deleted file mode 100644 index dff963cb..00000000 --- a/Assets/Scripts/Netezos/Contracts/Schemas/ViewSchema.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 24d61c8b284de4576b333e6c7aafd2a1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/TreeView.cs b/Assets/Scripts/Netezos/Contracts/TreeView.cs deleted file mode 100644 index 39bb31af..00000000 --- a/Assets/Scripts/Netezos/Contracts/TreeView.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Collections.Generic; -using Netezos.Encoding; - -namespace Netezos.Contracts -{ - public class TreeView - { - public string Name { get; set; } - public Schema Schema { get; set; } - public IMicheline Value { get; set; } - - public TreeView Parent { get; set; } - public List Children { get; set; } - - public string Path - { - get - { - if (Parent == null) - return string.Empty; - - if (Parent.Schema is OptionSchema) - return Parent.Path; - - var path = Parent.Path; - return path.Length == 0 ? Name : $"{path}.{Name}"; - } - } - - public IEnumerable Nodes() - { - yield return this; - if (Children != null) - foreach (var child in Children) - foreach (var item in child.Nodes()) - yield return item; - } - - public IEnumerable Leafs() - { - if (Children == null) - { - yield return this; - } - else - { - foreach (var child in Children) - foreach (var item in child.Leafs()) - yield return item; - } - } - - public override string ToString() => $"{Path}: {Schema.Prim}[{Children?.Count}]"; - } -} diff --git a/Assets/Scripts/Netezos/Contracts/TreeView.cs.meta b/Assets/Scripts/Netezos/Contracts/TreeView.cs.meta deleted file mode 100644 index f9e33616..00000000 --- a/Assets/Scripts/Netezos/Contracts/TreeView.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2a03575bc79e24fefa39ea42a8a3b892 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Tzips.meta b/Assets/Scripts/Netezos/Contracts/Tzips.meta deleted file mode 100644 index 35040ddb..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 894be70f2c6434577995622698f9ea7e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip12.cs b/Assets/Scripts/Netezos/Contracts/Tzips/Tzip12.cs deleted file mode 100644 index fad0769e..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip12.cs +++ /dev/null @@ -1,57 +0,0 @@ -namespace Netezos.Contracts -{ - public static class Tzip12 - { - public static bool IsFA2(this ContractScript contract) - { - return contract.Entrypoints.TryGetValue("transfer", out var transfer) && CheckTransfer(transfer) - && contract.Entrypoints.TryGetValue("balance_of", out var balanceOf) && CheckBalanceOf(balanceOf) - && contract.Entrypoints.TryGetValue("update_operators", out var updateOperators) && CheckUpdateOperators(updateOperators); - } - - static bool CheckTransfer(Schema schema) - { - return schema is ListSchema list1 - && list1.Item is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is ListSchema list2 - && list2.Item is PairSchema pair2 - && pair2.Left is AddressSchema - && pair2.Right is PairSchema pair3 - && pair3.Left is NatSchema - && pair3.Right is NatSchema; - } - - static bool CheckBalanceOf(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is ListSchema list1 - && list1.Item is PairSchema pair2 - && pair2.Left is AddressSchema - && pair2.Right is NatSchema - && pair1.Right is ContractSchema contract - && contract.Parameters is ListSchema list2 - && list2.Item is PairSchema pair3 - && pair3.Left is PairSchema pair4 - && pair4.Left is AddressSchema - && pair4.Right is NatSchema - && pair3.Right is NatSchema; - } - - static bool CheckUpdateOperators(Schema schema) - { - return schema is ListSchema list1 - && list1.Item is OrSchema or - && or.Left is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is PairSchema pair2 - && pair2.Left is AddressSchema - && pair2.Right is NatSchema - && or.Right is PairSchema pair3 - && pair3.Left is AddressSchema - && pair3.Right is PairSchema pair4 - && pair4.Left is AddressSchema - && pair4.Right is NatSchema; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip12.cs.meta b/Assets/Scripts/Netezos/Contracts/Tzips/Tzip12.cs.meta deleted file mode 100644 index a60a4dcb..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip12.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c02cf557b0ac4fa9bf436ac86d13ecc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip5.cs b/Assets/Scripts/Netezos/Contracts/Tzips/Tzip5.cs deleted file mode 100644 index 8c2dca17..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip5.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Netezos.Contracts -{ - public static class Tzip5 - { - public static bool IsFA1(this ContractScript contract) - { - return contract.Entrypoints.TryGetValue("transfer", out var transfer) && CheckTransfer(transfer) - && contract.Entrypoints.TryGetValue("getBalance", out var getBalance) && CheckGetBalance(getBalance) - && contract.Entrypoints.TryGetValue("getTotalSupply", out var getTotalSupply) && CheckGetTotalSupply(getTotalSupply); - } - - static bool CheckTransfer(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is PairSchema pair2 - && pair2.Left is AddressSchema - && pair2.Right is NatSchema; - } - - static bool CheckGetBalance(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is ContractSchema contract - && contract.Parameters is NatSchema; - } - - static bool CheckGetTotalSupply(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is UnitSchema - && pair1.Right is ContractSchema contract - && contract.Parameters is NatSchema; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip5.cs.meta b/Assets/Scripts/Netezos/Contracts/Tzips/Tzip5.cs.meta deleted file mode 100644 index 122abcb2..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip5.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 38c1a9a3c725245c1bed47bbc7eed9e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip7.cs b/Assets/Scripts/Netezos/Contracts/Tzips/Tzip7.cs deleted file mode 100644 index 4def3879..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip7.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace Netezos.Contracts -{ - public static class Tzip7 - { - public static bool IsFA12(this ContractScript contract) - { - return contract.Entrypoints.TryGetValue("transfer", out var transfer) && CheckTransfer(transfer) - && contract.Entrypoints.TryGetValue("approve", out var approve) && CheckApprove(approve) - && contract.Entrypoints.TryGetValue("getAllowance", out var getAllowance) && CheckGetAllowance(getAllowance) - && contract.Entrypoints.TryGetValue("getBalance", out var getBalance) && CheckGetBalance(getBalance) - && contract.Entrypoints.TryGetValue("getTotalSupply", out var getTotalSupply) && CheckGetTotalSupply(getTotalSupply); - } - - static bool CheckTransfer(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is PairSchema pair2 - && pair2.Left is AddressSchema - && pair2.Right is NatSchema; - } - - static bool CheckApprove(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is NatSchema; - } - - static bool CheckGetAllowance(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is PairSchema pair2 - && pair2.Left is AddressSchema - && pair2.Right is AddressSchema - && pair1.Right is ContractSchema contract - && contract.Parameters is NatSchema; - } - - static bool CheckGetBalance(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is AddressSchema - && pair1.Right is ContractSchema contract - && contract.Parameters is NatSchema; - } - - static bool CheckGetTotalSupply(Schema schema) - { - return schema is PairSchema pair1 - && pair1.Left is UnitSchema - && pair1.Right is ContractSchema contract - && contract.Parameters is NatSchema; - } - } -} diff --git a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip7.cs.meta b/Assets/Scripts/Netezos/Contracts/Tzips/Tzip7.cs.meta deleted file mode 100644 index 52efd4a7..00000000 --- a/Assets/Scripts/Netezos/Contracts/Tzips/Tzip7.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f5ef6026ef0894fa9b14198328ee4d41 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding.meta b/Assets/Scripts/Netezos/Encoding.meta deleted file mode 100644 index 3db36b25..00000000 --- a/Assets/Scripts/Netezos/Encoding.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4f17c8094258c49cb89f2883f487c5e9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Base58.cs b/Assets/Scripts/Netezos/Encoding/Base58.cs deleted file mode 100644 index 65ed8f4a..00000000 --- a/Assets/Scripts/Netezos/Encoding/Base58.cs +++ /dev/null @@ -1,192 +0,0 @@ -using System; -using System.Numerics; -using System.Security.Cryptography; - -namespace Netezos.Encoding -{ - public static class Base58 - { - const string Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - static readonly byte[] Base58Ascii = new byte[] - { - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 255, 255, 255, 255, 255, 255, 255, 9, 10, 11, - 12, 13, 14, 15, 16, 255, 17, 18, 19, 20, 21, 255, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 255, 255, 255, 255, 255, 255, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 255, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, - }; - - static byte[] CheckSum(byte[] data) - { - using (var shA256 = new SHA256Managed()) - { - var hash1 = shA256.ComputeHash(data); - var hash2 = shA256.ComputeHash(hash1); - return new[] { hash2[0], hash2[1], hash2[2], hash2[3] }; - } - } - - static byte[] VerifyAndRemoveCheckSum(byte[] bytes) - { - var data = bytes.GetBytes(0, bytes.Length - 4); - - var checkSum = CheckSum(data); - if (bytes[bytes.Length - 4] != checkSum[0] || - bytes[bytes.Length - 3] != checkSum[1] || - bytes[bytes.Length - 2] != checkSum[2] || - bytes[bytes.Length - 1] != checkSum[3]) - throw new FormatException("Checksum is invalid"); - - return data; - } - - static bool TryVerifyAndRemoveCheckSum(byte[] bytes, out byte[] res) - { - res = null; - if (bytes.Length < 4) - return false; - - var data = bytes.GetBytes(0, bytes.Length - 4); - - var checkSum = CheckSum(data); - if (bytes[bytes.Length - 4] != checkSum[0] || - bytes[bytes.Length - 3] != checkSum[1] || - bytes[bytes.Length - 2] != checkSum[2] || - bytes[bytes.Length - 1] != checkSum[3]) - return false; - - res = data; - return true; - } - - static string EncodePlain(byte[] bytes) - { - var bigInt = new BigInteger((bytes[0] >= 128 - ? new byte[] { 0 }.Concat(bytes) - : bytes).Reverse()); - - var str = ""; - while (bigInt > 0) - { - str = Alphabet[(int)(bigInt % 58)] + str; - bigInt /= 58; - } - - var i = 0; - while (bytes[i++] == 0) - str = "1" + str; - - return str; - } - - static byte[] DecodePlain(string base58) - { - BigInteger bigInt = 0; - for (int i = 0; i < base58.Length; ++i) - { - if (base58[i] >= Base58Ascii.Length) - throw new FormatException($"Invalid Base58 string"); - - var num = Base58Ascii[base58[i]]; - if (num == 255) throw new FormatException($"Invalid Base58 string"); - bigInt = bigInt * 58 + num; - } - - var cnt = -1; - while (base58[++cnt] == '1') ; - - var bytes = bigInt.ToByteArray().Reverse(); - return new byte[cnt].Concat(bytes[0] == 0 ? bytes.GetBytes(1, bytes.Length - 1) : bytes); - } - - static bool TryDecodePlain(string base58, out byte[] res) - { - BigInteger bigInt = 0; - res = null; - - for (int i = 0; i < base58.Length; ++i) - { - if (base58[i] >= Base58Ascii.Length) - return false; - - var num = Base58Ascii[base58[i]]; - if (num == 255) return false; - bigInt = bigInt * 58 + num; - } - - var cnt = -1; - while (base58[++cnt] == '1') ; - - var bytes = bigInt.ToByteArray().Reverse(); - res = new byte[cnt].Concat(bytes[0] == 0 ? bytes.GetBytes(1, bytes.Length - 1) : bytes); - return true; - } - - public static byte[] Parse(string base58) - { - return VerifyAndRemoveCheckSum(DecodePlain(base58)); - } - - public static byte[] Parse(string base58, byte[] prefix) - { - var bytes = VerifyAndRemoveCheckSum(DecodePlain(base58)); - return bytes.GetBytes(prefix.Length, bytes.Length - prefix.Length); - } - - public static byte[] Parse(string base58, int prefixLength) - { - var bytes = VerifyAndRemoveCheckSum(DecodePlain(base58)); - return bytes.GetBytes(prefixLength, bytes.Length - prefixLength); - } - - public static bool TryParse(string base58, out byte[] bytes) - { - bytes = null; - - if (string.IsNullOrEmpty(base58)) - return false; - - return TryDecodePlain(base58, out var data) && TryVerifyAndRemoveCheckSum(data, out bytes); - } - - - public static bool TryParse(string base58, byte[] prefix, out byte[] bytes) - { - bytes = null; - - if (!TryParse(base58, out var data)) - return false; - - if (prefix == null) - return false; - - if (prefix.Length >= data.Length) - return false; - - bytes = data.GetBytes(prefix.Length, data.Length - prefix.Length); - return true; - } - - public static string Convert(byte[] bytes) - { - return EncodePlain(bytes.Concat(CheckSum(bytes))); - } - - public static string Convert(byte[] bytes, byte[] prefix) - { - var data = prefix.Concat(bytes); - return EncodePlain(data.Concat(CheckSum(data))); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Encoding/Base58.cs.meta b/Assets/Scripts/Netezos/Encoding/Base58.cs.meta deleted file mode 100644 index 444166cb..00000000 --- a/Assets/Scripts/Netezos/Encoding/Base58.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9062a1e1fdf6243d891c6febcaa672ba -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Base64.cs b/Assets/Scripts/Netezos/Encoding/Base64.cs deleted file mode 100644 index 478d0c2e..00000000 --- a/Assets/Scripts/Netezos/Encoding/Base64.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Netezos.Encoding -{ - public static class Base64 - { - public static byte[] Parse(string base64) - { - return System.Convert.FromBase64String(base64); - } - - public static bool TryParse(string base64, out byte[] bytes) - { - try - { - bytes = System.Convert.FromBase64String(base64); - return true; - } - catch - { - bytes = null; - return false; - } - } - - public static string Convert(byte[] bytes) - { - return System.Convert.ToBase64String(bytes); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Encoding/Base64.cs.meta b/Assets/Scripts/Netezos/Encoding/Base64.cs.meta deleted file mode 100644 index 81ca4788..00000000 --- a/Assets/Scripts/Netezos/Encoding/Base64.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a6f08f67b231a467aa2aa4a9038db04c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Hex.cs b/Assets/Scripts/Netezos/Encoding/Hex.cs deleted file mode 100644 index b425b284..00000000 --- a/Assets/Scripts/Netezos/Encoding/Hex.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Netezos.Encoding -{ - public static class Hex - { - private static readonly int[] HexAscii = new[] - { - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 - }; - - public static string Convert(byte[] bytes) - { - var chars = new char[bytes.Length << 1]; - - for (int i = 0, j = 0; i < bytes.Length; ++i) - { - var l = bytes[i] & 15; - var h = bytes[i] >> 4; - - chars[j++] = (char)(h + (h > 9 ? 87 : 48)); - chars[j++] = (char)(l + (l > 9 ? 87 : 48)); - } - - return new string(chars); - } - - public static string Convert(IEnumerable bytes) - { - var chars = new char[bytes.Count() << 1]; - var pos = 0; - - foreach (var b in bytes) - { - var l = b & 15; - var h = b >> 4; - - chars[pos++] = (char)(h + (h > 9 ? 87 : 48)); - chars[pos++] = (char)(l + (l > 9 ? 87 : 48)); - } - - return new string(chars); - } - - public static byte[] Parse(string hex) - { - if (hex == null) - throw new ArgumentNullException(nameof(hex)); - - if (hex.Length % 2 > 0) - throw new FormatException("Invalid hex string"); - - if (hex.Length == 0) - return Array.Empty(); - - var pos = hex[0] == '0' && hex[1] == 'x' ? 2 : 0; - byte[] bytes = new byte[(hex.Length - pos) >> 1]; - - for (int h, l, i = 0; i < bytes.Length; i++, pos += 2) - { - h = HexAscii[hex[pos]]; - l = HexAscii[hex[pos + 1]]; - - if ((h | l) == 255) - throw new FormatException("Invalid hex string"); - - bytes[i] = (byte)((h << 4) + l); - } - - return bytes; - } - - public static bool TryParse(string hex, out byte[] bytes) - { - bytes = null; - - if (hex == null) - return false; - - if (hex.Length % 2 > 0) - return false; - - if (hex.Length == 0) - { - bytes = Array.Empty(); - return true; - } - - var pos = hex[0] == '0' && hex[1] == 'x' ? 2 : 0; - bytes = new byte[(hex.Length - pos) >> 1]; - - for (int h, l, i = 0; i < bytes.Length; ++i, pos += 2) - { - h = HexAscii[hex[pos]]; - l = HexAscii[hex[pos + 1]]; - - if ((h | l) == 255) - return false; - - bytes[i] = (byte)((h << 4) + l); - } - - return true; - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Hex.cs.meta b/Assets/Scripts/Netezos/Encoding/Hex.cs.meta deleted file mode 100644 index 29c50e49..00000000 --- a/Assets/Scripts/Netezos/Encoding/Hex.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9e4242a6586d0454985163b4cacb8904 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline.meta b/Assets/Scripts/Netezos/Encoding/Micheline.meta deleted file mode 100644 index 9e833e87..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 293510f03e3164826a9726725c8e0454 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract.meta deleted file mode 100644 index b4f8b8dc..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 183adf505c3014541a09a9a5b275a5ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Annotation.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Annotation.cs deleted file mode 100644 index 0959014a..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Annotation.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Netezos.Encoding.Serialization; - -namespace Netezos.Encoding -{ - [InterfaceJsonConverter(typeof(AnnotationConverter))] - public interface IAnnotation - { - AnnotationType Type { get; } - string Value { get; } - } - - public enum AnnotationType : byte - { - Unsafe = 0b_0000_0000, - Field = 0b_0100_0000, - Type = 0b_1000_0000, - Variable = 0b_1100_0000 - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Annotation.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Annotation.cs.meta deleted file mode 100644 index 02d387fa..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Annotation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a2fdd95e531144b9b84d20ba522a453e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Micheline.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Micheline.cs deleted file mode 100644 index 8b9c664a..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Micheline.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.IO; -using Netezos.Encoding.Serialization; - -namespace Netezos.Encoding -{ - [InterfaceJsonConverter(typeof(MichelineConverter))] - public interface IMicheline - { - MichelineType Type { get; } - - void Write(BinaryWriter writer, int depth = 0); - } - - public enum MichelineType : byte - { - Int = 0b_0000_0000, - Bytes = 0b_0010_0000, - String = 0b_0100_0000, - Array = 0b_0110_0000, - Prim = 0b_1000_0000 - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Micheline.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Micheline.cs.meta deleted file mode 100644 index 38dff5ba..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/Micheline.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6fb295e65902f45e7873dffa471467e3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/PrimType.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/PrimType.cs deleted file mode 100644 index a4444841..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/PrimType.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System.Text.Json.Serialization; -using Netezos.Encoding.Serialization; - -namespace Netezos.Encoding -{ - [JsonConverter(typeof(PrimTypeConverter))] - public enum PrimType : byte - { - parameter, - storage, - code, - False, - Elt, - Left, - None, - Pair, - Right, - Some, - True, - Unit, - PACK, - UNPACK, - BLAKE2B, - SHA256, - SHA512, - ABS, - ADD, - AMOUNT, - AND, - BALANCE, - CAR, - CDR, - CHECK_SIGNATURE, - COMPARE, - CONCAT, - CONS, - CREATE_ACCOUNT, - CREATE_CONTRACT, - IMPLICIT_ACCOUNT, - DIP, - DROP, - DUP, - EDIV, - EMPTY_MAP, - EMPTY_SET, - EQ, - EXEC, - FAILWITH, - GE, - GET, - GT, - HASH_KEY, - IF, - IF_CONS, - IF_LEFT, - IF_NONE, - INT, - LAMBDA, - LE, - LEFT, - LOOP, - LSL, - LSR, - LT, - MAP, - MEM, - MUL, - NEG, - NEQ, - NIL, - NONE, - NOT, - NOW, - OR, - PAIR, - PUSH, - RIGHT, - SIZE, - SOME, - SOURCE, - SENDER, - SELF, - STEPS_TO_QUOTA, - SUB, - SWAP, - TRANSFER_TOKENS, - SET_DELEGATE, - UNIT, - UPDATE, - XOR, - ITER, - LOOP_LEFT, - ADDRESS, - CONTRACT, - ISNAT, - CAST, - RENAME, - @bool, - contract, - @int, - key, - key_hash, - lambda, - list, - map, - big_map, - nat, - option, - or, - pair, - set, - signature, - @string, - bytes, - mutez, - timestamp, - unit, - operation, - address, - SLICE, - DIG, - DUG, - EMPTY_BIG_MAP, - APPLY, - chain_id, - CHAIN_ID, - LEVEL, - SELF_ADDRESS, - never, - NEVER, - UNPAIR, - VOTING_POWER, - TOTAL_VOTING_POWER, - KECCAK, - SHA3, - PAIRING_CHECK, - bls12_381_g1, - bls12_381_g2, - bls12_381_fr, - sapling_state, - sapling_transaction_deprecated, - SAPLING_EMPTY_STATE, - SAPLING_VERIFY_UPDATE, - ticket, - TICKET, - READ_TICKET, - SPLIT_TICKET, - JOIN_TICKETS, - GET_AND_UPDATE, - chest, - chest_key, - OPEN_CHEST, - VIEW, - view, - constant, - SUB_MUTEZ, - tx_rollup_l2_address, - MIN_BLOCK_TIME, - sapling_transaction - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/PrimType.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/PrimType.cs.meta deleted file mode 100644 index 11cf4f03..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Abstract/PrimType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 53581743013be45688cf839ffec5f52a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations.meta deleted file mode 100644 index da27f196..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5f04fe25b52af497d9ec7fc307995a58 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/FieldAnnotation.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/FieldAnnotation.cs deleted file mode 100644 index 57f22797..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/FieldAnnotation.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Netezos.Encoding -{ - public class FieldAnnotation : IAnnotation - { - public const char Prefix = '%'; - - public AnnotationType Type => AnnotationType.Field; - - public string Value { get; set; } - - public FieldAnnotation(string value) => Value = value; - - public override string ToString() => $"{Prefix}{Value}"; - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/FieldAnnotation.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/FieldAnnotation.cs.meta deleted file mode 100644 index bfc9c58f..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/FieldAnnotation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cd1cb6bcd31414b53881f9e13dc35f70 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/TypeAnnotation.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/TypeAnnotation.cs deleted file mode 100644 index 31b3d725..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/TypeAnnotation.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Netezos.Encoding -{ - public class TypeAnnotation : IAnnotation - { - public const char Prefix = ':'; - - public AnnotationType Type => AnnotationType.Type; - - public string Value { get; set; } - - public TypeAnnotation(string value) => Value = value; - - public override string ToString() => $"{Prefix}{Value}"; - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/TypeAnnotation.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/TypeAnnotation.cs.meta deleted file mode 100644 index c97bc2e6..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/TypeAnnotation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: aabcf14a5172b4626953fadfab25145a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/UnsafeAnnotation.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/UnsafeAnnotation.cs deleted file mode 100644 index 1c3bdf5c..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/UnsafeAnnotation.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Netezos.Encoding -{ - public class UnsafeAnnotation : IAnnotation - { - public AnnotationType Type => AnnotationType.Unsafe; - - public string Value { get; set; } - - public UnsafeAnnotation(string value) => Value = value; - - public override string ToString() => Value; - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/UnsafeAnnotation.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/UnsafeAnnotation.cs.meta deleted file mode 100644 index f4ab01f3..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/UnsafeAnnotation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ec30341512acf4da6a9db95321b7110a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/VariableAnnotation.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/VariableAnnotation.cs deleted file mode 100644 index 1dc2d4e0..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/VariableAnnotation.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Netezos.Encoding -{ - public class VariableAnnotation : IAnnotation - { - public const char Prefix = '@'; - - public AnnotationType Type => AnnotationType.Variable; - - public string Value { get; set; } - - public VariableAnnotation(string value) => Value = value; - - public override string ToString() => $"{Prefix}{Value}"; - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/VariableAnnotation.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/VariableAnnotation.cs.meta deleted file mode 100644 index 098f5216..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Annotations/VariableAnnotation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 85aff784988674b4096b1065dfb14f39 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Micheline.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Micheline.cs deleted file mode 100644 index 872d191d..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Micheline.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.IO; -using System.Text.Json; -using System.Text.Json.Serialization; -using Netezos.Encoding.Serialization; -using Netezos.Forging; - -namespace Netezos.Encoding -{ - public static class Micheline - { - internal const int MaxRecursionDepth = 512; - - static readonly JsonSerializerOptions SerializerOptions = new() - { - MaxDepth = 100_000, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - }; - - public static IMicheline FromJson(string json) - => JsonSerializer.Deserialize(json, SerializerOptions); - - public static IMicheline FromJson(string json, JsonSerializerOptions options) - => JsonSerializer.Deserialize(json, options); - - public static IMicheline FromJson(JsonElement json) - => JsonSerializer.Deserialize(json.GetRawText(), SerializerOptions); - - public static IMicheline FromJson(JsonElement json, JsonSerializerOptions options) - => JsonSerializer.Deserialize(json.GetRawText(), options); - - public static IMicheline FromBytes(byte[] bytes) - { - using var mem = new MemoryStream(bytes); - using var bin = new BinaryReader(mem); - return MichelineBinaryConverter.Read(bin); - } - - public static IMicheline Unpack(byte[] bytes) - { - if (bytes[0] != 5) - throw new FormatException("Packed bytes should start with 0x05"); - - using var reader = new ForgedReader(bytes.GetBytes(1, bytes.Length - 1)); - return LocalForge.UnforgeMicheline(reader); - } - - public static string ToMichelson(this IMicheline micheline) - => MichelsonFormatter.MichelineToMichelson(micheline); - - public static string ToJson(this IMicheline micheline) - => JsonSerializer.Serialize(micheline, SerializerOptions); - - public static string ToJson(this IMicheline micheline, JsonSerializerOptions options) - => JsonSerializer.Serialize(micheline, options); - - public static string ToJson(byte[] bytes, JsonWriterOptions options = default) - { - using var mem = new MemoryStream(bytes); - using var reader = new BinaryReader(mem); - using var res = new MemoryStream(); - using var writer = new Utf8JsonWriter(res, options); - - MichelineBinaryConverter.ReadToJson(reader, writer); - writer.Flush(); - - return Utf8.Convert(res.ToArray()); - } - - public static byte[] ToBytes(this IMicheline micheline) - { - using var mem = new MemoryStream(); - using var bin = new BinaryWriter(mem); - - micheline.Write(bin); - bin.Flush(); - - return mem.ToArray(); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Micheline.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Micheline.cs.meta deleted file mode 100644 index 02ca81c6..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Micheline.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 88a34e62a33c04379adee61364c5d16c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes.meta deleted file mode 100644 index e3fe219d..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 88409de36b8bf407db1ddeb5245150ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineArray.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineArray.cs deleted file mode 100644 index 6ded2801..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineArray.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Text.Json.Serialization; -using Netezos.Encoding.Serialization; - -namespace Netezos.Encoding -{ - public class MichelineArray : List, IMicheline - { - [JsonIgnore] - public MichelineType Type => MichelineType.Array; - - public MichelineArray() : base() { } - public MichelineArray(int capacity) : base(capacity) { } - - public void Write(BinaryWriter writer, int depth = 0) - { - if (Count >= 0x1F) - { - writer.Write((byte)((int)Type | 0x1F)); - writer.Write7BitInt(Count); - } - else - { - writer.Write((byte)((int)Type | Count)); - } - - if (depth < Micheline.MaxRecursionDepth) - { - foreach (var item in this) - item.Write(writer, depth + 1); - } - else - { - foreach (var item in this) - MichelineBinaryConverter.WriteFlat(writer, item); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineArray.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineArray.cs.meta deleted file mode 100644 index a1dfa258..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineArray.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3c01ac2e610914e6b9e09424395a8835 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineBytes.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineBytes.cs deleted file mode 100644 index 90f518f3..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineBytes.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.IO; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding -{ - public class MichelineBytes : IMicheline - { - [JsonIgnore] - public MichelineType Type => MichelineType.Bytes; - - [JsonPropertyName("bytes")] - [JsonConverter(typeof(HexConverter))] - public byte[] Value { get; set; } - - public MichelineBytes(byte[] value) => Value = value; - - public void Write(BinaryWriter writer, int depth = 0) - { - var len = Value.Length; - - if (len >= 0x1F) - { - writer.Write((byte)((int)Type | 0x1F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)Type | len)); - } - - writer.Write(Value); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineBytes.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineBytes.cs.meta deleted file mode 100644 index bdbd8d31..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineBytes.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e85291ea7fa9e43f6a374dd63890bf47 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineInt.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineInt.cs deleted file mode 100644 index 5c87cead..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineInt.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.IO; -using System.Numerics; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding -{ - public class MichelineInt : IMicheline - { - [JsonIgnore] - public MichelineType Type => MichelineType.Int; - - [JsonPropertyName("int")] - public BigInteger Value { get; set; } - - public MichelineInt(BigInteger value) => Value = value; - - public void Write(BinaryWriter writer, int depth = 0) - { - var bytes = Value.ToByteArray(); - var len = bytes.Length; - - if (len >= 0x1F) - { - writer.Write((byte)((int)Type | 0x1F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)Type | len)); - } - - writer.Write(bytes); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineInt.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineInt.cs.meta deleted file mode 100644 index 6f33bccb..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineInt.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a6d2721e1e7974425abadc540221a081 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelinePrim.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelinePrim.cs deleted file mode 100644 index 665d00f6..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelinePrim.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Text.Json.Serialization; -using Netezos.Encoding.Serialization; - -namespace Netezos.Encoding -{ - public class MichelinePrim : IMicheline - { - [JsonIgnore] - public MichelineType Type => MichelineType.Prim; - - [JsonPropertyName("prim")] - public PrimType Prim { get; set; } - - [JsonPropertyName("args")] - public List Args { get; set; } - - [JsonPropertyName("annots")] - public List Annots { get; set; } - - public void Write(BinaryWriter writer, int depth = 0) - { - var argsCount = false; - var annotsCount = false; - - var tag = (int)Type; - if (Args?.Count > 0) - { - if (Args.Count >= 0x07) - { - tag |= 0x70; - argsCount = true; - } - else - { - tag |= Args.Count << 4; - } - } - - if (Annots?.Count > 0) - { - if (Annots.Count >= 0x0F) - { - tag |= 0x0F; - annotsCount = true; - } - else - { - tag |= Annots.Count; - } - } - - writer.Write((byte)tag); - writer.Write((byte)Prim); - - if (Args != null) - { - if (argsCount) - writer.Write7BitInt(Args.Count); - - if (depth < Micheline.MaxRecursionDepth) - { - foreach (var arg in Args) - arg.Write(writer, depth + 1); - } - else - { - foreach (var arg in Args) - MichelineBinaryConverter.WriteFlat(writer, arg); - } - } - - if (Annots != null) - { - if (annotsCount) - writer.Write7BitInt(Annots.Count); - - foreach (var annot in Annots) - WriteAnnotation(writer, annot); - } - } - - void WriteAnnotation(BinaryWriter writer, IAnnotation annot) - { - var bytes = Utf8.Parse(annot.Value); - var len = bytes.Length; - - if (len >= 0x3F) - { - writer.Write((byte)((int)annot.Type | 0x3F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)annot.Type | len)); - } - - writer.Write(bytes); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelinePrim.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelinePrim.cs.meta deleted file mode 100644 index 4f901aa9..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelinePrim.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c95180d3adb534c169f424ca7f800a9e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineString.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineString.cs deleted file mode 100644 index dfafcf90..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineString.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.IO; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding -{ - public class MichelineString : IMicheline - { - [JsonIgnore] - public MichelineType Type => MichelineType.String; - - [JsonPropertyName("string")] - public string Value { get; set; } - - public MichelineString(string value) => Value = value; - - public void Write(BinaryWriter writer, int depth = 0) - { - var bytes = Utf8.Parse(Value); - var len = bytes.Length; - - if (len >= 0x1F) - { - writer.Write((byte)((int)Type | 0x1F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)Type | len)); - } - - writer.Write(bytes); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineString.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineString.cs.meta deleted file mode 100644 index 7db3f6ee..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Nodes/MichelineString.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 52547360ba4c642079648700fff881ba -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization.meta deleted file mode 100644 index 0fb04e5e..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5cb53b533ec1e450288335c982fc0f78 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/AnnotationConverter.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/AnnotationConverter.cs deleted file mode 100644 index 1d4a08fe..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/AnnotationConverter.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding.Serialization -{ - public class AnnotationConverter : JsonConverter - { - internal static IAnnotation ParseAnnotation(string annot) - { - if (annot.Length == 0) - return new UnsafeAnnotation(annot); - - return annot[0] switch - { - '%' => new FieldAnnotation(annot.Substring(1)), - ':' => new TypeAnnotation(annot.Substring(1)), - '@' => new VariableAnnotation(annot.Substring(1)), - _ => new UnsafeAnnotation(annot) - }; - } - - public override IAnnotation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return ParseAnnotation(reader.GetString()); - } - - public override void Write(Utf8JsonWriter writer, IAnnotation value, JsonSerializerOptions options) - { - writer.WriteStringValue(value?.ToString()); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/AnnotationConverter.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/AnnotationConverter.cs.meta deleted file mode 100644 index cfb396c7..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/AnnotationConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 55cfe07a9ca574f96bbaae5b386d5f5b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/InterfaceJsonConverter.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/InterfaceJsonConverter.cs deleted file mode 100644 index 6a3fd34f..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/InterfaceJsonConverter.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding.Serialization -{ - /// - /// This is a workaround for https://github.com/dotnet/runtime/issues/33112 - /// - [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false)] - public class InterfaceJsonConverterAttribute : JsonConverterAttribute - { - public InterfaceJsonConverterAttribute(Type converterType) : base(converterType) { } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/InterfaceJsonConverter.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/InterfaceJsonConverter.cs.meta deleted file mode 100644 index 4416b626..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/InterfaceJsonConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 19c7148fcbc3446768d655a64a8700e3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineBinaryConverter.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineBinaryConverter.cs deleted file mode 100644 index efbb7d30..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineBinaryConverter.cs +++ /dev/null @@ -1,585 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Numerics; -using System.Text.Json; - -namespace Netezos.Encoding.Serialization -{ - static class MichelineBinaryConverter - { - public static IMicheline Read(BinaryReader reader, int depth = 0) - { - var tag = reader.ReadByte(); - if (tag >= 0x80) - { - var prim = new MichelinePrim { Prim = (PrimType)reader.ReadByte() }; - - var args = (tag & 0x70) >> 4; - if (args > 0) - { - if (args == 0x07) - args = reader.Read7BitInt(); - - prim.Args = new List(args); - if (depth < Micheline.MaxRecursionDepth) - { - while (args-- > 0) - prim.Args.Add(Read(reader, depth + 1)); - } - else - { - while (args-- > 0) - prim.Args.Add(ReadFlat(reader)); - } - } - - var annots = tag & 0x0F; - if (annots > 0) - { - if (annots == 0x0F) - annots = reader.Read7BitInt(); - - prim.Annots = new List(annots); - while (annots-- > 0) prim.Annots.Add(ReadAnnotation(reader)); - } - - return prim; - } - else - { - var cnt = tag & 0x1F; - if (cnt == 0x1F) cnt = reader.Read7BitInt(); - - switch ((MichelineType)(tag & 0xE0)) - { - case MichelineType.Array: - var arr = new MichelineArray(cnt); - if (depth < Micheline.MaxRecursionDepth) - { - while (cnt-- > 0) - arr.Add(Read(reader, depth + 1)); - } - else - { - while (cnt-- > 0) - arr.Add(ReadFlat(reader)); - } - return arr; - case MichelineType.Bytes: - return new MichelineBytes(reader.ReadBytes(cnt)); - case MichelineType.Int: - return new MichelineInt(new BigInteger(reader.ReadBytes(cnt))); - case MichelineType.String: - return new MichelineString(Utf8.Convert(reader.ReadBytes(cnt))); - default: - throw new FormatException("Invalid micheline tag"); - } - } - } - - static IAnnotation ReadAnnotation(BinaryReader reader) - { - var tag = reader.ReadByte(); - - var cnt = tag & 0x3F; - if (cnt == 0x3F) cnt = reader.Read7BitInt(); - var str = Utf8.Convert(reader.ReadBytes(cnt)); - - switch (tag & 0b_1100_0000) - { - case (int)AnnotationType.Field: - return new FieldAnnotation(str); - case (int)AnnotationType.Type: - return new TypeAnnotation(str); - case (int)AnnotationType.Variable: - return new VariableAnnotation(str); - default: - return new UnsafeAnnotation(str); - } - } - - public static void ReadToJson(BinaryReader reader, Utf8JsonWriter writer, int depth = 0) - { - var tag = reader.ReadByte(); - if (tag >= 0x80) - { - writer.WriteStartObject(); - writer.WriteString("prim", ((PrimType)reader.ReadByte()).ToString()); - - var args = (tag & 0x70) >> 4; - if (args > 0) - { - writer.WritePropertyName("args"); - writer.WriteStartArray(); - - if (args == 0x07) - args = reader.Read7BitInt(); - - if (depth < Micheline.MaxRecursionDepth) - { - while (args-- > 0) - ReadToJson(reader, writer, depth + 1); - } - else - { - while (args-- > 0) - ReadToJsonFlat(reader, writer); - } - - writer.WriteEndArray(); - } - - var annots = tag & 0x0F; - if (annots > 0) - { - writer.WritePropertyName("annots"); - writer.WriteStartArray(); - - if (annots == 0x0F) - annots = reader.Read7BitInt(); - - while (annots-- > 0) ReadAnnotationToJson(reader, writer); - - writer.WriteEndArray(); - } - - writer.WriteEndObject(); - } - else - { - var cnt = tag & 0x1F; - if (cnt == 0x1F) cnt = reader.Read7BitInt(); - - switch ((MichelineType)(tag & 0xE0)) - { - case MichelineType.Array: - writer.WriteStartArray(); - if (depth < Micheline.MaxRecursionDepth) - { - while (cnt-- > 0) - ReadToJson(reader, writer, depth + 1); - } - else - { - while (cnt-- > 0) - ReadToJsonFlat(reader, writer); - } - writer.WriteEndArray(); - break; - case MichelineType.Bytes: - writer.WriteStartObject(); - writer.WriteString("bytes", Hex.Convert(reader.ReadBytes(cnt))); - writer.WriteEndObject(); - break; - case MichelineType.Int: - writer.WriteStartObject(); - writer.WriteString("int", new BigInteger(reader.ReadBytes(cnt)).ToString()); - writer.WriteEndObject(); - break; - case MichelineType.String: - writer.WriteStartObject(); - writer.WriteString("string", reader.ReadBytes(cnt)); - writer.WriteEndObject(); - break; - default: - throw new FormatException("Invalid micheline tag"); - } - } - } - - static void ReadAnnotationToJson(BinaryReader reader, Utf8JsonWriter writer) - { - var tag = reader.ReadByte(); - - var cnt = tag & 0x3F; - if (cnt == 0x3F) cnt = reader.Read7BitInt(); - var str = Utf8.Convert(reader.ReadBytes(cnt)); - - switch (tag & 0b_1100_0000) - { - case (int)AnnotationType.Field: - writer.WriteStringValue($"{FieldAnnotation.Prefix}{str}"); - break; - case (int)AnnotationType.Type: - writer.WriteStringValue($"{TypeAnnotation.Prefix}{str}"); - break; - case (int)AnnotationType.Variable: - writer.WriteStringValue($"{VariableAnnotation.Prefix}{str}"); - break; - default: - writer.WriteStringValue(str); - break; - } - } - - static IMicheline ReadFlat(BinaryReader reader) - { - Stack stack = new(); - IMicheline node, top; - MichelinePrim prim; - MichelineArray arr; - int tag, cnt, args, annots; - - start: - tag = reader.ReadByte(); - if (tag >= 0x80) - { - prim = new() { Prim = (PrimType)reader.ReadByte() }; - - annots = tag & 0x0F; - if (annots > 0) - { - if (annots == 0x0F) - annots = reader.Read7BitInt(); - prim.Annots = new(annots); - } - - args = (tag & 0x70) >> 4; - if (args > 0) - { - if (args == 0x07) - args = reader.Read7BitInt(); - prim.Args = new(args); - - stack.Push(prim); - goto start; - } - - if (prim.Annots != null) - ReadAnnots(reader, prim); - - node = prim; - } - else - { - cnt = tag & 0x1F; - if (cnt == 0x1F) cnt = reader.Read7BitInt(); - - switch ((MichelineType)(tag & 0xE0)) - { - case MichelineType.Array: - node = new MichelineArray(cnt); - if (cnt > 0) - { - stack.Push(node); - goto start; - } - break; - case MichelineType.Bytes: - node = new MichelineBytes(reader.ReadBytes(cnt)); - break; - case MichelineType.Int: - node = new MichelineInt(new BigInteger(reader.ReadBytes(cnt))); - break; - case MichelineType.String: - node = new MichelineString(Utf8.Convert(reader.ReadBytes(cnt))); - break; - default: - throw new FormatException("Invalid micheline tag"); - } - } - finish: - if (stack.Count == 0) return node; - top = stack.Peek(); - if (top is MichelinePrim p) - { - p.Args.Add(node); - if (p.Args.Count < p.Args.Capacity) - goto start; - if (p.Annots != null) - ReadAnnots(reader, p); - } - else - { - arr = (MichelineArray)top; - arr.Add(node); - if (arr.Count < arr.Capacity) - goto start; - } - node = stack.Pop(); - goto finish; - } - - static void ReadAnnots(BinaryReader reader, MichelinePrim prim) - { - while (prim.Annots.Count != prim.Annots.Capacity) - { - var tag = reader.ReadByte(); - - var cnt = tag & 0x3F; - if (cnt == 0x3F) cnt = reader.Read7BitInt(); - var str = Utf8.Convert(reader.ReadBytes(cnt)); - - switch (tag & 0b_1100_0000) - { - case (int)AnnotationType.Field: - prim.Annots.Add(new FieldAnnotation(str)); - break; - case (int)AnnotationType.Type: - prim.Annots.Add(new TypeAnnotation(str)); - break; - case (int)AnnotationType.Variable: - prim.Annots.Add(new VariableAnnotation(str)); - break; - default: - prim.Annots.Add(new UnsafeAnnotation(str)); - break; - } - } - } - - static void ReadToJsonFlat(BinaryReader reader, Utf8JsonWriter writer) - { - Stack<(int, int, int)> stack = new(); - int tag, cnt, args, annots; - - start: - tag = reader.ReadByte(); - if (tag >= 0x80) - { - writer.WriteStartObject(); - writer.WriteString("prim", ((PrimType)reader.ReadByte()).ToString()); - - annots = tag & 0x0F; - if (annots > 0) - { - if (annots == 0x0F) - annots = reader.Read7BitInt(); - } - - args = (tag & 0x70) >> 4; - if (args > 0) - { - if (args == 0x07) - args = reader.Read7BitInt(); - - writer.WriteStartArray("args"); - stack.Push((0, args, annots)); - goto start; - } - - if (annots > 0) - ReadAnnotsToJson(reader, writer, annots); - - writer.WriteEndObject(); - } - else - { - cnt = tag & 0x1F; - if (cnt == 0x1F) cnt = reader.Read7BitInt(); - - switch ((MichelineType)(tag & 0xE0)) - { - case MichelineType.Array: - writer.WriteStartArray(); - if (cnt > 0) - { - stack.Push((1, cnt, 0)); - goto start; - } - writer.WriteEndArray(); - break; - case MichelineType.Bytes: - writer.WriteStartObject(); - writer.WriteString("bytes", Hex.Convert(reader.ReadBytes(cnt))); - writer.WriteEndObject(); - break; - case MichelineType.Int: - writer.WriteStartObject(); - writer.WriteString("int", new BigInteger(reader.ReadBytes(cnt)).ToString()); - writer.WriteEndObject(); - break; - case MichelineType.String: - writer.WriteStartObject(); - writer.WriteString("string", reader.ReadBytes(cnt)); - writer.WriteEndObject(); - break; - default: - throw new FormatException("Invalid micheline tag"); - } - } - finish: - if (stack.Count == 0) return; - var (type, cnt1, cnt2) = stack.Pop(); - if (cnt1 > 1) - { - stack.Push((type, cnt1 - 1, cnt2)); - goto start; - } - if (type == 0) - { - writer.WriteEndArray(); - if (cnt2 > 0) ReadAnnotsToJson(reader, writer, cnt2); - writer.WriteEndObject(); - } - else - { - writer.WriteEndArray(); - } - goto finish; - } - - static void ReadAnnotsToJson(BinaryReader reader, Utf8JsonWriter writer, int count) - { - writer.WriteStartArray("annots"); - while (count-- > 0) - { - var tag = reader.ReadByte(); - - var cnt = tag & 0x3F; - if (cnt == 0x3F) cnt = reader.Read7BitInt(); - var str = Utf8.Convert(reader.ReadBytes(cnt)); - - switch (tag & 0b_1100_0000) - { - case (int)AnnotationType.Field: - writer.WriteStringValue($"{FieldAnnotation.Prefix}{str}"); - break; - case (int)AnnotationType.Type: - writer.WriteStringValue($"{TypeAnnotation.Prefix}{str}"); - break; - case (int)AnnotationType.Variable: - writer.WriteStringValue($"{VariableAnnotation.Prefix}{str}"); - break; - default: - writer.WriteStringValue(str); - break; - } - } - writer.WriteEndArray(); - } - - public static void WriteFlat(BinaryWriter writer, IMicheline value) - { - var stack = new Stack(); - stack.Push(value); - - int i, len, tag; - bool argsCount; - byte[] bytes; - while (stack.Count > 0) - { - switch (stack.Pop()) - { - case MichelineArray array: - if (array.Count >= 0x1F) - { - writer.Write((byte)((int)array.Type | 0x1F)); - writer.Write7BitInt(array.Count); - } - else - { - writer.Write((byte)((int)array.Type | array.Count)); - } - for (i = array.Count - 1; i >= 0; i--) - stack.Push(array[i]); - break; - case MichelinePrim prim: - argsCount = false; - tag = (int)prim.Type; - if (prim.Args?.Count > 0) - { - if (prim.Args.Count >= 0x07) - { - tag |= 0x70; - argsCount = true; - } - else - { - tag |= prim.Args.Count << 4; - } - } - if (prim.Annots?.Count > 0) - { - stack.Push(prim.Annots); - if (prim.Annots.Count >= 0x0F) - { - tag |= 0x0F; - stack.Push(prim.Annots.Count); - } - else - { - tag |= prim.Annots.Count; - } - } - writer.Write((byte)tag); - writer.Write((byte)prim.Prim); - if (prim.Args != null) - { - if (argsCount) - writer.Write7BitInt(prim.Args.Count); - - for (i = prim.Args.Count - 1; i >= 0; i--) - stack.Push(prim.Args[i]); - } - break; - case MichelineBytes micheBytes: - bytes = micheBytes.Value; - len = micheBytes.Value.Length; - if (len >= 0x1F) - { - writer.Write((byte)((int)micheBytes.Type | 0x1F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)micheBytes.Type | len)); - } - writer.Write(bytes); - break; - case MichelineString micheString: - bytes = Utf8.Parse(micheString.Value); - len = bytes.Length; - if (len >= 0x1F) - { - writer.Write((byte)((int)micheString.Type | 0x1F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)micheString.Type | len)); - } - writer.Write(bytes); - break; - case MichelineInt micheInt: - bytes = micheInt.Value.ToByteArray(); - len = bytes.Length; - if (len >= 0x1F) - { - writer.Write((byte)((int)micheInt.Type | 0x1F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)micheInt.Type | len)); - } - writer.Write(bytes); - break; - case int intValue: - writer.Write7BitInt(intValue); - break; - case IEnumerable annots: - foreach (var annot in annots) - { - bytes = Utf8.Parse(annot.Value); - len = bytes.Length; - if (len >= 0x3F) - { - writer.Write((byte)((int)annot.Type | 0x3F)); - writer.Write7BitInt(len); - } - else - { - writer.Write((byte)((int)annot.Type | len)); - } - writer.Write(bytes); - } - break; - default: - throw new Exception(); - } - } - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineBinaryConverter.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineBinaryConverter.cs.meta deleted file mode 100644 index 2692f42c..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineBinaryConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 265dab016b4b24e1a94640c3db5493ae -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineConverter.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineConverter.cs deleted file mode 100644 index 14ce2532..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineConverter.cs +++ /dev/null @@ -1,244 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Numerics; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding.Serialization -{ - public class MichelineConverter : JsonConverter - { - public override IMicheline Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - Stack stack = new(); - IMicheline node, top; - MichelinePrim prim; - string prop; - - start: - switch (reader.TokenType) - { - case JsonTokenType.StartObject: - reader.Read(); - if (reader.TokenType != JsonTokenType.PropertyName) - throw new FormatException("Empty Micheline node"); - prop = reader.GetString(); - reader.Read(); - switch (prop) - { - case "prim": - stack.Push(new MichelinePrim { Prim = PrimTypeConverter.ParsePrim(reader.GetString()) }); - reader.Read(); - goto start; - case "args": - stack.Push(new MichelinePrim()); - if (reader.TokenType == JsonTokenType.StartArray) - { - reader.Read(); - if (reader.TokenType != JsonTokenType.EndArray) - { - stack.Push(new MichelineArray(2)); - goto start; - } - } - else if (reader.TokenType != JsonTokenType.Null) - { - throw new FormatException("Invalid prim args"); - } - reader.Read(); - goto start; - case "annots": - List annots = null; - if (reader.TokenType == JsonTokenType.StartArray) - { - reader.Read(); - if (reader.TokenType == JsonTokenType.String) - { - annots = new(2); - annots.Add(AnnotationConverter.ParseAnnotation(reader.GetString())); - reader.Read(); - while (reader.TokenType == JsonTokenType.String) - { - annots.Add(AnnotationConverter.ParseAnnotation(reader.GetString())); - reader.Read(); - } - } - if (reader.TokenType != JsonTokenType.EndArray) - throw new FormatException("Invalid prim annotation"); - } - else if (reader.TokenType != JsonTokenType.Null) - { - throw new FormatException("Invalid prim annots"); - } - stack.Push(new MichelinePrim { Annots = annots }); - reader.Read(); - goto start; - case "bytes": - if (reader.TokenType != JsonTokenType.String) - throw new FormatException("Invalid Micheline bytes node"); - node = new MichelineBytes(Hex.Parse(reader.GetString())); - break; - case "string": - if (reader.TokenType != JsonTokenType.String) - throw new FormatException("Invalid Micheline string node"); - node = new MichelineString(reader.GetString()); - break; - case "int": - if (reader.TokenType != JsonTokenType.String) - throw new FormatException("Invalid Micheline int node"); - node = new MichelineInt(BigInteger.Parse(reader.GetString())); - break; - default: - throw new FormatException("Invalid Micheline node"); - } - reader.Read(); - if (reader.TokenType != JsonTokenType.EndObject) - throw new FormatException($"Invalid Micheline {node.Type} node"); - goto endNode; - case JsonTokenType.PropertyName: - prim = (MichelinePrim)stack.Peek(); - prop = reader.GetString(); - reader.Read(); - switch (prop) - { - case "prim": - prim.Prim = PrimTypeConverter.ParsePrim(reader.GetString()); - reader.Read(); - goto start; - case "args": - if (reader.TokenType == JsonTokenType.StartArray) - { - reader.Read(); - if (reader.TokenType != JsonTokenType.EndArray) - { - stack.Push(new MichelineArray(2)); - goto start; - } - } - else if (reader.TokenType != JsonTokenType.Null) - { - throw new FormatException("Invalid prim args"); - } - reader.Read(); - goto start; - case "annots": - List annots = null; - if (reader.TokenType == JsonTokenType.StartArray) - { - reader.Read(); - if (reader.TokenType == JsonTokenType.String) - { - annots = new(2); - annots.Add(AnnotationConverter.ParseAnnotation(reader.GetString())); - reader.Read(); - while (reader.TokenType == JsonTokenType.String) - { - annots.Add(AnnotationConverter.ParseAnnotation(reader.GetString())); - reader.Read(); - } - } - if (reader.TokenType != JsonTokenType.EndArray) - throw new FormatException("Invalid prim annotation"); - } - else if (reader.TokenType != JsonTokenType.Null) - { - throw new FormatException("Invalid prim annots"); - } - prim.Annots = annots; - reader.Read(); - goto start; - default: - throw new FormatException(); - } - case JsonTokenType.EndObject: - node = stack.Pop(); - endNode: - if (stack.Count == 0) return node; - ((MichelineArray)stack.Peek()).Add(node); - reader.Read(); - goto start; - case JsonTokenType.StartArray: - stack.Push(new MichelineArray()); - reader.Read(); - goto start; - case JsonTokenType.EndArray: - node = stack.Pop(); - if (stack.Count == 0) return node; - top = stack.Peek(); - if (top is MichelinePrim pr) - pr.Args = (MichelineArray)node; - else - ((MichelineArray)top).Add(node); - reader.Read(); - goto start; - default: - throw new FormatException("Invalid Micheline format"); - } - } - - public override void Write(Utf8JsonWriter writer, IMicheline value, JsonSerializerOptions options) - { - var stack = new Stack(); - stack.Push(value); - - int i; - while (stack.Count > 0) - { - switch (stack.Pop()) - { - case MichelineArray array: - writer.WriteStartArray(); - stack.Push(JsonTokenType.EndArray); - for (i = array.Count - 1; i >= 0; i--) - stack.Push(array[i]); - break; - case MichelinePrim prim: - writer.WriteStartObject(); - writer.WriteString("prim", prim.Prim.ToString()); - if (prim.Annots != null) - { - writer.WriteStartArray("annots"); - foreach (var annot in prim.Annots) - writer.WriteStringValue(annot.ToString()); - writer.WriteEndArray(); - } - if (prim.Args != null) - { - writer.WriteStartArray("args"); - stack.Push(JsonTokenType.EndObject); - stack.Push(JsonTokenType.EndArray); - for (i = prim.Args.Count - 1; i >= 0; i--) - stack.Push(prim.Args[i]); - } - else - { - writer.WriteEndObject(); - } - break; - case MichelineBytes micheBytes: - writer.WriteStartObject(); - writer.WriteString("bytes", Hex.Convert(micheBytes.Value)); - writer.WriteEndObject(); - break; - case MichelineString micheString: - writer.WriteStartObject(); - writer.WriteString("string", micheString.Value); - writer.WriteEndObject(); - break; - case MichelineInt micheInt: - writer.WriteStartObject(); - writer.WriteString("int", micheInt.Value.ToString()); - writer.WriteEndObject(); - break; - case JsonTokenType token: - if (token == JsonTokenType.EndArray) writer.WriteEndArray(); - else writer.WriteEndObject(); - break; - default: - writer.WriteNullValue(); - break; - } - } - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineConverter.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineConverter.cs.meta deleted file mode 100644 index 5ebb586a..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelineConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e21a230ec2df54840a94d51d104761fd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelsonFormatter.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelsonFormatter.cs deleted file mode 100644 index af439c11..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelsonFormatter.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Netezos.Encoding.Serialization -{ - public static class MichelsonFormatter - { - const int LineSize = 100; - - public static string MichelineToMichelson(IMicheline data, bool inline = false) - { - return FormatNode(data, inline:inline, root:true); - } - - static bool IsFramed(MichelinePrim prim) - { - switch (prim.Prim) - { - case PrimType.Pair: - case PrimType.Left: - case PrimType.Right: - case PrimType.Some: - case PrimType.Elt: - case PrimType.pair: - case PrimType.or: - case PrimType.option: - case PrimType.map: - case PrimType.big_map: - case PrimType.list: - case PrimType.set: - case PrimType.contract: - case PrimType.lambda: - case PrimType.sapling_state: - case PrimType.sapling_transaction_deprecated: - case PrimType.sapling_transaction: - case PrimType.ticket: - return true; - default: - return prim.Annots?.Any(x => x.Type != AnnotationType.Variable) ?? false; - } - } - - static bool IsInline(MichelinePrim prim) - { - return prim.Prim == PrimType.PUSH; - } - - static bool IsScript(MichelineArray node) - { - return node.Count >= 3 - && node.Any(x => x is MichelinePrim p && p.Prim == PrimType.parameter) - && node.Any(x => x is MichelinePrim p && p.Prim == PrimType.storage) - && node.Any(x => x is MichelinePrim p && p.Prim == PrimType.code); - } - - static string FormatNode(IMicheline node, string indent = "", bool inline = false, bool root = false, bool wrapped = false) - { - switch (node) - { - case MichelineArray array: - { - var isScriptRoot = root && IsScript(array); - var seqIndent = isScriptRoot ? indent : $"{indent}{new string(' ', 2)}"; - var items = array.Select(x => FormatNode(x, seqIndent, inline, wrapped: true)).ToList(); - if (!items.Any()) - return "{}"; - - var length = indent.Length + items.Sum(x => x.Length) + 4; - var space = isScriptRoot ? "" : " "; - var seq = inline || length < LineSize - ? string.Join($"{space}; ", items) - : string.Join($"{space};\n{seqIndent}", items); - - return isScriptRoot ? seq : $"{{ {seq} }}"; - } - case MichelinePrim prim: - var expr = $"{prim.Prim}{(prim.Annots != null ? $" {string.Join(" ", prim.Annots)}" : "")}"; - var args = prim.Args ?? new List(); - if (prim.Prim == PrimType.LAMBDA || (prim.Prim >= PrimType.IF && prim.Prim <= PrimType.IF_NONE)) - { - var argIndent = $"{indent}{new string(' ', 2)}"; - var items = args.Select(x => FormatNode(x, argIndent, inline)).ToList(); - var lenght = indent.Length + expr.Length + items.Sum(x => x.Length) + items.Count() + 1; - if (inline || lenght < LineSize) - expr = $"{expr} {string.Join(" ", items)}"; - else - { - expr = $"{expr}\n{argIndent}{string.Join($"\n{argIndent}", items)}"; - } - } - else if (args.Count == 1) - { - var argIndent = $"{indent}{new string(' ', expr.Length + 1)}"; - expr = $"{expr} {FormatNode(args[0], argIndent, inline)}"; - } - else if (args.Count > 1) - { - var argIndent = $"{indent}{new string(' ', 2)}"; - var altIndent = $"{indent}{new string(' ', expr.Length + 2)}"; - foreach (var arg in args) - { - var item = FormatNode(arg, argIndent, inline); - var lenght = indent.Length + expr.Length + item.Length + 1; - if (inline || IsInline(prim) || lenght < LineSize) - { - argIndent = altIndent; - expr = $"{expr} {item}"; - } - else - expr = $"{expr}\n{argIndent}{item}"; - } - } - - if (IsFramed(prim) && !root && !wrapped) - return $"({expr})"; - else - return expr; - case MichelineBytes bytes: - return $"0x{Hex.Convert(bytes.Value)}"; - case MichelineInt val: - return $"{val.Value}"; - case MichelineString str: - return $"\"{str.Value}\""; - default: - throw new ArgumentException($"Invalid micheline type {node.Type}"); - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelsonFormatter.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelsonFormatter.cs.meta deleted file mode 100644 index c6d2a388..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/MichelsonFormatter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7ddb6c7b7093e42a7aa898fac81e4b1a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/PrimTypeConverter.cs b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/PrimTypeConverter.cs deleted file mode 100644 index 48c675ac..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/PrimTypeConverter.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding.Serialization -{ - public class PrimTypeConverter : JsonConverter - { - internal static PrimType ParsePrim(string prim) => prim switch - { - "parameter" => PrimType.parameter, - "storage" => PrimType.storage, - "code" => PrimType.code, - "False" => PrimType.False, - "Elt" => PrimType.Elt, - "Left" => PrimType.Left, - "None" => PrimType.None, - "Pair" => PrimType.Pair, - "Right" => PrimType.Right, - "Some" => PrimType.Some, - "True" => PrimType.True, - "Unit" => PrimType.Unit, - "PACK" => PrimType.PACK, - "UNPACK" => PrimType.UNPACK, - "BLAKE2B" => PrimType.BLAKE2B, - "SHA256" => PrimType.SHA256, - "SHA512" => PrimType.SHA512, - "ABS" => PrimType.ABS, - "ADD" => PrimType.ADD, - "AMOUNT" => PrimType.AMOUNT, - "AND" => PrimType.AND, - "BALANCE" => PrimType.BALANCE, - "CAR" => PrimType.CAR, - "CDR" => PrimType.CDR, - "CHECK_SIGNATURE" => PrimType.CHECK_SIGNATURE, - "COMPARE" => PrimType.COMPARE, - "CONCAT" => PrimType.CONCAT, - "CONS" => PrimType.CONS, - "CREATE_ACCOUNT" => PrimType.CREATE_ACCOUNT, - "CREATE_CONTRACT" => PrimType.CREATE_CONTRACT, - "IMPLICIT_ACCOUNT" => PrimType.IMPLICIT_ACCOUNT, - "DIP" => PrimType.DIP, - "DROP" => PrimType.DROP, - "DUP" => PrimType.DUP, - "EDIV" => PrimType.EDIV, - "EMPTY_MAP" => PrimType.EMPTY_MAP, - "EMPTY_SET" => PrimType.EMPTY_SET, - "EQ" => PrimType.EQ, - "EXEC" => PrimType.EXEC, - "FAILWITH" => PrimType.FAILWITH, - "GE" => PrimType.GE, - "GET" => PrimType.GET, - "GT" => PrimType.GT, - "HASH_KEY" => PrimType.HASH_KEY, - "IF" => PrimType.IF, - "IF_CONS" => PrimType.IF_CONS, - "IF_LEFT" => PrimType.IF_LEFT, - "IF_NONE" => PrimType.IF_NONE, - "INT" => PrimType.INT, - "LAMBDA" => PrimType.LAMBDA, - "LE" => PrimType.LE, - "LEFT" => PrimType.LEFT, - "LOOP" => PrimType.LOOP, - "LSL" => PrimType.LSL, - "LSR" => PrimType.LSR, - "LT" => PrimType.LT, - "MAP" => PrimType.MAP, - "MEM" => PrimType.MEM, - "MUL" => PrimType.MUL, - "NEG" => PrimType.NEG, - "NEQ" => PrimType.NEQ, - "NIL" => PrimType.NIL, - "NONE" => PrimType.NONE, - "NOT" => PrimType.NOT, - "NOW" => PrimType.NOW, - "OR" => PrimType.OR, - "PAIR" => PrimType.PAIR, - "PUSH" => PrimType.PUSH, - "RIGHT" => PrimType.RIGHT, - "SIZE" => PrimType.SIZE, - "SOME" => PrimType.SOME, - "SOURCE" => PrimType.SOURCE, - "SENDER" => PrimType.SENDER, - "SELF" => PrimType.SELF, - "STEPS_TO_QUOTA" => PrimType.STEPS_TO_QUOTA, - "SUB" => PrimType.SUB, - "SWAP" => PrimType.SWAP, - "TRANSFER_TOKENS" => PrimType.TRANSFER_TOKENS, - "SET_DELEGATE" => PrimType.SET_DELEGATE, - "UNIT" => PrimType.UNIT, - "UPDATE" => PrimType.UPDATE, - "XOR" => PrimType.XOR, - "ITER" => PrimType.ITER, - "LOOP_LEFT" => PrimType.LOOP_LEFT, - "ADDRESS" => PrimType.ADDRESS, - "CONTRACT" => PrimType.CONTRACT, - "ISNAT" => PrimType.ISNAT, - "CAST" => PrimType.CAST, - "RENAME" => PrimType.RENAME, - "bool" => PrimType.@bool, - "contract" => PrimType.contract, - "int" => PrimType.@int, - "key" => PrimType.key, - "key_hash" => PrimType.key_hash, - "lambda" => PrimType.lambda, - "list" => PrimType.list, - "map" => PrimType.map, - "big_map" => PrimType.big_map, - "nat" => PrimType.nat, - "option" => PrimType.option, - "or" => PrimType.or, - "pair" => PrimType.pair, - "set" => PrimType.set, - "signature" => PrimType.signature, - "string" => PrimType.@string, - "bytes" => PrimType.bytes, - "mutez" => PrimType.mutez, - "timestamp" => PrimType.timestamp, - "unit" => PrimType.unit, - "operation" => PrimType.operation, - "address" => PrimType.address, - "SLICE" => PrimType.SLICE, - "DIG" => PrimType.DIG, - "DUG" => PrimType.DUG, - "EMPTY_BIG_MAP" => PrimType.EMPTY_BIG_MAP, - "APPLY" => PrimType.APPLY, - "chain_id" => PrimType.chain_id, - "CHAIN_ID" => PrimType.CHAIN_ID, - "LEVEL" => PrimType.LEVEL, - "SELF_ADDRESS" => PrimType.SELF_ADDRESS, - "never" => PrimType.never, - "NEVER" => PrimType.NEVER, - "UNPAIR" => PrimType.UNPAIR, - "VOTING_POWER" => PrimType.VOTING_POWER, - "TOTAL_VOTING_POWER" => PrimType.TOTAL_VOTING_POWER, - "KECCAK" => PrimType.KECCAK, - "SHA3" => PrimType.SHA3, - "PAIRING_CHECK" => PrimType.PAIRING_CHECK, - "bls12_381_g1" => PrimType.bls12_381_g1, - "bls12_381_g2" => PrimType.bls12_381_g2, - "bls12_381_fr" => PrimType.bls12_381_fr, - "sapling_state" => PrimType.sapling_state, - "sapling_transaction_deprecated" => PrimType.sapling_transaction_deprecated, - "SAPLING_EMPTY_STATE" => PrimType.SAPLING_EMPTY_STATE, - "SAPLING_VERIFY_UPDATE" => PrimType.SAPLING_VERIFY_UPDATE, - "ticket" => PrimType.ticket, - "TICKET" => PrimType.TICKET, - "READ_TICKET" => PrimType.READ_TICKET, - "SPLIT_TICKET" => PrimType.SPLIT_TICKET, - "JOIN_TICKETS" => PrimType.JOIN_TICKETS, - "GET_AND_UPDATE" => PrimType.GET_AND_UPDATE, - "chest" => PrimType.chest, - "chest_key" => PrimType.chest_key, - "OPEN_CHEST" => PrimType.OPEN_CHEST, - "VIEW" => PrimType.VIEW, - "view" => PrimType.view, - "constant" => PrimType.constant, - "SUB_MUTEZ" => PrimType.SUB_MUTEZ, - "tx_rollup_l2_address" => PrimType.tx_rollup_l2_address, - "MIN_BLOCK_TIME" => PrimType.MIN_BLOCK_TIME, - "sapling_transaction" => PrimType.sapling_transaction, - var value => throw new FormatException($"Invalid prim: {value}") - }; - - public override PrimType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return ParsePrim(reader.GetString()); - } - - public override void Write(Utf8JsonWriter writer, PrimType value, JsonSerializerOptions options) - { - writer.WriteStringValue(value.ToString()); - } - } -} diff --git a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/PrimTypeConverter.cs.meta b/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/PrimTypeConverter.cs.meta deleted file mode 100644 index 107d1115..00000000 --- a/Assets/Scripts/Netezos/Encoding/Micheline/Serialization/PrimTypeConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a059f91709f684445b9cc7eee08f965d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Encoding/Utf8.cs b/Assets/Scripts/Netezos/Encoding/Utf8.cs deleted file mode 100644 index 1f569697..00000000 --- a/Assets/Scripts/Netezos/Encoding/Utf8.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Netezos.Encoding -{ - public static class Utf8 - { - public static byte[] Parse(string text) - { - return System.Text.Encoding.UTF8.GetBytes(text); - } - - public static bool TryParse(string text, out byte[] bytes) - { - bytes = null; - - if (string.IsNullOrEmpty(text)) - return false; - - bytes = System.Text.Encoding.UTF8.GetBytes(text); - - return true; - } - - public static string Convert(byte[] bytes) - { - return System.Text.Encoding.UTF8.GetString(bytes); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Encoding/Utf8.cs.meta b/Assets/Scripts/Netezos/Encoding/Utf8.cs.meta deleted file mode 100644 index d45f9371..00000000 --- a/Assets/Scripts/Netezos/Encoding/Utf8.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a9ea860a95b0a4ee884f8825476732e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging.meta b/Assets/Scripts/Netezos/Forging.meta deleted file mode 100644 index 1cb7c4ed..00000000 --- a/Assets/Scripts/Netezos/Forging.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 70615fc416f5d4efcbc1c58c444185d5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/IForge.cs b/Assets/Scripts/Netezos/Forging/IForge.cs deleted file mode 100644 index 0a51d702..00000000 --- a/Assets/Scripts/Netezos/Forging/IForge.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -using Netezos.Forging.Models; - -namespace Netezos.Forging -{ - public interface IForge - { - IEnumerator ForgeOperationAsync(string branch, OperationContent content); - - IEnumerator ForgeOperationGroupAsync(string branch, IEnumerable contents); - } -} diff --git a/Assets/Scripts/Netezos/Forging/IForge.cs.meta b/Assets/Scripts/Netezos/Forging/IForge.cs.meta deleted file mode 100644 index 2baff423..00000000 --- a/Assets/Scripts/Netezos/Forging/IForge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d7d6da1cc9bdd4ebfba3440ebadfcef0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/IUnforge.cs b/Assets/Scripts/Netezos/Forging/IUnforge.cs deleted file mode 100644 index bce2ff41..00000000 --- a/Assets/Scripts/Netezos/Forging/IUnforge.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections; -using Netezos.Forging.Models; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Forging -{ - public interface IUnforge - { - // TODO: Change into coroutine - Task<(string, IEnumerable)> UnforgeOperationAsync(byte[] content); - } -} diff --git a/Assets/Scripts/Netezos/Forging/IUnforge.cs.meta b/Assets/Scripts/Netezos/Forging/IUnforge.cs.meta deleted file mode 100644 index e086a1b7..00000000 --- a/Assets/Scripts/Netezos/Forging/IUnforge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5d5ea5122858c413aa66dcdb49932dce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local.meta b/Assets/Scripts/Netezos/Forging/Local.meta deleted file mode 100644 index fe57fbdb..00000000 --- a/Assets/Scripts/Netezos/Forging/Local.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a6d274020ab1e44c0863652e3d909c1f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local/ForgedReader.cs b/Assets/Scripts/Netezos/Forging/Local/ForgedReader.cs deleted file mode 100644 index 676a0496..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/ForgedReader.cs +++ /dev/null @@ -1,439 +0,0 @@ -using Netezos.Encoding; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Numerics; - -namespace Netezos.Forging -{ - public class ForgedReader : IDisposable - { - private BinaryReader _reader; - - public bool EndOfStream - { - get - { - return _reader.BaseStream.Position == _reader.BaseStream.Length; - } - } - - public long StreamPosition - { - get - { - return _reader.BaseStream.Position; - } - } - - public ForgedReader(byte[] data) - : this(new MemoryStream(data), false) - { } - - public ForgedReader(Stream stream) - : this(stream, true) - { } - - private ForgedReader(Stream stream, bool leaveOpen) - { - _reader = new BinaryReader(stream, System.Text.Encoding.UTF8, leaveOpen); - } - - public void Dispose() - { - _reader?.Dispose(); - } - - public IMicheline ReadMicheline() - { - var tag = ReadByte(); - - switch (tag) - { - case 0: return ReadMichelineInt(); - case 1: return ReadMichelineString(); - case 2: return ReadMichelineArray(); - case 3: return ReadMichelinePrimitive(0, false); - case 4: return ReadMichelinePrimitive(0, true); - case 5: return ReadMichelinePrimitive(1, false); - case 6: return ReadMichelinePrimitive(1, true); - case 7: return ReadMichelinePrimitive(2, false); - case 8: return ReadMichelinePrimitive(2, true); - case 9: return ReadMichelinePrimitive(3, true); - case 10: return ReadMichelineBytes(); - default: throw new InvalidOperationException($"Unknown tag {tag} at position {_reader.BaseStream.Position}"); - } - } - - public MichelineInt ReadMichelineInt() - { - return new MichelineInt(ReadSBigInt()); - } - - public MichelineString ReadMichelineString() - { - return new MichelineString(ReadString()); - } - - public MichelineBytes ReadMichelineBytes() - { - return new MichelineBytes(ReadArray()); - } - - public MichelineArray ReadMichelineArray() - { - var arrayData = ReadArray(); - - var res = new MichelineArray(); - - using (var arr = new ForgedReader(arrayData)) - { - while (!arr.EndOfStream) - { - res.Add(arr.ReadMicheline()); - } - } - - return res; - } - - private MichelinePrim ReadMichelinePrimitive(int argsLength, bool annotations = false) - { - var primTag = (PrimType)ReadByte(); - - var prim = new MichelinePrim - { - Prim = primTag - }; - - if (0 < argsLength && argsLength < 3) - { - prim.Args = new MichelineArray(argsLength); - - for (var i = 0; i < argsLength; i++) - { - prim.Args.Add(ReadMicheline()); - } - } - else if (argsLength == 3) - { - prim.Args = ReadMichelineArray(); - } - else if (argsLength != 0) - { - throw new ArgumentException($"Unexpected args length {argsLength}", nameof(argsLength)); - } - - if (annotations) - { - var annots = ReadString(); - - if (annots.Length > 0) - { - prim.Annots = annots - .Split(' ') - .Select(a => - { - var annotVal = a.Substring(1); - - IAnnotation annotation; - - switch (a[0]) - { - case FieldAnnotation.Prefix: - annotation = new FieldAnnotation(annotVal); - break; - - case TypeAnnotation.Prefix: - annotation = new TypeAnnotation(annotVal); - break; - - case VariableAnnotation.Prefix: - annotation = new VariableAnnotation(annotVal); - break; - - default: - throw new InvalidOperationException($"Unknown annotation type: {a[0]}"); - } - - return annotation; - }) - .ToList(); - } - } - - return prim; - } - - public string ReadPublicKey() - { - var id = ReadByte(); - - byte[] prefix; - switch (id) - { - case 0: prefix = Prefix.edpk; break; - case 1: prefix = Prefix.sppk; break; - case 2: prefix = Prefix.p2pk; break; - default: throw new ArgumentException($"Invalid public key prefix {id}"); - }; - - return ReadBase58(32, prefix); - } - - public string ReadAddress() - { - var type = ReadByte(); - - switch (type) - { - case 0: return ReadTzAddress(); - case 1: return ReadKtAddress(); - case 2: return ReadTxrAddress(); - default: throw new ArgumentException($"Invalid address prefix {type}"); - } - } - - public string ReadTzAddress() - { - var tzType = ReadByte(); - - byte[] prefix; - switch (tzType) - { - case 0: prefix = Prefix.tz1; break; - case 1: prefix = Prefix.tz2; break; - case 2: prefix = Prefix.tz3; break; - default: - throw new ArgumentException($"Invalid source prefix {tzType}"); - } - - return ReadBase58(20, prefix); - } - - public string ReadKtAddress() - { - var address = ReadBase58(Lengths.KT1.Decoded, Prefix.KT1); - ReadByte(); // Consume padded 0 - return address; - } - - public string ReadTxrAddress() - { - var address = ReadBase58(Lengths.txr1.Decoded, Prefix.txr1); - ReadByte(); // Consume padded 0 - return address; - } - - /// - /// Read a Micheline natural. - /// - /// A Micheline natural. - public BigInteger ReadUBigInt() - { - var value = BigInteger.Zero; - - var bytes = new List(); - - byte b; - while (((b = ReadByte()) & 0x80) != 0) - { - bytes.Add(b); - } - bytes.Add(b); - - for (var i = bytes.Count - 1; i >= 0; i--) - { - value <<= 7; - value |= (bytes[i] & 0x7F); - } - - return value; - } - - /// - /// Read a Micheline integer. - /// - /// A Micheline integer. - public BigInteger ReadSBigInt() - { - var value = BigInteger.Zero; - - var bytes = new List(); - - byte b; - while (((b = ReadByte()) & 0x80) != 0) - { - bytes.Add(b); - } - bytes.Add(b); - - for (var i = bytes.Count - 1; i > 0; i--) - { - value <<= 7; - value |= (bytes[i] & 0x7F); - } - - value <<= 6; - value |= bytes[0] & 0x3F; - - if ((bytes[0] & 0x40) != 0) - { - value = -value; - } - - return value; - } - - public string ReadEntrypoint() - { - var epType = ReadByte(); - - switch (epType) - { - case 0: return "default"; - case 1: return "root"; - case 2: return "do"; - case 3: return "set_delegate"; - case 4: return "remove_delegate"; - case 255: return ReadString(); - default: throw new ArgumentException($"Invalid entrypoint prefix {epType}"); - } - } - - public bool ReadBool() - { - return ReadByte() == 255; - } - - public byte ReadByte() - { - return _reader.ReadByte(); - } - - public byte[] ReadBytes(int count) - { - return _reader.ReadBytes(count); - } - - public int ReadInt32(int len = 4) - { - if (len < 1 || 4 < len) - throw new ArgumentOutOfRangeException($"{nameof(len)} must be between 1 and 4"); - - var bytes = ReadBytes(len); - - var res = 0; - for (int i = 0, shift = ((len - 1) * 8); i < len; i++, shift -= 8) - { - res |= bytes[i] << shift; - } - - return res; - } - - public long ReadInt64(int len = 8) - { - if (len < 1 || 8 < len) - throw new ArgumentOutOfRangeException($"{nameof(len)} must be between 1 and 8"); - - var bytes = ReadBytes(len); - - var i1 = 0; - var i2 = 0; - var idx = 0; - - var highIterations = Math.Max(len - 4, 0); - var highShift = Math.Max(((highIterations) - 1) * 8, 0); - var lowIterations = len - highIterations; - var lowShift = (lowIterations - 1) * 8; - - for (int i = 0, shift = highShift; i < highIterations; i++, shift -= 8, idx++) - i1 |= bytes[idx] << shift; - - for (int i = 0, shift = lowShift; i < lowIterations; i++, shift -= 8, idx++) - i2 |= bytes[idx] << shift; - - return (uint)i2 | ((long)i1 << 32); - } - - public string ReadString(int len = 4) - { - var stringLength = ReadInt32(len); - return Utf8.Convert(ReadBytes(stringLength)); - } - - public string ReadTz1Address() - { - return ReadBase58(Lengths.tz1.Decoded, Prefix.tz1); - } - - public T ReadEnumerableSingle(Func readData) - { - if (!EndOfStream) - { - var arrLen = ReadInt32(); - var arrData = ReadBytes(arrLen); - - using (var reader = new ForgedReader(arrData)) - { - var result = readData(reader); - - if (!reader.EndOfStream) - { - throw new InvalidOperationException("Expected end of stream but not reached"); - } - - return result; - } - } - return default(T); - } - - public IEnumerable ReadEnumerable(Func readData) - { - if (!EndOfStream) - { - var arrLen = ReadInt32(); - var arrData = ReadBytes(arrLen); - - using (var reader = new ForgedReader(arrData)) - { - while (!reader.EndOfStream) - { - yield return readData(reader); - } - } - } - yield break; - } - - public string ReadHexString() - { - var stringLength = ReadInt32(); - return Hex.Convert(ReadBytes(stringLength)); - } - - public string ReadBase58(int length, byte[] prefix) - { - if (prefix == null) - { - throw new ArgumentNullException(nameof(prefix)); - } - else if (prefix.Length == 0) - { - throw new ArgumentException("Prefix length must be greater than 0", nameof(prefix)); - } - - var b58bytes = ReadBytes(length); - return Base58.Convert(b58bytes, prefix); - } - - public byte[] ReadArray() - { - var count = ReadInt32(); - return ReadBytes(count); - } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Local/ForgedReader.cs.meta b/Assets/Scripts/Netezos/Forging/Local/ForgedReader.cs.meta deleted file mode 100644 index 402732f5..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/ForgedReader.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6906db2377fa146039e70a9ef5cfbb81 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.Operations.cs b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.Operations.cs deleted file mode 100644 index 803b8487..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.Operations.cs +++ /dev/null @@ -1,285 +0,0 @@ -using System; -using System.Linq; -using Netezos.Encoding; -using Netezos.Forging.Models; -using Netezos.Utils; - -namespace Netezos.Forging -{ - public partial class LocalForge - { - static byte[] ForgeOperation(OperationContent content) - { - switch (content) - { - case EndorsementContent endorsement: - return ForgeEndorsement(endorsement); - case PreendorsementContent preendorsement: - return ForgePreendorsement(preendorsement); - case BallotContent ballot: - return ForgeBallot(ballot); - case ProposalsContent proposals: - return ForgeProposals(proposals); - case ActivationContent activation: - return ForgeActivation(activation); - case DoubleBakingContent doubleBaking: - return ForgeDoubleBaking(doubleBaking); - case DoubleEndorsementContent doubleEndorsement: - return ForgeDoubleEndorsement(doubleEndorsement); - case DoublePreendorsementContent doublePreendorsement: - return ForgeDoublePreendorsement(doublePreendorsement); - case SeedNonceRevelationContent seed: - return ForgeSeedNonceRevelaion(seed); - case DelegationContent delegation: - return ForgeDelegation(delegation); - case OriginationContent origination: - return ForgeOrigination(origination); - case TransactionContent transaction: - return ForgeTransaction(transaction); - case RevealContent reveal: - return ForgeReveal(reveal); - case RegisterConstantContent registerConstant: - return ForgeRegisterConstant(registerConstant); - case SetDepositsLimitContent setDepositsLimit: - return ForgeSetDepositsLimit(setDepositsLimit); - case FailingNoopContent failingNoop: - return ForgeFailingNoop(failingNoop); - default: - throw new ArgumentException($"Invalid operation content kind {content.Kind}"); - } - } - - static byte[] ForgeEndorsement(EndorsementContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Endorsement), - ForgeInt32(operation.Slot, 2), - ForgeInt32(operation.Level), - ForgeInt32(operation.Round), - Base58.Parse(operation.PayloadHash, Prefix.vh)); - } - - static byte[] ForgePreendorsement(PreendorsementContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Preendorsement), - ForgeInt32(operation.Slot, 2), - ForgeInt32(operation.Level), - ForgeInt32(operation.Round), - Base58.Parse(operation.PayloadHash, Prefix.vh)); - } - - static byte[] ForgeBallot(BallotContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Ballot), - ForgeTzAddress(operation.Source), - ForgeInt32(operation.Period), - Base58.Parse(operation.Proposal, 2), - new[] { (byte)operation.Ballot }); - } - - static byte[] ForgeProposals(ProposalsContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Proposals), - ForgeTzAddress(operation.Source), - ForgeInt32(operation.Period), - ForgeArray(operation.Proposals - .Select(x => Base58.Parse(x, 2)) - .SelectMany(x => x) - .ToArray())); - } - - static byte[] ForgeActivation(ActivationContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Activation), - ForgePkh(operation.Address), - Hex.Parse(operation.Secret)); - } - - static byte[] ForgeDoubleBaking(DoubleBakingContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.DoubleBaking), - ForgeArray(ForgeBlockHeader(operation.BlockHeader1)), - ForgeArray(ForgeBlockHeader(operation.BlockHeader2))); - } - - static byte[] ForgeDoubleEndorsement(DoubleEndorsementContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.DoubleEndorsement), - ForgeArray(ForgeInlinedEndorsement(operation.Op1)), - ForgeArray(ForgeInlinedEndorsement(operation.Op2))); - } - - static byte[] ForgeDoublePreendorsement(DoublePreendorsementContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.DoublePreendorsement), - ForgeArray(ForgeInlinedPreendorsement(operation.Op1)), - ForgeArray(ForgeInlinedPreendorsement(operation.Op2))); - } - - static byte[] ForgeSeedNonceRevelaion(SeedNonceRevelationContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.SeedNonceRevelation), - ForgeInt32(operation.Level), - Hex.Parse(operation.Nonce)); - } - - static byte[] ForgeDelegation(DelegationContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Delegation), - ForgeTzAddress(operation.Source), - ForgeMicheNat(operation.Fee), - ForgeMicheNat(operation.Counter), - ForgeMicheNat(operation.GasLimit), - ForgeMicheNat(operation.StorageLimit), - ForgeDelegate(operation.Delegate)); - } - - static byte[] ForgeOrigination(OriginationContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Origination), - ForgeTzAddress(operation.Source), - ForgeMicheNat(operation.Fee), - ForgeMicheNat(operation.Counter), - ForgeMicheNat(operation.GasLimit), - ForgeMicheNat(operation.StorageLimit), - ForgeMicheNat(operation.Balance), - ForgeDelegate(operation.Delegate), - ForgeScript(operation.Script)); - } - - static byte[] ForgeTransaction(TransactionContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Transaction), - ForgeTzAddress(operation.Source), - ForgeMicheNat(operation.Fee), - ForgeMicheNat(operation.Counter), - ForgeMicheNat(operation.GasLimit), - ForgeMicheNat(operation.StorageLimit), - ForgeMicheNat(operation.Amount), - ForgeAddress(operation.Destination), - ForgeParameters(operation.Parameters)); - } - - static byte[] ForgeReveal(RevealContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.Reveal), - ForgeTzAddress(operation.Source), - ForgeMicheNat(operation.Fee), - ForgeMicheNat(operation.Counter), - ForgeMicheNat(operation.GasLimit), - ForgeMicheNat(operation.StorageLimit), - ForgePublicKey(operation.PublicKey)); - } - - static byte[] ForgeRegisterConstant(RegisterConstantContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.RegisterConstant), - ForgeTzAddress(operation.Source), - ForgeMicheNat(operation.Fee), - ForgeMicheNat(operation.Counter), - ForgeMicheNat(operation.GasLimit), - ForgeMicheNat(operation.StorageLimit), - ForgeArray(ForgeMicheline(operation.Value))); - } - - static byte[] ForgeSetDepositsLimit(SetDepositsLimitContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.SetDepositsLimit), - ForgeTzAddress(operation.Source), - ForgeMicheNat(operation.Fee), - ForgeMicheNat(operation.Counter), - ForgeMicheNat(operation.GasLimit), - ForgeMicheNat(operation.StorageLimit), - operation.Limit == null - ? ForgeBool(false) - : Bytes.Concat(ForgeBool(true), ForgeMicheNat(operation.Limit.Value))); - } - - static byte[] ForgeFailingNoop(FailingNoopContent operation) - { - return Bytes.Concat( - ForgeTag(OperationTag.FailingNoop), - ForgeArray(operation.Bytes)); - } - - #region nested - static byte[] ForgeBlockHeader(BlockHeader header) - { - return Bytes.Concat( - ForgeInt32(header.Level), - ForgeInt32(header.Proto, 1), - Base58.Parse(header.Predecessor, 2), - ForgeInt64(header.Timestamp.ToUnixTime()), - ForgeInt32(header.ValidationPass, 1), - Base58.Parse(header.OperationsHash, 3), - ForgeArray(header.Fitness.Select(x => ForgeArray(Hex.Parse(x))).SelectMany(x => x).ToArray()), - Base58.Parse(header.Context, 2), - Base58.Parse(header.PayloadHash, Prefix.vh), - ForgeInt32(header.PayloadRound), - Hex.Parse(header.ProofOfWorkNonce), - ForgeSeedNonce(header.SeedNonceHash), - new[] { (byte)header.LiquidityBakingToggleVote }, - Base58.Parse(header.Signature, 3)); - } - - static byte[] ForgeInlinedEndorsement(InlinedEndorsement op) - { - return Bytes.Concat( - Base58.Parse(op.Branch, 2), - ForgeEndorsement(op.Operations), - Base58.Parse(op.Signature, 3)); - } - - static byte[] ForgeInlinedPreendorsement(InlinedPreendorsement op) - { - return Bytes.Concat( - Base58.Parse(op.Branch, 2), - ForgePreendorsement(op.Operations), - Base58.Parse(op.Signature, 3)); - } - - static byte[] ForgeSeedNonce(string nonce) - { - return nonce == null ? ForgeBool(false) : Bytes.Concat( - ForgeBool(true), - Base58.Parse(nonce, 3)); - } - - static byte[] ForgeDelegate(string delegat) - { - return delegat == null ? ForgeBool(false) : Bytes.Concat( - ForgeBool(true), - ForgeTzAddress(delegat)); - } - - static byte[] ForgeParameters(Parameters param) - { - return param == null ? ForgeBool(false) : Bytes.Concat( - ForgeBool(true), - ForgeEntrypoint(param.Entrypoint), - ForgeArray(ForgeMicheline(param.Value).ToArray())); - } - - static byte[] ForgeScript(Script script) - { - return Bytes.Concat( - ForgeArray(ForgeMicheline(script.Code)), - ForgeArray(ForgeMicheline(script.Storage))); - } - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.Operations.cs.meta b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.Operations.cs.meta deleted file mode 100644 index ef17c110..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.Operations.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 097767f1ad1a0485c97735f122ae59b0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.cs b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.cs deleted file mode 100644 index fd54f097..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.cs +++ /dev/null @@ -1,237 +0,0 @@ -using Netezos.Encoding; -using Netezos.Forging.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; - -namespace Netezos.Forging -{ - public partial class LocalForge - { - public static byte[] ForgeTag(OperationTag tag) - { - return new[] { (byte)tag }; - } - - public static byte[] ForgeBool(bool value) - { - return value ? new byte[] { 255 } : new byte[] { 0 }; - } - - public static byte[] ForgeInt32(int value, int len = 4) - { - var res = new byte[len]; - for (int i = len - 1; i >= 0; i--, value >>= 8) - res[i] = (byte)(value & 0xFF); - return res; - } - - public static byte[] ForgeInt64(long value, int len = 8) - { - var res = new byte[len]; - for (int i = len - 1; i >= 0; i--, value >>= 8) - res[i] = (byte)(value & 0xFF); - return res; - } - - public static byte[] ForgeArray(byte[] value, int len = 4) - { - return ForgeInt32(value.Length, len).Concat(value); - } - - public static byte[] ForgeString(string value, int len = 4) - { - return ForgeInt32(value.Length, len).Concat(Utf8.Parse(value)); - } - - public static byte[] ForgePublicKey(string value) - { - var prefix = value.Substring(0, 4); - var res = Base58.Parse(value, 4); - - switch (prefix) - { - case "edpk": return new byte[] { 0 }.Concat(res); - case "sppk": return new byte[] { 1 }.Concat(res); - case "p2pk": return new byte[] { 2 }.Concat(res); - default: - throw new ArgumentException($"Invalid public key prefix {prefix}"); - } - } - - public static byte[] ForgeAddress(string value) - { - var prefix = value.Substring(0, 3); - var res = Base58.Parse(value, 3); - - switch (prefix) - { - case "tz1": return new byte[] { 0, 0 }.Concat(res); - case "tz2": return new byte[] { 0, 1 }.Concat(res); - case "tz3": return new byte[] { 0, 2 }.Concat(res); - case "KT1": return new byte[] { 1 }.Concat(res).Concat(new byte[] { 0 }); - case "txr1": return new byte[] { 2 }.Concat(res).Concat(new byte[] { 0 }); - default: - throw new ArgumentException($"Invalid address prefix {prefix}"); - } - } - - public static byte[] ForgeTzAddress(string value) - { - var prefix = value.Substring(0, 3); - var res = Base58.Parse(value, 3); - - switch (prefix) - { - case "tz1": return new byte[] { 0 }.Concat(res); - case "tz2": return new byte[] { 1 }.Concat(res); - case "tz3": return new byte[] { 2 }.Concat(res); - default: - throw new ArgumentException($"Invalid source prefix {prefix}"); - } - } - - public static byte[] ForgePkh(string value) - { - return Base58.Parse(value, 3); - } - - public static byte[] ForgeMicheNat(int value) - { - if (value < 0) - throw new ArgumentException("Nat cannot be negative"); - - var res = new List(9); - res.Add((byte)(value & 0x7F)); - value >>= 7; - - while (value > 0) - { - res[res.Count - 1] |= 0x80; - res.Add((byte)(value & 0x7F)); - value >>= 7; - } - - return res.ToArray(); - } - - public static byte[] ForgeMicheNat(long value) - { - if (value < 0) - throw new ArgumentException("Nat cannot be negative"); - - var res = new List(9); - res.Add((byte)(value & 0x7F)); - value >>= 7; - - while (value > 0) - { - res[res.Count - 1] |= 0x80; - res.Add((byte)(value & 0x7F)); - value >>= 7; - } - - return res.ToArray(); - } - - public static byte[] ForgeMicheNat(BigInteger value) - { - if (value < 0) - throw new ArgumentException("Nat cannot be negative"); - - var res = new List(9); - res.Add((byte)(value & 0x7F)); - value >>= 7; - - while (value > 0) - { - res[res.Count - 1] |= 0x80; - res.Add((byte)(value & 0x7F)); - value >>= 7; - } - - return res.ToArray(); - } - - public static byte[] ForgeMicheInt(BigInteger value) - { - var abs = BigInteger.Abs(value); - var res = new List(); - - res.Add((byte)(value.Sign < 0 ? (abs & 0x3F | 0x40) : (abs & 0x3F))); - abs >>= 6; - - while (abs > 0) - { - res[res.Count - 1] |= 0x80; - res.Add((byte)(abs & 0x7F)); - abs >>= 7; - } - - return res.ToArray(); - } - - public static byte[] ForgeEntrypoint(string value) - { - switch (value) - { - case "default": return new byte[] { 0 }; - case "root": return new byte[] { 1 }; - case "do": return new byte[] { 2 }; - case "set_delegate": return new byte[] { 3 }; - case "remove_delegate": return new byte[] { 4 }; - default: - return new byte[] { 255 }.Concat(ForgeString(value, 1)); - } - } - - public static byte[] ForgeMicheline(IMicheline micheline) - { - switch (micheline) - { - case MichelinePrim prim: - var res = new List(); - - var argsCnt = prim.Args?.Count ?? 0; - var annots = prim.Annots == null ? 0 : 1; - var tag = Math.Min(argsCnt * 2 + 3 + annots, 9); - - res.Add((byte)tag); - res.Add((byte)prim.Prim); - - if (argsCnt > 0) - { - var args = prim.Args.Select(ForgeMicheline).SelectMany(x => x); - res.AddRange(argsCnt < 3 ? args : ForgeArray(args.ToArray())); - } - - if (annots > 0) - { - res.AddRange(ForgeString(string.Join(" ", prim.Annots))); - } - else if (argsCnt >= 3) - { - res.AddRange(new List { 0, 0, 0, 0 }); - } - - return res.ToArray(); - - case MichelineArray array: - return new byte[] { 2 }.Concat(ForgeArray(array.Select(ForgeMicheline).SelectMany(x => x).ToArray())); - - case MichelineInt micheInt: - return new byte[] { 0 }.Concat(ForgeMicheInt(micheInt.Value)); - - case MichelineString micheString: - return new byte[] { 1 }.Concat(ForgeString(micheString.Value)); - - case MichelineBytes micheBytes: - return new byte[] { 10 }.Concat(ForgeArray(micheBytes.Value)); - - default: - throw new ArgumentException("Invalid micheline node type"); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.cs.meta b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.cs.meta deleted file mode 100644 index ae2c6e0f..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Forgers.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 996112890b3fd4764ad3f37130de6371 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.Operations.cs b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.Operations.cs deleted file mode 100644 index 57323689..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.Operations.cs +++ /dev/null @@ -1,329 +0,0 @@ -using Netezos.Encoding; -using Netezos.Forging.Models; -using System; -using System.Linq; - -namespace Netezos.Forging -{ - public partial class LocalForge - { - static OperationContent UnforgeOperation(ForgedReader reader) - { - var operation = (OperationTag)reader.ReadByte(); - - switch (operation) - { - case OperationTag.Endorsement: - return UnforgeEndorsement(reader); - case OperationTag.Preendorsement: - return UnforgePreendorsement(reader); - case OperationTag.Ballot: - return UnforgeBallot(reader); - case OperationTag.Proposals: - return UnforgeProposals(reader); - case OperationTag.Activation: - return UnforgeActivation(reader); - case OperationTag.DoubleBaking: - return UnforgeDoubleBaking(reader); - case OperationTag.DoubleEndorsement: - return UnforgeDoubleEndorsement(reader); - case OperationTag.DoublePreendorsement: - return UnforgeDoublePreendorsement(reader); - case OperationTag.SeedNonceRevelation: - return UnforgeSeedNonceRevelaion(reader); - case OperationTag.Delegation: - return UnforgeDelegation(reader); - case OperationTag.Origination: - return UnforgeOrigination(reader); - case OperationTag.Transaction: - return UnforgeTransaction(reader); - case OperationTag.Reveal: - return UnforgeReveal(reader); - case OperationTag.RegisterConstant: - return UnforgeRegisterConstant(reader); - case OperationTag.SetDepositsLimit: - return UnforgeSetDepositsLimit(reader); - case OperationTag.FailingNoop: - return UnforgeFailingNoop(reader); - default: - throw new ArgumentException($"Invalid operation: {operation}"); - } - } - - static EndorsementContent UnforgeEndorsement(ForgedReader reader) - { - return new EndorsementContent - { - Slot = reader.ReadInt32(2), - Level = reader.ReadInt32(), - Round = reader.ReadInt32(), - PayloadHash = reader.ReadBase58(32, Prefix.vh) - }; - } - - static PreendorsementContent UnforgePreendorsement(ForgedReader reader) - { - return new PreendorsementContent - { - Slot = reader.ReadInt32(2), - Level = reader.ReadInt32(), - Round = reader.ReadInt32(), - PayloadHash = reader.ReadBase58(32, Prefix.vh) - }; - } - - static BallotContent UnforgeBallot(ForgedReader reader) - { - return new BallotContent - { - Source = reader.ReadTzAddress(), - Period = reader.ReadInt32(), - Proposal = reader.ReadBase58(Lengths.P.Decoded, Prefix.P), - Ballot = (Ballot)reader.ReadByte() - }; - } - - static ProposalsContent UnforgeProposals(ForgedReader reader) - { - return new ProposalsContent - { - Source = reader.ReadTzAddress(), - Period = reader.ReadInt32(), - Proposals = reader.ReadEnumerable(r => r.ReadBase58(Lengths.P.Decoded, Prefix.P)).ToList() - }; - } - - static ActivationContent UnforgeActivation(ForgedReader reader) - { - return new ActivationContent - { - Address = reader.ReadTz1Address(), - Secret = Hex.Convert(reader.ReadBytes(20)) - }; - } - - static DoubleBakingContent UnforgeDoubleBaking(ForgedReader reader) - { - return new DoubleBakingContent - { - BlockHeader1 = reader.ReadEnumerableSingle(UnforgeBlockHeader), - BlockHeader2 = reader.ReadEnumerableSingle(UnforgeBlockHeader) - }; - } - - static DoubleEndorsementContent UnforgeDoubleEndorsement(ForgedReader reader) - { - return new DoubleEndorsementContent - { - Op1 = reader.ReadEnumerableSingle(UnforgeInlinedEndorsement), - Op2 = reader.ReadEnumerableSingle(UnforgeInlinedEndorsement) - }; - } - - static DoublePreendorsementContent UnforgeDoublePreendorsement(ForgedReader reader) - { - return new DoublePreendorsementContent - { - Op1 = reader.ReadEnumerableSingle(UnforgeInlinedPreendorsement), - Op2 = reader.ReadEnumerableSingle(UnforgeInlinedPreendorsement) - }; - } - - static SeedNonceRevelationContent UnforgeSeedNonceRevelaion(ForgedReader reader) - { - return new SeedNonceRevelationContent - { - Level = reader.ReadInt32(), - Nonce = Hex.Convert(reader.ReadBytes(Lengths.nce.Decoded)) - }; - } - - static DelegationContent UnforgeDelegation(ForgedReader reader) - { - return new DelegationContent - { - Source = reader.ReadTzAddress(), - Fee = (long)reader.ReadUBigInt(), - Counter = (int)reader.ReadUBigInt(), - GasLimit = (int)reader.ReadUBigInt(), - StorageLimit = (int)reader.ReadUBigInt(), - Delegate = UnforgeDelegate(reader) - }; - } - - static OriginationContent UnforgeOrigination(ForgedReader reader) - { - return new OriginationContent - { - Source = reader.ReadTzAddress(), - Fee = (long)reader.ReadUBigInt(), - Counter = (int)reader.ReadUBigInt(), - GasLimit = (int)reader.ReadUBigInt(), - StorageLimit = (int)reader.ReadUBigInt(), - Balance = (long)reader.ReadUBigInt(), - Delegate = UnforgeDelegate(reader), - Script = UnforgeScript(reader) - }; - } - - static TransactionContent UnforgeTransaction(ForgedReader reader) - { - return new TransactionContent - { - Source = reader.ReadTzAddress(), - Fee = (long)reader.ReadUBigInt(), - Counter = (int)reader.ReadUBigInt(), - GasLimit = (int)reader.ReadUBigInt(), - StorageLimit = (int)reader.ReadUBigInt(), - Amount = (long)reader.ReadUBigInt(), - Destination = reader.ReadAddress(), - Parameters = UnforgeParameters(reader) - }; - } - - static RevealContent UnforgeReveal(ForgedReader reader) - { - return new RevealContent - { - Source = reader.ReadTzAddress(), - Fee = (long)reader.ReadUBigInt(), - Counter = (int)reader.ReadUBigInt(), - GasLimit = (int)reader.ReadUBigInt(), - StorageLimit = (int)reader.ReadUBigInt(), - PublicKey = reader.ReadPublicKey() - }; - } - - static RegisterConstantContent UnforgeRegisterConstant(ForgedReader reader) - { - return new RegisterConstantContent - { - Source = reader.ReadTzAddress(), - Fee = (long)reader.ReadUBigInt(), - Counter = (int)reader.ReadUBigInt(), - GasLimit = (int)reader.ReadUBigInt(), - StorageLimit = (int)reader.ReadUBigInt(), - Value = reader.ReadEnumerableSingle(UnforgeMicheline) - }; - } - - static SetDepositsLimitContent UnforgeSetDepositsLimit(ForgedReader reader) - { - return new SetDepositsLimitContent - { - Source = reader.ReadTzAddress(), - Fee = (long)reader.ReadUBigInt(), - Counter = (int)reader.ReadUBigInt(), - GasLimit = (int)reader.ReadUBigInt(), - StorageLimit = (int)reader.ReadUBigInt(), - Limit = reader.ReadBool() ? reader.ReadUBigInt() : null - }; - } - - static FailingNoopContent UnforgeFailingNoop(ForgedReader reader) - { - return new FailingNoopContent - { - Bytes = reader.ReadArray() - }; - } - - #region nested - - static BlockHeader UnforgeBlockHeader(ForgedReader reader) - { - return new BlockHeader - { - Level = reader.ReadInt32(), - Proto = reader.ReadInt32(1), - Predecessor = reader.ReadBase58(Lengths.B.Decoded, Prefix.B), - Timestamp = DateTimeExtension.FromUnixTime(reader.ReadInt64()), - ValidationPass = reader.ReadInt32(1), - OperationsHash = reader.ReadBase58(Lengths.LLo.Decoded, Prefix.LLo), - Fitness = reader.ReadEnumerable(r => r.ReadHexString()).ToList(), - Context = reader.ReadBase58(Lengths.Co.Decoded, Prefix.Co), - PayloadHash = reader.ReadBase58(Lengths.vh.Decoded, Prefix.vh), - PayloadRound = reader.ReadInt32(2), - ProofOfWorkNonce = Hex.Convert(reader.ReadBytes(8)), - SeedNonceHash = UnforgeSeedNonce(reader), - LiquidityBakingToggleVote = (LBToggle)reader.ReadByte(), - Signature = reader.ReadBase58(Lengths.sig.Decoded, Prefix.sig), - }; - } - - static InlinedEndorsement UnforgeInlinedEndorsement(ForgedReader reader) - { - return new InlinedEndorsement - { - Branch = reader.ReadBase58(Lengths.B.Decoded, Prefix.B), - Operations = (EndorsementContent)UnforgeOperation(reader), - Signature = reader.ReadBase58(Lengths.sig.Decoded, Prefix.sig) - }; - } - - static InlinedPreendorsement UnforgeInlinedPreendorsement(ForgedReader reader) - { - return new InlinedPreendorsement - { - Branch = reader.ReadBase58(Lengths.B.Decoded, Prefix.B), - Operations = (PreendorsementContent)UnforgeOperation(reader), - Signature = reader.ReadBase58(Lengths.sig.Decoded, Prefix.sig) - }; - } - - static string UnforgeSeedNonce(ForgedReader reader) - { - return UnforgeConditional(reader, () => reader.ReadBase58(Lengths.nce.Decoded, Prefix.nce)); - } - - static string UnforgeDelegate(ForgedReader reader) - { - return UnforgeConditional(reader, () => reader.ReadTzAddress()); - } - - static Parameters UnforgeParameters(ForgedReader reader) - { - return UnforgeConditional(reader, () => - { - return new Parameters - { - Entrypoint = UnforgeEntrypoint(reader), - Value = reader.ReadEnumerableSingle(UnforgeMicheline) - }; - }); - } - - static string UnforgeEntrypoint(ForgedReader reader) - { - var ep = reader.ReadInt32(1); - - switch (ep) - { - case 0: return "default"; - case 1: return "root"; - case 2: return "do"; - case 3: return "set_delegate"; - case 4: return "remove_delegate"; - case 255: return reader.ReadString(1); - default: throw new ArgumentException($"Unrecognized endpoint type {ep}"); - } - } - - static Script UnforgeScript(ForgedReader reader) - { - return new Script - { - Code = (MichelineArray)reader.ReadEnumerableSingle(UnforgeMicheline), - Storage = reader.ReadEnumerableSingle(UnforgeMicheline) - }; - } - - static T UnforgeConditional(ForgedReader reader, Func tb, Func fb = null) - where T : class - { - return reader.ReadBool() ? tb() : fb?.Invoke(); - } - - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.Operations.cs.meta b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.Operations.cs.meta deleted file mode 100644 index 0c96b3b2..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.Operations.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 505eb109e7d134d35b5fb88eb62fbd10 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.cs b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.cs deleted file mode 100644 index 5c3f4c3b..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Netezos.Encoding; -using System; - -namespace Netezos.Forging -{ - public partial class LocalForge - { - public static IMicheline UnforgeMicheline(ForgedReader reader) - { - var micheline = reader.ReadMicheline(); - - if (!reader.EndOfStream) - { - throw new ArgumentException($"Did not reach EOS (position: {reader.StreamPosition})"); - } - - return micheline; - } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.cs.meta b/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.cs.meta deleted file mode 100644 index 98557bab..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.Unforgers.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c6343a40988cb4a3faa224b9f3d7b6c3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.cs b/Assets/Scripts/Netezos/Forging/Local/LocalForge.cs deleted file mode 100644 index 16f92abd..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Netezos.Encoding; -using Netezos.Forging.Models; -using Netezos.Utils; - -namespace Netezos.Forging -{ - public partial class LocalForge : IForge, IUnforge - { - public IEnumerator ForgeOperationAsync(string branch, OperationContent content) - { - var branchBytes = Base58.Parse(branch, Prefix.B.Length); - var contentBytes = ForgeOperation(content); - - yield return branchBytes.Concat(contentBytes); - } - - public IEnumerator ForgeOperationGroupAsync(string branch, IEnumerable contents) - { - var branchBytes = Base58.Parse(branch, Prefix.B.Length); - var contentBytes = Bytes.Concat(contents.Select(ForgeOperation).ToArray()); - - yield return branchBytes.Concat(contentBytes); - } - - // Todo: Change into coroutine - public Task<(string, IEnumerable)> UnforgeOperationAsync(byte[] bytes) - { - using (var reader = new ForgedReader(bytes)) - { - var branch = reader.ReadBase58(Lengths.B.Decoded, Prefix.B); - var content = new List(); - - while (!reader.EndOfStream) - { - content.Add(UnforgeOperation(reader)); - } - - return Task.FromResult((branch, (IEnumerable)content)); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Local/LocalForge.cs.meta b/Assets/Scripts/Netezos/Forging/Local/LocalForge.cs.meta deleted file mode 100644 index a1ce96e1..00000000 --- a/Assets/Scripts/Netezos/Forging/Local/LocalForge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6d188a82d93e945fab15d9f78459ba96 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models.meta b/Assets/Scripts/Netezos/Forging/Models.meta deleted file mode 100644 index e5104688..00000000 --- a/Assets/Scripts/Netezos/Forging/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c209d786f740145e18eec6f0c4dc7f1c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations.meta b/Assets/Scripts/Netezos/Forging/Models/Operations.meta deleted file mode 100644 index 68ce8700..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bc7e33ba341394f18aead945d82f5ff1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content.meta deleted file mode 100644 index ae993b80..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a260d186400a543638812fd6dfd5ccfe -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ActivationContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ActivationContent.cs deleted file mode 100644 index 6b981bb6..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ActivationContent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class ActivationContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "activate_account"; - - [JsonPropertyName("pkh")] - public string Address { get; set; } - - [JsonPropertyName("secret")] - public string Secret { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ActivationContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ActivationContent.cs.meta deleted file mode 100644 index 292b234a..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ActivationContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d6969a40ec5fc4620949271ca709b98b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/BallotContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/BallotContent.cs deleted file mode 100644 index fd9114f4..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/BallotContent.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class BallotContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "ballot"; - - [JsonPropertyName("source")] - public string Source { get; set; } - - [JsonPropertyName("period")] - public int Period { get; set; } - - [JsonPropertyName("proposal")] - public string Proposal { get; set; } - - [JsonPropertyName("ballot")] - public Ballot Ballot { get; set; } - } - - [JsonConverter(typeof(JsonStringEnumConverter))] - public enum Ballot - { - Yay = 0, - Nay = 1, - Pass = 2 - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/BallotContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/BallotContent.cs.meta deleted file mode 100644 index 0f717fcf..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/BallotContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2494fb6a4c1094f9ab41ebebe436197d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DelegationContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DelegationContent.cs deleted file mode 100644 index ae73eae0..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DelegationContent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class DelegationContent : ManagerOperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "delegation"; - - [JsonPropertyName("delegate")] - public string Delegate { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DelegationContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DelegationContent.cs.meta deleted file mode 100644 index 682f2beb..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DelegationContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3d410e72a558b4992abfff2896fbb6b0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleBakingContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleBakingContent.cs deleted file mode 100644 index fd554a09..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleBakingContent.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class DoubleBakingContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "double_baking_evidence"; - - [JsonPropertyName("bh1")] - public BlockHeader BlockHeader1 { get; set; } - - [JsonPropertyName("bh2")] - public BlockHeader BlockHeader2 { get; set; } - } - - public class BlockHeader - { - [JsonPropertyName("level")] - public int Level { get; set; } - - [JsonPropertyName("proto")] - public int Proto { get; set; } - - [JsonPropertyName("predecessor")] - public string Predecessor { get; set; } - - [JsonPropertyName("timestamp")] - public DateTime Timestamp { get; set; } - - [JsonPropertyName("validation_pass")] - public int ValidationPass { get; set; } - - [JsonPropertyName("operations_hash")] - public string OperationsHash { get; set; } - - [JsonPropertyName("fitness")] - public List Fitness { get; set; } - - [JsonPropertyName("context")] - public string Context { get; set; } - - [JsonPropertyName("payload_hash")] - public string PayloadHash { get; set; } - - [JsonPropertyName("payload_round")] - public int PayloadRound { get; set; } - - [JsonPropertyName("proof_of_work_nonce")] - public string ProofOfWorkNonce { get; set; } - - [JsonPropertyName("seed_nonce_hash")] - public string SeedNonceHash { get; set; } - - [JsonPropertyName("liquidity_baking_toggle_vote")] - public LBToggle LiquidityBakingToggleVote { get; set; } - - [JsonPropertyName("signature")] - public string Signature { get; set; } - } - - [JsonConverter(typeof(JsonStringEnumConverter))] - public enum LBToggle - { - On = 0, - Off = 1, - Pass = 2 - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleBakingContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleBakingContent.cs.meta deleted file mode 100644 index 664de48b..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleBakingContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a14bd2635e8b74d21b9a677a18b40b89 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleEndorsementContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleEndorsementContent.cs deleted file mode 100644 index 7c6824be..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleEndorsementContent.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class DoubleEndorsementContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "double_endorsement_evidence"; - - [JsonPropertyName("op1")] - public InlinedEndorsement Op1 { get; set; } - - [JsonPropertyName("op2")] - public InlinedEndorsement Op2 { get; set; } - } - - public class InlinedEndorsement - { - [JsonPropertyName("branch")] - public string Branch { get; set; } - - [JsonPropertyName("operations")] - public EndorsementContent Operations { get; set; } - - [JsonPropertyName("signature")] - public string Signature { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleEndorsementContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleEndorsementContent.cs.meta deleted file mode 100644 index 2acfce9f..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoubleEndorsementContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 939ce064b17f647388d90cf088799b69 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoublePreendorsementContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoublePreendorsementContent.cs deleted file mode 100644 index 030513da..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoublePreendorsementContent.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class DoublePreendorsementContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "double_preendorsement_evidence"; - - [JsonPropertyName("op1")] - public InlinedPreendorsement Op1 { get; set; } - - [JsonPropertyName("op2")] - public InlinedPreendorsement Op2 { get; set; } - } - - public class InlinedPreendorsement - { - [JsonPropertyName("branch")] - public string Branch { get; set; } - - [JsonPropertyName("operations")] - public PreendorsementContent Operations { get; set; } - - [JsonPropertyName("signature")] - public string Signature { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoublePreendorsementContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoublePreendorsementContent.cs.meta deleted file mode 100644 index d192080b..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/DoublePreendorsementContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 451bca97c12084ff7817506d794c4fab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/EndorsementContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/EndorsementContent.cs deleted file mode 100644 index 3e2549c2..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/EndorsementContent.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class EndorsementContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "endorsement"; - - [JsonPropertyName("slot")] - public int Slot { get; set; } - - [JsonPropertyName("level")] - public int Level { get; set; } - - [JsonPropertyName("round")] - public int Round { get; set; } - - [JsonPropertyName("block_payload_hash")] - public string PayloadHash { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/EndorsementContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/EndorsementContent.cs.meta deleted file mode 100644 index f791e143..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/EndorsementContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a0c2845ad71504a22ab55588574ee222 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/FailingNoopContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/FailingNoopContent.cs deleted file mode 100644 index c7e847ea..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/FailingNoopContent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class FailingNoopContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "failing_noop"; - - [JsonPropertyName("arbitrary")] - public byte[] Bytes { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/FailingNoopContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/FailingNoopContent.cs.meta deleted file mode 100644 index 527c6b47..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/FailingNoopContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e0c7cce97150d43338acf0986c7a1062 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/OriginationContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/OriginationContent.cs deleted file mode 100644 index 937dc765..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/OriginationContent.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Text.Json.Serialization; -using Netezos.Encoding; - -namespace Netezos.Forging.Models -{ - public class OriginationContent : ManagerOperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "origination"; - - [JsonPropertyName("balance")] - [JsonConverter(typeof(Int64StringConverter))] - public long Balance { get; set; } - - [JsonPropertyName("delegate")] - public string Delegate { get; set; } - - [JsonPropertyName("script")] - public Script Script { get; set; } - } - - public class Script - { - [JsonPropertyName("code")] - public MichelineArray Code { get; set; } - - [JsonPropertyName("storage")] - public IMicheline Storage { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/OriginationContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/OriginationContent.cs.meta deleted file mode 100644 index d32c75bd..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/OriginationContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8651d493bef324ba4a5e9b7cb396e83c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/PreendorsementContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/PreendorsementContent.cs deleted file mode 100644 index 3cda849b..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/PreendorsementContent.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class PreendorsementContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "preendorsement"; - - [JsonPropertyName("slot")] - public int Slot { get; set; } - - [JsonPropertyName("level")] - public int Level { get; set; } - - [JsonPropertyName("round")] - public int Round { get; set; } - - [JsonPropertyName("block_payload_hash")] - public string PayloadHash { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/PreendorsementContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/PreendorsementContent.cs.meta deleted file mode 100644 index 81b5a160..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/PreendorsementContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b24b82c01ea6f4ac8baaf105ed54cbb9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ProposalsContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ProposalsContent.cs deleted file mode 100644 index 8032d6be..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ProposalsContent.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class ProposalsContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "proposals"; - - [JsonPropertyName("source")] - public string Source { get; set; } - - [JsonPropertyName("period")] - public int Period { get; set; } - - [JsonPropertyName("proposals")] - public List Proposals { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ProposalsContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ProposalsContent.cs.meta deleted file mode 100644 index 66be422c..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/ProposalsContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 15eafc4a3d475452b8d28f6d281121b3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RegisterConstantContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RegisterConstantContent.cs deleted file mode 100644 index 411e9e3a..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RegisterConstantContent.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; -using Netezos.Encoding; - -namespace Netezos.Forging.Models -{ - public class RegisterConstantContent : ManagerOperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "register_global_constant"; - - [JsonPropertyName("value")] - public IMicheline Value { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RegisterConstantContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RegisterConstantContent.cs.meta deleted file mode 100644 index a1db7267..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RegisterConstantContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5799010dbf67a4a0eab7f109f574a33f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RevealContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RevealContent.cs deleted file mode 100644 index 166d7afa..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RevealContent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class RevealContent : ManagerOperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "reveal"; - - [JsonPropertyName("public_key")] - public string PublicKey { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RevealContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RevealContent.cs.meta deleted file mode 100644 index 9ec5a077..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/RevealContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4d344982d370c4f5186e0cd668b7a8df -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SeedNonceRevelationContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SeedNonceRevelationContent.cs deleted file mode 100644 index 1e4363da..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SeedNonceRevelationContent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class SeedNonceRevelationContent : OperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "seed_nonce_revelation"; - - [JsonPropertyName("level")] - public int Level { get; set; } - - [JsonPropertyName("nonce")] - public string Nonce { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SeedNonceRevelationContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SeedNonceRevelationContent.cs.meta deleted file mode 100644 index e81c6bde..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SeedNonceRevelationContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 87cb1e0d01f0e4a5eb3851300696da0c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SetDepositsLimitContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SetDepositsLimitContent.cs deleted file mode 100644 index 438cd679..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SetDepositsLimitContent.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Numerics; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class SetDepositsLimitContent : ManagerOperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "set_deposits_limit"; - - [JsonPropertyName("limit")] - [JsonConverter(typeof(BigIntegerNullableStringConverter))] - public BigInteger? Limit { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SetDepositsLimitContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SetDepositsLimitContent.cs.meta deleted file mode 100644 index 16ad7248..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/SetDepositsLimitContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: faf5091636b654b00947e0cbdcc4ce4f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/TransactionContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/TransactionContent.cs deleted file mode 100644 index 0a9f3ef7..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/TransactionContent.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Text.Json.Serialization; -using Netezos.Encoding; - -namespace Netezos.Forging.Models -{ - public class TransactionContent : ManagerOperationContent - { - [JsonPropertyName("kind")] - public override string Kind => "transaction"; - - [JsonPropertyName("amount")] - [JsonConverter(typeof(Int64StringConverter))] - public long Amount { get; set; } - - [JsonPropertyName("destination")] - public string Destination { get; set; } - - [JsonPropertyName("parameters")] - public Parameters Parameters { get; set; } - } - - public class Parameters - { - [JsonPropertyName("entrypoint")] - public string Entrypoint { get; set; } - - [JsonPropertyName("value")] - public IMicheline Value { get; set; } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/TransactionContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Content/TransactionContent.cs.meta deleted file mode 100644 index dc9e276d..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Content/TransactionContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 79fd56f82029340c6ae9547e49c8c7a6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/ManagerOperationContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/ManagerOperationContent.cs deleted file mode 100644 index 33c17461..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/ManagerOperationContent.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - [JsonConverter(typeof(ManagerOperationContentConverter))] - public abstract class ManagerOperationContent : OperationContent - { - [JsonPropertyName("source")] - public string Source { get; set; } - - [JsonPropertyName("fee")] - [JsonConverter(typeof(Int64StringConverter))] - public long Fee { get; set; } - - [JsonPropertyName("counter")] - [JsonConverter(typeof(Int32StringConverter))] - public int Counter { get; set; } - - [JsonPropertyName("gas_limit")] - [JsonConverter(typeof(Int32StringConverter))] - public int GasLimit { get; set; } - - [JsonPropertyName("storage_limit")] - [JsonConverter(typeof(Int32StringConverter))] - public int StorageLimit { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/ManagerOperationContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/ManagerOperationContent.cs.meta deleted file mode 100644 index 4a3ae6ed..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/ManagerOperationContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a096813bb1d4452ba41482bbffd6856 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Operation.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/Operation.cs deleted file mode 100644 index cd93ee5a..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Operation.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - public class Operation - { - [JsonPropertyName("hash")] - public string Hash { get; set; } - - [JsonPropertyName("branch")] - public string Branch { get; set; } - - [JsonPropertyName("contents")] - public List Contents { get; set; } - - [JsonPropertyName("signature")] - public string Signature { get; set; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/Operation.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/Operation.cs.meta deleted file mode 100644 index 0f159fa1..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/Operation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bbcb8c882650740a39906667ad2755fa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationContent.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/OperationContent.cs deleted file mode 100644 index 35b8eba5..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationContent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - [JsonConverter(typeof(OperationContentConverter))] - public abstract class OperationContent - { - [JsonPropertyName("kind")] - public abstract string Kind { get; } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationContent.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/OperationContent.cs.meta deleted file mode 100644 index 16d8997e..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 43da2c3277f7f4e2797183cc0042a95b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationTag.cs b/Assets/Scripts/Netezos/Forging/Models/Operations/OperationTag.cs deleted file mode 100644 index 3f50962d..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationTag.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Netezos.Forging.Models -{ - public enum OperationTag - { - SeedNonceRevelation = 1, - DoubleEndorsement = 2, - DoubleBaking = 3, - Activation = 4, - Proposals = 5, - Ballot = 6, - DoublePreendorsement= 7, - FailingNoop = 17, - Preendorsement = 20, - Endorsement = 21, - Reveal = 107, - Transaction = 108, - Origination = 109, - Delegation = 110, - RegisterConstant = 111, - SetDepositsLimit = 112 - } -} diff --git a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationTag.cs.meta b/Assets/Scripts/Netezos/Forging/Models/Operations/OperationTag.cs.meta deleted file mode 100644 index cfa7b4f3..00000000 --- a/Assets/Scripts/Netezos/Forging/Models/Operations/OperationTag.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fa5e29089a98e4441a2c5fc2c2617564 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Remote.meta b/Assets/Scripts/Netezos/Forging/Remote.meta deleted file mode 100644 index 1b1c0c57..00000000 --- a/Assets/Scripts/Netezos/Forging/Remote.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 58998bf719f684cd8ba72aff467d2291 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Forging/Remote/RpcForge.cs b/Assets/Scripts/Netezos/Forging/Remote/RpcForge.cs deleted file mode 100644 index 4f81c1b5..00000000 --- a/Assets/Scripts/Netezos/Forging/Remote/RpcForge.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -using Netezos.Encoding; -using Netezos.Forging.Models; -using Netezos.Rpc; - -namespace Netezos.Forging -{ - public class RpcForge : IForge - { - readonly TezosRpc Rpc; - - public RpcForge(TezosRpc rpc) => Rpc = rpc; - - public IEnumerator ForgeOperationAsync(OperationContent content) - => ForgeAsync(new List { content }); - - public IEnumerator ForgeOperationAsync(string branch, OperationContent content) - => ForgeAsync(branch, new List { content }); - - public IEnumerator ForgeOperationGroupAsync(IEnumerable contents) - => ForgeAsync(contents.Cast().ToList()); - - /// - /// - /// Returns byte[]"/> - public IEnumerator ForgeOperationGroupAsync(string branch, IEnumerable contents) - => ForgeAsync(branch, contents.Cast().ToList()); - - private IEnumerator ForgeAsync(List contents) - { - CoroutineWrapper coroutineWrapper = new CoroutineWrapper(Rpc.Blocks.Head.Hash.GetAsync()); - yield return coroutineWrapper; - string branch = coroutineWrapper.Result; - // TODO: Convert to yield - yield return ForgeAsync(branch, contents); - } - - private IEnumerator ForgeAsync(string branch, List contents) - { - CoroutineWrapper coroutineWrapper = new CoroutineWrapper(Rpc.Blocks.Head.Helpers.Forge.Operations.PostAsync(branch, contents)); - yield return coroutineWrapper; - string result = coroutineWrapper.Result; - - yield return Hex.Parse(result); - } - } -} diff --git a/Assets/Scripts/Netezos/Forging/Remote/RpcForge.cs.meta b/Assets/Scripts/Netezos/Forging/Remote/RpcForge.cs.meta deleted file mode 100644 index 3548de9a..00000000 --- a/Assets/Scripts/Netezos/Forging/Remote/RpcForge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 268b5b042f3e949ee91da935ed77b58b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys.meta b/Assets/Scripts/Netezos/Keys.meta deleted file mode 100644 index 6d0179ec..00000000 --- a/Assets/Scripts/Netezos/Keys.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9a2a26e0f4eea4b3084f68d1b285b0c5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Bip39.meta b/Assets/Scripts/Netezos/Keys/Bip39.meta deleted file mode 100644 index 63c6dfbb..00000000 --- a/Assets/Scripts/Netezos/Keys/Bip39.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 29609e4f724284431b0408329c95aa4e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Bip39/Bip39.cs b/Assets/Scripts/Netezos/Keys/Bip39/Bip39.cs deleted file mode 100644 index 45e8a34c..00000000 --- a/Assets/Scripts/Netezos/Keys/Bip39/Bip39.cs +++ /dev/null @@ -1,338 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; -using Netezos.Encoding; -using Netezos.Utils; - -namespace Netezos.Keys -{ - static class Bip39 - { - static readonly List WordList = new List - { - "abandon", "ability", "able", "about", "above", "absent", "absorb", "abstract", "absurd", "abuse", "access", - "accident", "account", "accuse", "achieve", "acid", "acoustic", "acquire", "across", "act", "action", - "actor", "actress", "actual", "adapt", "add", "addict", "address", "adjust", "admit", "adult", "advance", - "advice", "aerobic", "affair", "afford", "afraid", "again", "age", "agent", "agree", "ahead", "aim", "air", - "airport", "aisle", "alarm", "album", "alcohol", "alert", "alien", "all", "alley", "allow", "almost", - "alone", "alpha", "already", "also", "alter", "always", "amateur", "amazing", "among", "amount", "amused", - "analyst", "anchor", "ancient", "anger", "angle", "angry", "animal", "ankle", "announce", "annual", - "another", "answer", "antenna", "antique", "anxiety", "any", "apart", "apology", "appear", "apple", - "approve", "april", "arch", "arctic", "area", "arena", "argue", "arm", "armed", "armor", "army", "around", - "arrange", "arrest", "arrive", "arrow", "art", "artefact", "artist", "artwork", "ask", "aspect", "assault", - "asset", "assist", "assume", "asthma", "athlete", "atom", "attack", "attend", "attitude", "attract", - "auction", "audit", "august", "aunt", "author", "auto", "autumn", "average", "avocado", "avoid", "awake", - "aware", "away", "awesome", "awful", "awkward", "axis", "baby", "bachelor", "bacon", "badge", "bag", - "balance", "balcony", "ball", "bamboo", "banana", "banner", "bar", "barely", "bargain", "barrel", "base", - "basic", "basket", "battle", "beach", "bean", "beauty", "because", "become", "beef", "before", "begin", - "behave", "behind", "believe", "below", "belt", "bench", "benefit", "best", "betray", "better", "between", - "beyond", "bicycle", "bid", "bike", "bind", "biology", "bird", "birth", "bitter", "black", "blade", "blame", - "blanket", "blast", "bleak", "bless", "blind", "blood", "blossom", "blouse", "blue", "blur", "blush", - "board", "boat", "body", "boil", "bomb", "bone", "bonus", "book", "boost", "border", "boring", "borrow", - "boss", "bottom", "bounce", "box", "boy", "bracket", "brain", "brand", "brass", "brave", "bread", "breeze", - "brick", "bridge", "brief", "bright", "bring", "brisk", "broccoli", "broken", "bronze", "broom", "brother", - "brown", "brush", "bubble", "buddy", "budget", "buffalo", "build", "bulb", "bulk", "bullet", "bundle", - "bunker", "burden", "burger", "burst", "bus", "business", "busy", "butter", "buyer", "buzz", "cabbage", - "cabin", "cable", "cactus", "cage", "cake", "call", "calm", "camera", "camp", "can", "canal", "cancel", - "candy", "cannon", "canoe", "canvas", "canyon", "capable", "capital", "captain", "car", "carbon", "card", - "cargo", "carpet", "carry", "cart", "case", "cash", "casino", "castle", "casual", "cat", "catalog", "catch", - "category", "cattle", "caught", "cause", "caution", "cave", "ceiling", "celery", "cement", "census", - "century", "cereal", "certain", "chair", "chalk", "champion", "change", "chaos", "chapter", "charge", - "chase", "chat", "cheap", "check", "cheese", "chef", "cherry", "chest", "chicken", "chief", "child", - "chimney", "choice", "choose", "chronic", "chuckle", "chunk", "churn", "cigar", "cinnamon", "circle", - "citizen", "city", "civil", "claim", "clap", "clarify", "claw", "clay", "clean", "clerk", "clever", "click", - "client", "cliff", "climb", "clinic", "clip", "clock", "clog", "close", "cloth", "cloud", "clown", "club", - "clump", "cluster", "clutch", "coach", "coast", "coconut", "code", "coffee", "coil", "coin", "collect", - "color", "column", "combine", "come", "comfort", "comic", "common", "company", "concert", "conduct", - "confirm", "congress", "connect", "consider", "control", "convince", "cook", "cool", "copper", "copy", - "coral", "core", "corn", "correct", "cost", "cotton", "couch", "country", "couple", "course", "cousin", - "cover", "coyote", "crack", "cradle", "craft", "cram", "crane", "crash", "crater", "crawl", "crazy", - "cream", "credit", "creek", "crew", "cricket", "crime", "crisp", "critic", "crop", "cross", "crouch", - "crowd", "crucial", "cruel", "cruise", "crumble", "crunch", "crush", "cry", "crystal", "cube", "culture", - "cup", "cupboard", "curious", "current", "curtain", "curve", "cushion", "custom", "cute", "cycle", "dad", - "damage", "damp", "dance", "danger", "daring", "dash", "daughter", "dawn", "day", "deal", "debate", - "debris", "decade", "december", "decide", "decline", "decorate", "decrease", "deer", "defense", "define", - "defy", "degree", "delay", "deliver", "demand", "demise", "denial", "dentist", "deny", "depart", "depend", - "deposit", "depth", "deputy", "derive", "describe", "desert", "design", "desk", "despair", "destroy", - "detail", "detect", "develop", "device", "devote", "diagram", "dial", "diamond", "diary", "dice", "diesel", - "diet", "differ", "digital", "dignity", "dilemma", "dinner", "dinosaur", "direct", "dirt", "disagree", - "discover", "disease", "dish", "dismiss", "disorder", "display", "distance", "divert", "divide", "divorce", - "dizzy", "doctor", "document", "dog", "doll", "dolphin", "domain", "donate", "donkey", "donor", "door", - "dose", "double", "dove", "draft", "dragon", "drama", "drastic", "draw", "dream", "dress", "drift", "drill", - "drink", "drip", "drive", "drop", "drum", "dry", "duck", "dumb", "dune", "during", "dust", "dutch", "duty", - "dwarf", "dynamic", "eager", "eagle", "early", "earn", "earth", "easily", "east", "easy", "echo", "ecology", - "economy", "edge", "edit", "educate", "effort", "egg", "eight", "either", "elbow", "elder", "electric", - "elegant", "element", "elephant", "elevator", "elite", "else", "embark", "embody", "embrace", "emerge", - "emotion", "employ", "empower", "empty", "enable", "enact", "end", "endless", "endorse", "enemy", "energy", - "enforce", "engage", "engine", "enhance", "enjoy", "enlist", "enough", "enrich", "enroll", "ensure", - "enter", "entire", "entry", "envelope", "episode", "equal", "equip", "era", "erase", "erode", "erosion", - "error", "erupt", "escape", "essay", "essence", "estate", "eternal", "ethics", "evidence", "evil", "evoke", - "evolve", "exact", "example", "excess", "exchange", "excite", "exclude", "excuse", "execute", "exercise", - "exhaust", "exhibit", "exile", "exist", "exit", "exotic", "expand", "expect", "expire", "explain", "expose", - "express", "extend", "extra", "eye", "eyebrow", "fabric", "face", "faculty", "fade", "faint", "faith", - "fall", "false", "fame", "family", "famous", "fan", "fancy", "fantasy", "farm", "fashion", "fat", "fatal", - "father", "fatigue", "fault", "favorite", "feature", "february", "federal", "fee", "feed", "feel", "female", - "fence", "festival", "fetch", "fever", "few", "fiber", "fiction", "field", "figure", "file", "film", - "filter", "final", "find", "fine", "finger", "finish", "fire", "firm", "first", "fiscal", "fish", "fit", - "fitness", "fix", "flag", "flame", "flash", "flat", "flavor", "flee", "flight", "flip", "float", "flock", - "floor", "flower", "fluid", "flush", "fly", "foam", "focus", "fog", "foil", "fold", "follow", "food", - "foot", "force", "forest", "forget", "fork", "fortune", "forum", "forward", "fossil", "foster", "found", - "fox", "fragile", "frame", "frequent", "fresh", "friend", "fringe", "frog", "front", "frost", "frown", - "frozen", "fruit", "fuel", "fun", "funny", "furnace", "fury", "future", "gadget", "gain", "galaxy", - "gallery", "game", "gap", "garage", "garbage", "garden", "garlic", "garment", "gas", "gasp", "gate", - "gather", "gauge", "gaze", "general", "genius", "genre", "gentle", "genuine", "gesture", "ghost", "giant", - "gift", "giggle", "ginger", "giraffe", "girl", "give", "glad", "glance", "glare", "glass", "glide", - "glimpse", "globe", "gloom", "glory", "glove", "glow", "glue", "goat", "goddess", "gold", "good", "goose", - "gorilla", "gospel", "gossip", "govern", "gown", "grab", "grace", "grain", "grant", "grape", "grass", - "gravity", "great", "green", "grid", "grief", "grit", "grocery", "group", "grow", "grunt", "guard", "guess", - "guide", "guilt", "guitar", "gun", "gym", "habit", "hair", "half", "hammer", "hamster", "hand", "happy", - "harbor", "hard", "harsh", "harvest", "hat", "have", "hawk", "hazard", "head", "health", "heart", "heavy", - "hedgehog", "height", "hello", "helmet", "help", "hen", "hero", "hidden", "high", "hill", "hint", "hip", - "hire", "history", "hobby", "hockey", "hold", "hole", "holiday", "hollow", "home", "honey", "hood", "hope", - "horn", "horror", "horse", "hospital", "host", "hotel", "hour", "hover", "hub", "huge", "human", "humble", - "humor", "hundred", "hungry", "hunt", "hurdle", "hurry", "hurt", "husband", "hybrid", "ice", "icon", "idea", - "identify", "idle", "ignore", "ill", "illegal", "illness", "image", "imitate", "immense", "immune", - "impact", "impose", "improve", "impulse", "inch", "include", "income", "increase", "index", "indicate", - "indoor", "industry", "infant", "inflict", "inform", "inhale", "inherit", "initial", "inject", "injury", - "inmate", "inner", "innocent", "input", "inquiry", "insane", "insect", "inside", "inspire", "install", - "intact", "interest", "into", "invest", "invite", "involve", "iron", "island", "isolate", "issue", "item", - "ivory", "jacket", "jaguar", "jar", "jazz", "jealous", "jeans", "jelly", "jewel", "job", "join", "joke", - "journey", "joy", "judge", "juice", "jump", "jungle", "junior", "junk", "just", "kangaroo", "keen", "keep", - "ketchup", "key", "kick", "kid", "kidney", "kind", "kingdom", "kiss", "kit", "kitchen", "kite", "kitten", - "kiwi", "knee", "knife", "knock", "know", "lab", "label", "labor", "ladder", "lady", "lake", "lamp", - "language", "laptop", "large", "later", "latin", "laugh", "laundry", "lava", "law", "lawn", "lawsuit", - "layer", "lazy", "leader", "leaf", "learn", "leave", "lecture", "left", "leg", "legal", "legend", "leisure", - "lemon", "lend", "length", "lens", "leopard", "lesson", "letter", "level", "liar", "liberty", "library", - "license", "life", "lift", "light", "like", "limb", "limit", "link", "lion", "liquid", "list", "little", - "live", "lizard", "load", "loan", "lobster", "local", "lock", "logic", "lonely", "long", "loop", "lottery", - "loud", "lounge", "love", "loyal", "lucky", "luggage", "lumber", "lunar", "lunch", "luxury", "lyrics", - "machine", "mad", "magic", "magnet", "maid", "mail", "main", "major", "make", "mammal", "man", "manage", - "mandate", "mango", "mansion", "manual", "maple", "marble", "march", "margin", "marine", "market", - "marriage", "mask", "mass", "master", "match", "material", "math", "matrix", "matter", "maximum", "maze", - "meadow", "mean", "measure", "meat", "mechanic", "medal", "media", "melody", "melt", "member", "memory", - "mention", "menu", "mercy", "merge", "merit", "merry", "mesh", "message", "metal", "method", "middle", - "midnight", "milk", "million", "mimic", "mind", "minimum", "minor", "minute", "miracle", "mirror", "misery", - "miss", "mistake", "mix", "mixed", "mixture", "mobile", "model", "modify", "mom", "moment", "monitor", - "monkey", "monster", "month", "moon", "moral", "more", "morning", "mosquito", "mother", "motion", "motor", - "mountain", "mouse", "move", "movie", "much", "muffin", "mule", "multiply", "muscle", "museum", "mushroom", - "music", "must", "mutual", "myself", "mystery", "myth", "naive", "name", "napkin", "narrow", "nasty", - "nation", "nature", "near", "neck", "need", "negative", "neglect", "neither", "nephew", "nerve", "nest", - "net", "network", "neutral", "never", "news", "next", "nice", "night", "noble", "noise", "nominee", - "noodle", "normal", "north", "nose", "notable", "note", "nothing", "notice", "novel", "now", "nuclear", - "number", "nurse", "nut", "oak", "obey", "object", "oblige", "obscure", "observe", "obtain", "obvious", - "occur", "ocean", "october", "odor", "off", "offer", "office", "often", "oil", "okay", "old", "olive", - "olympic", "omit", "once", "one", "onion", "online", "only", "open", "opera", "opinion", "oppose", "option", - "orange", "orbit", "orchard", "order", "ordinary", "organ", "orient", "original", "orphan", "ostrich", - "other", "outdoor", "outer", "output", "outside", "oval", "oven", "over", "own", "owner", "oxygen", - "oyster", "ozone", "pact", "paddle", "page", "pair", "palace", "palm", "panda", "panel", "panic", "panther", - "paper", "parade", "parent", "park", "parrot", "party", "pass", "patch", "path", "patient", "patrol", - "pattern", "pause", "pave", "payment", "peace", "peanut", "pear", "peasant", "pelican", "pen", "penalty", - "pencil", "people", "pepper", "perfect", "permit", "person", "pet", "phone", "photo", "phrase", "physical", - "piano", "picnic", "picture", "piece", "pig", "pigeon", "pill", "pilot", "pink", "pioneer", "pipe", - "pistol", "pitch", "pizza", "place", "planet", "plastic", "plate", "play", "please", "pledge", "pluck", - "plug", "plunge", "poem", "poet", "point", "polar", "pole", "police", "pond", "pony", "pool", "popular", - "portion", "position", "possible", "post", "potato", "pottery", "poverty", "powder", "power", "practice", - "praise", "predict", "prefer", "prepare", "present", "pretty", "prevent", "price", "pride", "primary", - "print", "priority", "prison", "private", "prize", "problem", "process", "produce", "profit", "program", - "project", "promote", "proof", "property", "prosper", "protect", "proud", "provide", "public", "pudding", - "pull", "pulp", "pulse", "pumpkin", "punch", "pupil", "puppy", "purchase", "purity", "purpose", "purse", - "push", "put", "puzzle", "pyramid", "quality", "quantum", "quarter", "question", "quick", "quit", "quiz", - "quote", "rabbit", "raccoon", "race", "rack", "radar", "radio", "rail", "rain", "raise", "rally", "ramp", - "ranch", "random", "range", "rapid", "rare", "rate", "rather", "raven", "raw", "razor", "ready", "real", - "reason", "rebel", "rebuild", "recall", "receive", "recipe", "record", "recycle", "reduce", "reflect", - "reform", "refuse", "region", "regret", "regular", "reject", "relax", "release", "relief", "rely", "remain", - "remember", "remind", "remove", "render", "renew", "rent", "reopen", "repair", "repeat", "replace", - "report", "require", "rescue", "resemble", "resist", "resource", "response", "result", "retire", "retreat", - "return", "reunion", "reveal", "review", "reward", "rhythm", "rib", "ribbon", "rice", "rich", "ride", - "ridge", "rifle", "right", "rigid", "ring", "riot", "ripple", "risk", "ritual", "rival", "river", "road", - "roast", "robot", "robust", "rocket", "romance", "roof", "rookie", "room", "rose", "rotate", "rough", - "round", "route", "royal", "rubber", "rude", "rug", "rule", "run", "runway", "rural", "sad", "saddle", - "sadness", "safe", "sail", "salad", "salmon", "salon", "salt", "salute", "same", "sample", "sand", - "satisfy", "satoshi", "sauce", "sausage", "save", "say", "scale", "scan", "scare", "scatter", "scene", - "scheme", "school", "science", "scissors", "scorpion", "scout", "scrap", "screen", "script", "scrub", "sea", - "search", "season", "seat", "second", "secret", "section", "security", "seed", "seek", "segment", "select", - "sell", "seminar", "senior", "sense", "sentence", "series", "service", "session", "settle", "setup", - "seven", "shadow", "shaft", "shallow", "share", "shed", "shell", "sheriff", "shield", "shift", "shine", - "ship", "shiver", "shock", "shoe", "shoot", "shop", "short", "shoulder", "shove", "shrimp", "shrug", - "shuffle", "shy", "sibling", "sick", "side", "siege", "sight", "sign", "silent", "silk", "silly", "silver", - "similar", "simple", "since", "sing", "siren", "sister", "situate", "six", "size", "skate", "sketch", "ski", - "skill", "skin", "skirt", "skull", "slab", "slam", "sleep", "slender", "slice", "slide", "slight", "slim", - "slogan", "slot", "slow", "slush", "small", "smart", "smile", "smoke", "smooth", "snack", "snake", "snap", - "sniff", "snow", "soap", "soccer", "social", "sock", "soda", "soft", "solar", "soldier", "solid", - "solution", "solve", "someone", "song", "soon", "sorry", "sort", "soul", "sound", "soup", "source", "south", - "space", "spare", "spatial", "spawn", "speak", "special", "speed", "spell", "spend", "sphere", "spice", - "spider", "spike", "spin", "spirit", "split", "spoil", "sponsor", "spoon", "sport", "spot", "spray", - "spread", "spring", "spy", "square", "squeeze", "squirrel", "stable", "stadium", "staff", "stage", "stairs", - "stamp", "stand", "start", "state", "stay", "steak", "steel", "stem", "step", "stereo", "stick", "still", - "sting", "stock", "stomach", "stone", "stool", "story", "stove", "strategy", "street", "strike", "strong", - "struggle", "student", "stuff", "stumble", "style", "subject", "submit", "subway", "success", "such", - "sudden", "suffer", "sugar", "suggest", "suit", "summer", "sun", "sunny", "sunset", "super", "supply", - "supreme", "sure", "surface", "surge", "surprise", "surround", "survey", "suspect", "sustain", "swallow", - "swamp", "swap", "swarm", "swear", "sweet", "swift", "swim", "swing", "switch", "sword", "symbol", - "symptom", "syrup", "system", "table", "tackle", "tag", "tail", "talent", "talk", "tank", "tape", "target", - "task", "taste", "tattoo", "taxi", "teach", "team", "tell", "ten", "tenant", "tennis", "tent", "term", - "test", "text", "thank", "that", "theme", "then", "theory", "there", "they", "thing", "this", "thought", - "three", "thrive", "throw", "thumb", "thunder", "ticket", "tide", "tiger", "tilt", "timber", "time", "tiny", - "tip", "tired", "tissue", "title", "toast", "tobacco", "today", "toddler", "toe", "together", "toilet", - "token", "tomato", "tomorrow", "tone", "tongue", "tonight", "tool", "tooth", "top", "topic", "topple", - "torch", "tornado", "tortoise", "toss", "total", "tourist", "toward", "tower", "town", "toy", "track", - "trade", "traffic", "tragic", "train", "transfer", "trap", "trash", "travel", "tray", "treat", "tree", - "trend", "trial", "tribe", "trick", "trigger", "trim", "trip", "trophy", "trouble", "truck", "true", - "truly", "trumpet", "trust", "truth", "try", "tube", "tuition", "tumble", "tuna", "tunnel", "turkey", - "turn", "turtle", "twelve", "twenty", "twice", "twin", "twist", "two", "type", "typical", "ugly", - "umbrella", "unable", "unaware", "uncle", "uncover", "under", "undo", "unfair", "unfold", "unhappy", - "uniform", "unique", "unit", "universe", "unknown", "unlock", "until", "unusual", "unveil", "update", - "upgrade", "uphold", "upon", "upper", "upset", "urban", "urge", "usage", "use", "used", "useful", "useless", - "usual", "utility", "vacant", "vacuum", "vague", "valid", "valley", "valve", "van", "vanish", "vapor", - "various", "vast", "vault", "vehicle", "velvet", "vendor", "venture", "venue", "verb", "verify", "version", - "very", "vessel", "veteran", "viable", "vibrant", "vicious", "victory", "video", "view", "village", - "vintage", "violin", "virtual", "virus", "visa", "visit", "visual", "vital", "vivid", "vocal", "voice", - "void", "volcano", "volume", "vote", "voyage", "wage", "wagon", "wait", "walk", "wall", "walnut", "want", - "warfare", "warm", "warrior", "wash", "wasp", "waste", "water", "wave", "way", "wealth", "weapon", "wear", - "weasel", "weather", "web", "wedding", "weekend", "weird", "welcome", "west", "wet", "whale", "what", - "wheat", "wheel", "when", "where", "whip", "whisper", "wide", "width", "wife", "wild", "will", "win", - "window", "wine", "wing", "wink", "winner", "winter", "wire", "wisdom", "wise", "wish", "witness", "wolf", - "woman", "wonder", "wood", "wool", "word", "work", "world", "worry", "worth", "wrap", "wreck", "wrestle", - "wrist", "write", "wrong", "yard", "year", "yellow", "you", "young", "youth", "zebra", "zero", "zone", "zoo" - }; - - public static byte[] GetEntropy(IEnumerable words) - { - if (words == null) - throw new ArgumentNullException(nameof(words)); - - if (!words.Any()) - throw new ArgumentException("Word list is empty"); - - var wordsCnt = words.Count(); - - if (wordsCnt % 3 > 0) - throw new ArgumentException("Word list size must be a multiple of 3"); - - var concatBitsCnt = wordsCnt * 11; - var concatBits = new byte[concatBitsCnt]; - - var wordIndex = 0; - foreach (string word in words) - { - int index = WordList.BinarySearch(word); - - if (index < 0) - throw new ArgumentException($"Invalid mnemonic word '{word}'"); - - concatBits[(wordIndex * 11) + 0] = (byte)(index >> 10 & 1); - concatBits[(wordIndex * 11) + 1] = (byte)(index >> 9 & 1); - concatBits[(wordIndex * 11) + 2] = (byte)(index >> 8 & 1); - concatBits[(wordIndex * 11) + 3] = (byte)(index >> 7 & 1); - concatBits[(wordIndex * 11) + 4] = (byte)(index >> 6 & 1); - concatBits[(wordIndex * 11) + 5] = (byte)(index >> 5 & 1); - concatBits[(wordIndex * 11) + 6] = (byte)(index >> 4 & 1); - concatBits[(wordIndex * 11) + 7] = (byte)(index >> 3 & 1); - concatBits[(wordIndex * 11) + 8] = (byte)(index >> 2 & 1); - concatBits[(wordIndex * 11) + 9] = (byte)(index >> 1 & 1); - concatBits[(wordIndex * 11) + 10] = (byte)(index >> 0 & 1); - - ++wordIndex; - } - - int checksumBitsCnt = concatBitsCnt / 33; - int entropyBitsCnt = concatBitsCnt - checksumBitsCnt; - - byte[] entropy = new byte[entropyBitsCnt / 8]; - for (int i = 0; i < entropy.Length; ++i) - { - entropy[i] = (byte)( - concatBits[(i * 8) + 0] << 7 | - concatBits[(i * 8) + 1] << 6 | - concatBits[(i * 8) + 2] << 5 | - concatBits[(i * 8) + 3] << 4 | - concatBits[(i * 8) + 4] << 3 | - concatBits[(i * 8) + 5] << 2 | - concatBits[(i * 8) + 6] << 1 | - concatBits[(i * 8) + 7] << 0); - } - - byte[] hashBits = null; - using (var sha256 = SHA256.Create()) - { - var hash = sha256.ComputeHash(entropy); - hashBits = BytesToBits(hash); - } - - for (int i = 0; i < checksumBitsCnt; ++i) - if (concatBits[entropyBitsCnt + i] != hashBits[i]) - throw new Exception("Invalid checksum"); - - return entropy; - } - - public static byte[] GetSeed(string words, string passphrase = "") - { - if (string.IsNullOrWhiteSpace(words)) - throw new ArgumentNullException(nameof(words)); - - var pass = Utf8.Parse(words); - var salt = Utf8.Parse("mnemonic" + passphrase); - return Pbkdf2.ComputeDerivedKey(new HMACSHA512(pass), salt, 2048, 64); - } - - public static List GetMnemonic(byte[] entropy) - { - if (entropy == null || entropy.Length == 0) - throw new ArgumentException("Entropy is empty"); - - else if (entropy.Length % 4 > 0) - throw new ArgumentException("Entropy length is not a multiple of 4"); - - byte[] hashBits = null; - using (var sha256 = SHA256.Create()) - { - var hash = sha256.ComputeHash(entropy); - hashBits = BytesToBits(hash); - } - - var entropyBits = BytesToBits(entropy); - var bits = entropyBits.Concat(hashBits, entropyBits.Length / 32); - - var words = new List(); - var wordsCnt = bits.Length / 11; - for (int i = 0; i < wordsCnt; ++i) - { - words.Add(WordList[ - bits[(i * 11) + 0] << 10 | - bits[(i * 11) + 1] << 9 | - bits[(i * 11) + 2] << 8 | - bits[(i * 11) + 3] << 7 | - bits[(i * 11) + 4] << 6 | - bits[(i * 11) + 5] << 5 | - bits[(i * 11) + 6] << 4 | - bits[(i * 11) + 7] << 3 | - bits[(i * 11) + 8] << 2 | - bits[(i * 11) + 9] << 1 | - bits[(i * 11) + 10] << 0]); - } - - return words; - } - - static byte[] BytesToBits(byte[] data) - { - var bits = new byte[data.Length * 8]; - - for (int i = 0; i < data.Length; ++i) - { - bits[(i * 8) + 0] = (byte)(data[i] >> 7 & 1); - bits[(i * 8) + 1] = (byte)(data[i] >> 6 & 1); - bits[(i * 8) + 2] = (byte)(data[i] >> 5 & 1); - bits[(i * 8) + 3] = (byte)(data[i] >> 4 & 1); - bits[(i * 8) + 4] = (byte)(data[i] >> 3 & 1); - bits[(i * 8) + 5] = (byte)(data[i] >> 2 & 1); - bits[(i * 8) + 6] = (byte)(data[i] >> 1 & 1); - bits[(i * 8) + 7] = (byte)(data[i] >> 0 & 1); - } - - return bits; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Keys/Bip39/Bip39.cs.meta b/Assets/Scripts/Netezos/Keys/Bip39/Bip39.cs.meta deleted file mode 100644 index d3de0b23..00000000 --- a/Assets/Scripts/Netezos/Keys/Bip39/Bip39.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1bfb8b1db8f434baa8c8cc6c0256c245 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Bip39/Mnemonic.cs b/Assets/Scripts/Netezos/Keys/Bip39/Mnemonic.cs deleted file mode 100644 index bec60e86..00000000 --- a/Assets/Scripts/Netezos/Keys/Bip39/Mnemonic.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Collections.Generic; -using System.Text.RegularExpressions; - -using Netezos.Utils; - -namespace Netezos.Keys -{ - public class Mnemonic - { - readonly string Sentence; - - public Mnemonic() : this(MnemonicSize.M15) { } - - public Mnemonic(MnemonicSize size) - { - var entropy = RNG.GetNonZeroBytes((int)size * 4 / 3); - var words = Bip39.GetMnemonic(entropy); - - Sentence = string.Join(" ", words); - } - - public Mnemonic(string mnemonic) => Sentence = Regex.Replace(mnemonic, @"[\s,;]+", " "); - - public Mnemonic(IEnumerable words) => Sentence = string.Join(" ", words); - - public byte[] GetSeed() => Bip39.GetSeed(Sentence); - - public byte[] GetSeed(string passphrase) => Bip39.GetSeed(Sentence, passphrase); - - public override string ToString() => Sentence; - - #region static - public static Mnemonic Parse(string mnemonic) => new Mnemonic(mnemonic); - - public static Mnemonic Parse(IEnumerable words) => new Mnemonic(words); - #endregion - } - - public enum MnemonicSize - { - M12 = 12, - M15 = 15, - M18 = 18, - M21 = 21, - M24 = 24, - } -} diff --git a/Assets/Scripts/Netezos/Keys/Bip39/Mnemonic.cs.meta b/Assets/Scripts/Netezos/Keys/Bip39/Mnemonic.cs.meta deleted file mode 100644 index c7f56528..00000000 --- a/Assets/Scripts/Netezos/Keys/Bip39/Mnemonic.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 224f0d41725464c6d877c7d882f424d2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto.meta b/Assets/Scripts/Netezos/Keys/Crypto.meta deleted file mode 100644 index 34804949..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 756bd3d400faf4c1ab1d9b20baf74fdf -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curve.cs b/Assets/Scripts/Netezos/Keys/Crypto/Curve.cs deleted file mode 100644 index eed0a239..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curve.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; - -namespace Netezos.Keys -{ - abstract class Curve - { - public abstract ECKind Kind { get; } - - public abstract byte[] AddressPrefix { get; } - public abstract byte[] PublicKeyPrefix { get; } - public abstract byte[] PrivateKeyPrefix { get; } - public abstract byte[] SignaturePrefix { get; } - public abstract byte[] SeedKey { get; } - - public abstract byte[] GeneratePrivateKey(); - - public abstract byte[] GetPublicKey(byte[] privateKey); - - public abstract Signature Sign(byte[] bytes, byte[] prvKey); - - public abstract bool Verify(byte[] bytes, byte[] signature, byte[] pubKey); - - #region static - public static Curve FromKind(ECKind kind) - { - return kind == ECKind.Ed25519 - ? new Ed25519() - : kind == ECKind.NistP256 - ? (Curve)new NistP256() - : new Secp256k1(); - } - - public static Curve FromPrefix(string prefix) - { - switch (prefix) - { - case "edpk": - case "edsk": - case "tz1": - case "edesk": - case "edsig": - return new Ed25519(); - case "sppk": - case "spsk": - case "tz2": - case "spesk": - case "spsig": - return new Secp256k1(); - case "p2pk": - case "p2sk": - case "tz3": - case "p2esk": - case "p2sig": - return new NistP256(); - default: - throw new ArgumentException("Invalid prefix"); - } - } - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curve.cs.meta b/Assets/Scripts/Netezos/Keys/Crypto/Curve.cs.meta deleted file mode 100644 index a62acdc7..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curve.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b88176061a7c347e1ab63449436fdad6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves.meta b/Assets/Scripts/Netezos/Keys/Crypto/Curves.meta deleted file mode 100644 index 032a15f1..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d292d3d3fe4e45fb929f06ae2809984 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Ed25519.cs b/Assets/Scripts/Netezos/Keys/Crypto/Curves/Ed25519.cs deleted file mode 100644 index cb20c8e0..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Ed25519.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Crypto.Signers; -using BcEd25519 = Org.BouncyCastle.Math.EC.Rfc8032.Ed25519; -using Netezos.Utils; - -namespace Netezos.Keys -{ - class Ed25519 : Curve - { - #region static - static readonly byte[] _SeedKey = { 101, 100, 50, 53, 53, 49, 57, 32, 115, 101, 101, 100 }; // "ed25519 seed" - #endregion - - public override ECKind Kind => ECKind.Ed25519; - - public override byte[] AddressPrefix => Prefix.tz1; - public override byte[] PublicKeyPrefix => Prefix.edpk; - public override byte[] PrivateKeyPrefix => Prefix.edsk; - public override byte[] SignaturePrefix => Prefix.edsig; - public override byte[] SeedKey => _SeedKey; - - public override byte[] GeneratePrivateKey() - { - return RNG.GetBytes(32); - } - - public override byte[] GetPublicKey(byte[] privateKey) - { - var publicKey = new byte[32]; - BcEd25519.GeneratePublicKey(privateKey, 0, publicKey, 0); - - return publicKey; - } - - public override Signature Sign(byte[] msg, byte[] prvKey) - { - var digest = Blake2b.GetDigest(msg); - var privateKey = new Ed25519PrivateKeyParameters(prvKey, 0); - var signer = new Ed25519Signer(); - - signer.Init(true, privateKey); - signer.BlockUpdate(digest, 0, digest.Length); - - return new Signature(signer.GenerateSignature(), SignaturePrefix); - } - - public override bool Verify(byte[] msg, byte[] sig, byte[] pubKey) - { - var digest = Blake2b.GetDigest(msg); - var publicKey = new Ed25519PublicKeyParameters(pubKey, 0); - var verifier = new Ed25519Signer(); - - verifier.Init(false, publicKey); - verifier.BlockUpdate(digest, 0, digest.Length); - - return verifier.VerifySignature(sig); - } - } -} diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Ed25519.cs.meta b/Assets/Scripts/Netezos/Keys/Crypto/Curves/Ed25519.cs.meta deleted file mode 100644 index a063716f..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Ed25519.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0431ff47df8ad4645a43621e79275675 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves/NistP256.cs b/Assets/Scripts/Netezos/Keys/Crypto/Curves/NistP256.cs deleted file mode 100644 index 968f12bf..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves/NistP256.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Org.BouncyCastle.Asn1.Sec; -using Org.BouncyCastle.Crypto.Digests; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Crypto.Signers; -using Org.BouncyCastle.Math; -using Netezos.Utils; - -namespace Netezos.Keys -{ - class NistP256 : Curve - { - #region static - static readonly byte[] _SeedKey = { 78, 105, 115, 116, 50, 53, 54, 112, 49, 32, 115, 101, 101, 100 }; // "Nist256p1 seed" - #endregion - - public override ECKind Kind => ECKind.NistP256; - - public override byte[] AddressPrefix => Prefix.tz3; - public override byte[] PublicKeyPrefix => Prefix.p2pk; - public override byte[] PrivateKeyPrefix => Prefix.p2sk; - public override byte[] SignaturePrefix => Prefix.p2sig; - public override byte[] SeedKey => _SeedKey; - - public override byte[] GeneratePrivateKey() - { - var curve = SecNamedCurves.GetByName("secp256r1"); - byte[] res = new byte[32]; - - do { RNG.WriteBytes(res); } - while (new BigInteger(1, res).CompareTo(curve.N) >= 0); - - return res; - } - - public override byte[] GetPublicKey(byte[] privateKey) - { - var curve = SecNamedCurves.GetByName("secp256r1"); - var parameters = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H, curve.GetSeed()); - var key = new ECPrivateKeyParameters(new BigInteger(1, privateKey), parameters); - - var q = key.Parameters.G.Multiply(key.D); - return q.GetEncoded(true); - } - - public override Signature Sign(byte[] msg, byte[] prvKey) - { - var curve = SecNamedCurves.GetByName("secp256r1"); - var parameters = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H, curve.GetSeed()); - var privateKey = new ECPrivateKeyParameters(new BigInteger(1, prvKey), parameters); - var signer = new ECDsaSigner(new HMacDsaKCalculator(new Blake2bDigest(256))); - - signer.Init(true, privateKey); - var rs = signer.GenerateSignature(Blake2b.GetDigest(msg)); - - if (rs[1].CompareTo(curve.N.Divide(BigInteger.Two)) > 0) - rs[1] = curve.N.Subtract(rs[1]); - - var r = rs[0].ToByteArrayUnsigned().Align(32); - var s = rs[1].ToByteArrayUnsigned().Align(32); - - return new Signature(r.Concat(s), SignaturePrefix); - } - - public override bool Verify(byte[] msg, byte[] sig, byte[] pubKey) - { - var digest = Blake2b.GetDigest(msg); - var r = sig.GetBytes(0, 32); - var s = sig.GetBytes(32, 32); - - var curve = SecNamedCurves.GetByName("secp256r1"); - var parameters = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H, curve.GetSeed()); - var publicKey = new ECPublicKeyParameters(curve.Curve.DecodePoint(pubKey), parameters); - var signer = new ECDsaSigner(); - - signer.Init(false, publicKey); - return signer.VerifySignature(digest, new BigInteger(1, r), new BigInteger(1, s)); - } - } -} diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves/NistP256.cs.meta b/Assets/Scripts/Netezos/Keys/Crypto/Curves/NistP256.cs.meta deleted file mode 100644 index 6c16f533..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves/NistP256.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 12d332a446b244c5cbbfe3057dc6bfa3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Secp256k1.cs b/Assets/Scripts/Netezos/Keys/Crypto/Curves/Secp256k1.cs deleted file mode 100644 index 15a97bd3..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Secp256k1.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Org.BouncyCastle.Asn1.Sec; -using Org.BouncyCastle.Crypto.Digests; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Crypto.Signers; -using Org.BouncyCastle.Math; -using Netezos.Utils; - -namespace Netezos.Keys -{ - class Secp256k1 : Curve - { - #region static - static readonly byte[] _SeedKey = { 66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100 }; // "Bitcoin seed" - #endregion - - public override ECKind Kind => ECKind.Secp256k1; - - public override byte[] AddressPrefix => Prefix.tz2; - public override byte[] PublicKeyPrefix => Prefix.sppk; - public override byte[] PrivateKeyPrefix => Prefix.spsk; - public override byte[] SignaturePrefix => Prefix.spsig; - public override byte[] SeedKey => _SeedKey; - - public override byte[] GeneratePrivateKey() - { - var curve = SecNamedCurves.GetByName("secp256k1"); - byte[] res = new byte[32]; - - do { RNG.WriteBytes(res); } - while (new BigInteger(1, res).CompareTo(curve.N) >= 0); - - return res; - } - - public override byte[] GetPublicKey(byte[] privateKey) - { - var curve = SecNamedCurves.GetByName("secp256k1"); - var parameters = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H, curve.GetSeed()); - var key = new ECPrivateKeyParameters(new BigInteger(1, privateKey), parameters); - - var q = key.Parameters.G.Multiply(key.D); - return q.GetEncoded(true); - } - - public override Signature Sign(byte[] msg, byte[] prvKey) - { - var curve = SecNamedCurves.GetByName("secp256k1"); - var parameters = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H, curve.GetSeed()); - var privateKey = new ECPrivateKeyParameters(new BigInteger(1, prvKey), parameters); - var signer = new ECDsaSigner(new HMacDsaKCalculator(new Blake2bDigest(256))); - - signer.Init(true, privateKey); - var rs = signer.GenerateSignature(Blake2b.GetDigest(msg)); - - if (rs[1].CompareTo(curve.N.Divide(BigInteger.Two)) > 0) - rs[1] = curve.N.Subtract(rs[1]); - - var r = rs[0].ToByteArrayUnsigned().Align(32); - var s = rs[1].ToByteArrayUnsigned().Align(32); - - return new Signature(r.Concat(s), SignaturePrefix); - } - - public override bool Verify(byte[] msg, byte[] sig, byte[] pubKey) - { - var digest = Blake2b.GetDigest(msg); - var r = sig.GetBytes(0, 32); - var s = sig.GetBytes(32, 32); - - var curve = SecNamedCurves.GetByName("secp256k1"); - var parameters = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H, curve.GetSeed()); - var publicKey = new ECPublicKeyParameters(curve.Curve.DecodePoint(pubKey), parameters); - var signer = new ECDsaSigner(); - - signer.Init(false, publicKey); - return signer.VerifySignature(digest, new BigInteger(1, r), new BigInteger(1, s)); - } - } -} diff --git a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Secp256k1.cs.meta b/Assets/Scripts/Netezos/Keys/Crypto/Curves/Secp256k1.cs.meta deleted file mode 100644 index ec7bc82f..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/Curves/Secp256k1.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a7ba8c6c9ed44559a73868aa468d4dc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Crypto/ECKind.cs b/Assets/Scripts/Netezos/Keys/Crypto/ECKind.cs deleted file mode 100644 index 99e2afdc..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/ECKind.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Netezos.Keys -{ - public enum ECKind - { - Ed25519 = 1, - Secp256k1 = 2, - NistP256 = 3 - } -} diff --git a/Assets/Scripts/Netezos/Keys/Crypto/ECKind.cs.meta b/Assets/Scripts/Netezos/Keys/Crypto/ECKind.cs.meta deleted file mode 100644 index 96fd609c..00000000 --- a/Assets/Scripts/Netezos/Keys/Crypto/ECKind.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8509a89cc92d146b2ad432d6f1420db2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys.meta b/Assets/Scripts/Netezos/Keys/HDKeys.meta deleted file mode 100644 index 984b390e..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 06de4e18b1eb64245a3a0d8268ad31c6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDKey.cs b/Assets/Scripts/Netezos/Keys/HDKeys/HDKey.cs deleted file mode 100644 index 87dc37e4..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDKey.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Linq; -using Netezos.Utils; - -namespace Netezos.Keys -{ - /// - /// Extended (hierarchical deterministic) private key - /// - public class HDKey - { - /// - /// Private key - /// - public Key Key { get; } - - /// - /// 32 bytes of entropy added to the private key to enable deriving secure child keys - /// - public byte[] ChainCode => _ChainCode.Copy(); - - /// - /// Public key - /// - public PubKey PubKey => Key.PubKey; - - /// - /// Extended (hierarchical deterministic) public key - /// - public HDPubKey HDPubKey => _HDPubKey ??= new(Key.PubKey, _ChainCode); - - /// - /// Public key hash - /// - public string Address => Key.Address; - - readonly byte[] _ChainCode; - HDPubKey _HDPubKey; - Curve Curve => Key.Curve; - HDStandard HD => HDStandard.Slip10; - ISecretStore Store => Key.Store; - - /// - /// Generates a new extended (hierarchical deterministic) private key - /// - /// Elliptic curve kind - public HDKey(ECKind kind = ECKind.Ed25519) - { - Key = new(RNG.GetBytes(32), kind, true); - _ChainCode = RNG.GetBytes(32); - } - - internal HDKey(Key key, byte[] chainCode) - { - Key = key ?? throw new ArgumentNullException(nameof(key)); - _ChainCode = chainCode?.Copy() ?? throw new ArgumentNullException(nameof(chainCode)); - if (chainCode.Length != 32) throw new ArgumentException("Invalid chain code length", nameof(chainCode)); - } - - /// - /// Derives an extended child key at the given index - /// - /// Index of the child key, starting from zero - /// If true, hardened derivation will be performed - /// Derived extended child key - public HDKey Derive(int index, bool hardened = false) - { - var uind = HDPath.GetIndex(index, hardened); - using (Store.Unlock()) - { - var (prvKey, chainCode) = HD.GetChildPrivateKey(Curve, Store.Data, _ChainCode, uind); - return new(new(prvKey, Curve.Kind, true), chainCode); - } - } - - /// - /// Derives an extended child key at the given path relative to the current key - /// - /// HD key path string, formatted like m/44'/1729'/0/0' - /// Derived extended child key - public HDKey Derive(string path) => Derive(HDPath.Parse(path)); - - /// - /// Derives an extended child key at the given path relative to the current key - /// - /// HD key path - /// Derived extended child key - public HDKey Derive(HDPath path) - { - if (path == null) - throw new ArgumentNullException(nameof(path)); - - if (!path.Any()) - return this; - - using (Store.Unlock()) - { - var prvKey = Store.Data; - var chainCode = _ChainCode; - - foreach (var uind in path) - (prvKey, chainCode) = HD.GetChildPrivateKey(Curve, prvKey, chainCode, uind); - - return new(new(prvKey, Curve.Kind, true), chainCode); - } - } - - /// - /// Signs an array of bytes - /// - /// Array of bytes to sign - /// Signature object - public Signature Sign(byte[] bytes) => Key.Sign(bytes); - - /// - /// Signs a UTF-8 endcoded string - /// - /// String to sign - /// Signature object - public Signature Sign(string message) => Key.Sign(message); - - /// - /// Signs forged operation bytes with 0x03 prefix added - /// - /// Forged operation bytes - /// Signature object - public Signature SignOperation(byte[] bytes) => Key.SignOperation(bytes); - - /// - /// Verifies a signature of the given array of bytes - /// - /// Original data bytes - /// Signature to verify - /// True if the signature is valid, otherwise false - public bool Verify(byte[] data, byte[] signature) => Key.Verify(data, signature); - - /// - /// Verifies a signature of the given message string - /// - /// Original message string - /// Signature to verify - /// True if the signature is valid, otherwise false - public bool Verify(string message, string signature) => Key.Verify(message, signature); - - #region static - /// - /// Creates an extended (hierarchical deterministic) private key from the given private key and chain code - /// - /// Private key - /// 32 bytes of entropy to be added to the private key - /// Extended private key - public static HDKey FromKey(Key key, byte[] chainCode) => new(key, chainCode); - - /// - /// Creates an extended (hierarchical deterministic) private key from the given BIP-39 mnemonic - /// - /// BIP-39 mnemonic sentence - /// Passphrase. If not present, an empty string "" is used instead, according to the standard. - /// Elliptic curve kind - /// Extended private key - public static HDKey FromMnemonic(Mnemonic mnemonic, string passphrase = "", ECKind kind = ECKind.Ed25519) - { - if (mnemonic == null) throw new ArgumentNullException(nameof(mnemonic)); - var seed = mnemonic.GetSeed(passphrase); - var key = FromSeed(seed, kind); - seed.Flush(); - return key; - } - - /// - /// Creates an extended (hierarchical deterministic) private key from the given seed bytes - /// - /// Seed bytes - /// Elliptic curve kind - /// Extended private key - public static HDKey FromSeed(byte[] seed, ECKind kind = ECKind.Ed25519) - { - if (seed == null) throw new ArgumentNullException(nameof(seed)); - var (prvKey, chainCode) = HDStandard.Slip10.GenerateMasterKey(Curve.FromKind(kind), seed); - return new(new(prvKey, kind, true), chainCode); - } - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDKey.cs.meta b/Assets/Scripts/Netezos/Keys/HDKeys/HDKey.cs.meta deleted file mode 100644 index ca382383..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDKey.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 047880feb854b4407a6da8d8dfc9d234 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDPath.cs b/Assets/Scripts/Netezos/Keys/HDKeys/HDPath.cs deleted file mode 100644 index d536ab9d..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDPath.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace Netezos.Keys -{ - /// - /// Represents a path in the HD keys hierarchy (BIP-32) - /// - public class HDPath : IEnumerable - { - /// - /// True if the last index in the path is hardened - /// - public bool Hardened => (Indexes.LastOrDefault() & 0x80000000) != 0; - - readonly uint[] Indexes; - - /// - /// Creates an empty (root) HDPath object - /// - public HDPath() - { - Indexes = Array.Empty(); - } - - /// - /// Creates an HDPath object from a given string path. - /// - /// Path string, formatted like m/44'/1729'/0/0' - public HDPath(string path) - { - path = path?.TrimStart('m').Trim('/') - ?? throw new ArgumentNullException(nameof(path)); - Indexes = path.Length == 0 - ? Array.Empty() - : path.Split('/').Select(ParseIndex).ToArray(); - } - - HDPath(uint[] indexes) - { - Indexes = indexes; - } - - /// - /// Returns a new HDPath object with appended child index. - /// - /// Child index - /// If true, hardened derivation will be performed - /// HDPath object - public HDPath Derive(int index, bool hardened = false) - { - var indexes = new uint[Indexes.Length + 1]; - Indexes.CopyTo(indexes, 0); - indexes[indexes.Length - 1] = GetIndex(index, hardened); - return new(indexes); - } - - /// - /// Converts the HDPath to a string, formatted like m/44'/1729'/0/0' - /// - /// HDPath string, formatted like m/44'/1729'/0/0' - public override string ToString() - { - return Indexes.Length == 0 ? "m" : $"m/{string.Join("/", Indexes.Select(IndexToString))}"; - } - - #region IEnumerable - /// Returns an enumerator that iterates through an HDPath indexes collection. - /// An object that can be used to iterate through the HDPath indexes collection. - public IEnumerator GetEnumerator() => ((IEnumerable)Indexes).GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() => Indexes.GetEnumerator(); - #endregion - - #region static - /// - /// Converts the path string, formatted like m/44'/1729'/0/0', to the HDPath object - /// - /// HD key path string, formatted like m/44'/1729'/0/0' - /// HDPath object - public static HDPath Parse(string path) - { - return new(path); - } - - /// - /// Converts the path string, formatted like m/44'/1729'/0/0', to the HDPath object - /// - /// HD key path string, formatted like m/44'/1729'/0/0' - /// Successfully parsed HDPath - /// True if the HDPath is parsed successfully, otherwise false - public static bool TryParse(string path, out HDPath res) - { - res = null; - if (path == null) return false; - - path = path.TrimStart('m').Trim('/'); - if (path.Length == 0) - { - res = new(); - return true; - } - - var ss = path.Split('/'); - var indexes = new uint[ss.Length]; - for (int i = 0; i < ss.Length; i++) - { - if (!TryParseIndex(ss[i], out var ind)) - return false; - indexes[i] = ind; - } - - res = new(indexes); - return true; - } - - internal static uint GetIndex(int index, bool hardened) - { - if (index < 0) - throw new ArgumentException("Index must be positive", nameof(index)); - - return hardened ? (uint)index | 0x80000000 : (uint)index; - } - - static bool TryParseIndex(string str, out uint ind) - { - if (str.Length == 0) - { - ind = 0; - return false; - } - - var hardened = str[str.Length - 1] == '\'' || str[str.Length - 1] == 'h'; - - if (!uint.TryParse(hardened ? str.Substring(0, str.Length - 1) : str, out ind)) - return false; - - if ((ind & 0x80000000) != 0) - return false; - - if (hardened) - ind |= 0x80000000; - - return true; - } - - static uint ParseIndex(string str) - { - if (str.Length == 0) - throw new FormatException("Path contains empty element"); - - var hardened = str[str.Length - 1] == '\'' || str[str.Length - 1] == 'h'; - - if (!uint.TryParse(hardened ? str.Substring(0, str.Length - 1) : str, out var ind)) - throw new FormatException("Path contains invalid index"); - - if ((ind & 0x80000000) != 0) - throw new FormatException("Path contains too large index"); - - return hardened ? (ind | 0x80000000) : ind; - } - - static string IndexToString(uint ind) - { - var plain = ind & 0x7FFFFFFF; - var hardened = (ind & 0x80000000) != 0; - return hardened ? $"{plain}'" : plain.ToString(); - } - #endregion - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDPath.cs.meta b/Assets/Scripts/Netezos/Keys/HDKeys/HDPath.cs.meta deleted file mode 100644 index cbd09847..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDPath.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 692078b09e28f41c3a8a2ed2952a9087 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDPubKey.cs b/Assets/Scripts/Netezos/Keys/HDKeys/HDPubKey.cs deleted file mode 100644 index 211ff395..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDPubKey.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Linq; - -namespace Netezos.Keys -{ - /// - /// Extended (hierarchical deterministic) public key - /// - public class HDPubKey - { - /// - /// Public key - /// - public PubKey PubKey { get; } - - /// - /// Public key hash - /// - public string Address => PubKey.Address; - - /// - /// 32 bytes of entropy added to the public key to enable deriving secure child keys - /// - public byte[] ChainCode => _ChainCode.Copy(); - - readonly byte[] _ChainCode; - Curve Curve => PubKey.Curve; - HDStandard HD => HDStandard.Slip10; - ISecretStore Store => PubKey.Store; - - internal HDPubKey(PubKey pubKey, byte[] chainCode) - { - PubKey = pubKey ?? throw new ArgumentNullException(nameof(pubKey)); - _ChainCode = chainCode?.Copy() ?? throw new ArgumentNullException(nameof(chainCode)); - if (chainCode.Length != 32) throw new ArgumentException("Invalid chain code length", nameof(chainCode)); - } - - /// - /// Derives an extended child key at the given index - /// - /// Index of the child key, starting from zero - /// If true, hardened derivation will be performed - /// Derived extended child key - public HDPubKey Derive(int index, bool hardened = false) - { - var uind = HDPath.GetIndex(index, hardened); - using (Store.Unlock()) - { - var (pubKey, chainCode) = HD.GetChildPublicKey(Curve, Store.Data, _ChainCode, uind); - return new(new(pubKey, Curve.Kind, true), chainCode); - } - } - - /// - /// Derives an extended child key at the given path relative to the current key - /// - /// HD key path string, formatted like m/44'/1729'/0/0' - /// Derived extended child key - public HDPubKey Derive(string path) => Derive(HDPath.Parse(path)); - - /// - /// Derives an extended child key at the given path relative to the current key - /// - /// HD key path - /// Derived extended child key - public HDPubKey Derive(HDPath path) - { - if (path == null) - throw new ArgumentNullException(nameof(path)); - - if (!path.Any()) - return this; - - using (Store.Unlock()) - { - var pubKey = Store.Data; - var chainCode = _ChainCode; - - foreach (var uind in path) - (pubKey, chainCode) = HD.GetChildPublicKey(Curve, pubKey, chainCode, uind); - - return new(new(pubKey, Curve.Kind, true), chainCode); - } - } - - /// - /// Verifies a signature of the given array of bytes - /// - /// Original data bytes - /// Signature to verify - /// True if the signature is valid, otherwise false - public bool Verify(byte[] data, byte[] signature) => PubKey.Verify(data, signature); - - /// - /// Verifies a signature of the given message string - /// - /// Original message string - /// Signature to verify - /// True if the signature is valid, otherwise false - public bool Verify(string message, string signature) => PubKey.Verify(message, signature); - - #region static - /// - /// Creates an extended (hierarchical deterministic) public key from the given public key and chain code - /// - /// Public key - /// 32 bytes of entropy to be added to the public key - /// Extended public key - public static HDPubKey FromPubKey(PubKey pubKey, byte[] chainCode) => new(pubKey, chainCode); - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDPubKey.cs.meta b/Assets/Scripts/Netezos/Keys/HDKeys/HDPubKey.cs.meta deleted file mode 100644 index d1d1aa4b..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDPubKey.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 794845975386e4c978da4f477acb1f87 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDStandard.cs b/Assets/Scripts/Netezos/Keys/HDKeys/HDStandard.cs deleted file mode 100644 index 5ff644f1..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDStandard.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Netezos.Keys -{ - abstract class HDStandard - { - #region static - public static HDStandard Slip10 { get; } = new Slip10(); - #endregion - - public abstract (byte[], byte[]) GenerateMasterKey(Curve curve, byte[] seed); - - public abstract (byte[], byte[]) GetChildPrivateKey(Curve curve, byte[] privateKey, byte[] chainCode, uint index); - - public abstract (byte[], byte[]) GetChildPublicKey(Curve curve, byte[] pubKey, byte[] chainCode, uint index); - } -} diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/HDStandard.cs.meta b/Assets/Scripts/Netezos/Keys/HDKeys/HDStandard.cs.meta deleted file mode 100644 index d48da8e1..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/HDStandard.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40f8d2a7096264ec1aed50b6b84bd298 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/Standards.meta b/Assets/Scripts/Netezos/Keys/HDKeys/Standards.meta deleted file mode 100644 index 8c26a037..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/Standards.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bda43cfc8bd0b47a4ad02db281130243 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/Standards/Slip10.cs b/Assets/Scripts/Netezos/Keys/HDKeys/Standards/Slip10.cs deleted file mode 100644 index a4c6f146..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/Standards/Slip10.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.ComponentModel; -using System.Security.Cryptography; -using Org.BouncyCastle.Asn1.Sec; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Math; -using Netezos.Utils; - -namespace Netezos.Keys -{ - class Slip10 : HDStandard - { - public override (byte[], byte[]) GenerateMasterKey(Curve curve, byte[] seed) - { - using var hmacSha512 = new HMACSHA512(curve.SeedKey); - while (true) - { - var l = hmacSha512.ComputeHash(seed); - var ll = l.GetBytes(0, 32); - var lr = l.GetBytes(32, 32); - - if (curve.Kind == ECKind.Ed25519) - { - l.Flush(); - return (ll, lr); - } - - var parse256LL = new BigInteger(1, ll); - var N = curve.Kind switch - { - ECKind.Secp256k1 => SecNamedCurves.GetByName("secp256k1").N, - ECKind.NistP256 => SecNamedCurves.GetByName("secp256r1").N, - _ => throw new InvalidEnumArgumentException() - }; - - if (parse256LL.CompareTo(N) < 0 && parse256LL.CompareTo(BigInteger.Zero) != 0) - { - l.Flush(); - return (ll, lr); - } - - seed = l; - } - } - - public override (byte[], byte[]) GetChildPrivateKey(Curve curve, byte[] privateKey, byte[] chainCode, uint index) - { - byte[] l; - - if ((index & 0x80000000) != 0) // hardened - { - l = Bip32Hash(chainCode, index, 0, privateKey); - } - else - { - if (curve.Kind == ECKind.Ed25519) - throw new NotSupportedException("Ed25519 doesn't support non-hardened key derivation"); - - l = Bip32Hash(chainCode, index, curve.GetPublicKey(privateKey)); - } - - var ll = l.GetBytes(0, 32); - var lr = l.GetBytes(32, 32); - - if (curve.Kind == ECKind.Ed25519) - { - l.Flush(); - return (ll, lr); - } - - while (true) - { - var parse256LL = new BigInteger(1, ll); - var kPar = new BigInteger(1, privateKey); - var N = curve.Kind switch - { - ECKind.Secp256k1 => SecNamedCurves.GetByName("secp256k1").N, - ECKind.NistP256 => SecNamedCurves.GetByName("secp256r1").N, - _ => throw new InvalidEnumArgumentException() - }; - var key = parse256LL.Add(kPar).Mod(N); - - if (parse256LL.CompareTo(N) >= 0 || key.CompareTo(BigInteger.Zero) == 0) - { - l = Bip32Hash(chainCode, index, 1, lr); - ll = l.GetBytes(0, 32); - lr = l.GetBytes(32, 32); - continue; - } - - var keyBytes = key.ToByteArrayUnsigned(); - if (keyBytes.Length < 32) - { - var kb = keyBytes; - keyBytes = new byte[32 - kb.Length].Concat(kb); - kb.Flush(); - } - - l.Flush(); - ll.Flush(); - return (keyBytes, lr); - } - } - - public override (byte[], byte[]) GetChildPublicKey(Curve curve, byte[] pubKey, byte[] chainCode, uint index) - { - if (curve.Kind == ECKind.Ed25519) - throw new NotSupportedException("Ed25519 public key derivation not supported by slip-10"); - if (pubKey.Length != 33) - throw new NotSupportedException("Invalid public key size (expected 33 bytes)"); - if ((index & 0x80000000) != 0) - throw new InvalidOperationException("Can't derive a hardened child key from a public key"); - - var c = curve.Kind switch - { - ECKind.Secp256k1 => SecNamedCurves.GetByName("secp256k1"), - ECKind.NistP256 => SecNamedCurves.GetByName("secp256r1"), - _ => throw new InvalidEnumArgumentException() - }; - var dp = new ECDomainParameters(c.Curve, c.G, c.N, c.H, c.GetSeed()); - var kp = new ECPublicKeyParameters("EC", c.Curve.DecodePoint(pubKey), dp); - var l = Bip32Hash(chainCode, index, pubKey); - - while (true) - { - var ll = l.GetBytes(0, 32); - var lr = l.GetBytes(32, 32); - - var parse256LL = new BigInteger(1, ll); - var q = kp.Parameters.G.Multiply(parse256LL).Add(kp.Q); - - if (parse256LL.CompareTo(c.N) >= 0 || q.IsInfinity) - { - l = Bip32Hash(chainCode, index, 1, lr); - continue; - } - - return (q.Normalize().GetEncoded(true), lr); - } - } - - static byte[] Bip32Hash(byte[] chainCode, uint index, byte[] data) - { - using var hmacSha512 = new HMACSHA512(chainCode); - return hmacSha512.ComputeHash(data.Concat(Ser32(index))); - } - - static byte[] Bip32Hash(byte[] chainCode, uint index, byte prefix, byte[] data) - { - using var hmacSha512 = new HMACSHA512(chainCode); - return hmacSha512.ComputeHash(Bytes.Concat(new byte[] { prefix }, data, Ser32(index))); - } - - static byte[] Ser32(uint index) => new byte[] - { - (byte)((index >> 24) & 0xFF), - (byte)((index >> 16) & 0xFF), - (byte)((index >> 8) & 0xFF), - (byte)((index >> 0) & 0xFF) - }; - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Keys/HDKeys/Standards/Slip10.cs.meta b/Assets/Scripts/Netezos/Keys/HDKeys/Standards/Slip10.cs.meta deleted file mode 100644 index 144d7945..00000000 --- a/Assets/Scripts/Netezos/Keys/HDKeys/Standards/Slip10.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4b2a73be981b742faac92570ae263df4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Key.cs b/Assets/Scripts/Netezos/Keys/Key.cs deleted file mode 100644 index f3a0d5a3..00000000 --- a/Assets/Scripts/Netezos/Keys/Key.cs +++ /dev/null @@ -1,150 +0,0 @@ -using System; -using Netezos.Encoding; - -namespace Netezos.Keys -{ - public class Key - { - public string Address => PubKey.Address; - public PubKey PubKey - { - get - { - if (_PubKey == null) - { - using (Store.Unlock()) - { - _PubKey = new PubKey(Curve.GetPublicKey(Store.Data), Curve.Kind, true); - } - } - - return _PubKey; - } - } - PubKey _PubKey; - - internal readonly Curve Curve; - internal readonly ISecretStore Store; - - public Key(ECKind kind = ECKind.Ed25519) - { - Curve = Curve.FromKind(kind); - var bytes = Curve.GeneratePrivateKey(); - Store = new PlainSecretStore(bytes); - bytes.Flush(); - } - - internal Key(byte[] bytes, ECKind kind, bool flush = false) - { - if (bytes?.Length != 32) - throw new ArgumentException("Invalid private key length", nameof(bytes)); - - Curve = Curve.FromKind(kind); - Store = new PlainSecretStore(bytes); - if (flush) bytes.Flush(); - } - - public byte[] GetBytes() - { - using (Store.Unlock()) - { - var bytes = new byte[Store.Data.Length]; - Buffer.BlockCopy(Store.Data, 0, bytes, 0, Store.Data.Length); - return bytes; - } - } - - public string GetBase58() - { - using (Store.Unlock()) - { - return Base58.Convert(Store.Data, Curve.PrivateKeyPrefix); - } - } - - public string GetHex() - { - using (Store.Unlock()) - { - return Hex.Convert(Store.Data); - } - } - - public Signature Sign(byte[] bytes) - { - using (Store.Unlock()) - { - return Curve.Sign(bytes, Store.Data); - } - } - - public Signature Sign(string message) - { - using (Store.Unlock()) - { - return Curve.Sign(Utf8.Parse(message), Store.Data); - } - } - - /// - /// Prepends forged operation bytes with 0x03 and signs the result - /// - /// Forged operation bytes - /// - public Signature SignOperation(byte[] bytes) - { - using (Store.Unlock()) - { - return Curve.Sign(new byte[] { 3 }.Concat(bytes), Store.Data); - } - } - - public bool Verify(byte[] data, byte[] signature) => PubKey.Verify(data, signature); - - public bool Verify(string message, string signature) => PubKey.Verify(message, signature); - - public override string ToString() => GetBase58(); - - #region static - public static Key FromBytes(byte[] bytes, ECKind kind = ECKind.Ed25519) - => new Key(bytes, kind); - - public static Key FromHex(string hex, ECKind kind = ECKind.Ed25519) - => new Key(Hex.Parse(hex), kind, true); - - public static Key FromBase64(string base64, ECKind kind = ECKind.Ed25519) - => new Key(Base64.Parse(base64), kind, true); - - public static Key FromBase58(string base58) - { - var curve = Curve.FromPrefix(base58.Substring(0, 4)); - var bytes = Base58.Parse(base58, curve.PrivateKeyPrefix); - return new Key(bytes, curve.Kind, true); - } - - public static Key FromMnemonic(Mnemonic mnemonic) - { - var seed = mnemonic.GetSeed(); - var key = new Key(seed.GetBytes(0, 32), ECKind.Ed25519, true); - seed.Flush(); - return key; - } - - public static Key FromMnemonic(Mnemonic mnemonic, string email, string password) - { - var seed = mnemonic.GetSeed($"{email}{password}"); - var key = new Key(seed.GetBytes(0, 32), ECKind.Ed25519, true); - seed.Flush(); - return key; - } - - public static Key FromMnemonic(Mnemonic mnemonic, string passphrase, ECKind kind = ECKind.Ed25519) - { - var seed = mnemonic.GetSeed(passphrase); - var key = new Key(seed.GetBytes(0, 32), kind, true); - seed.Flush(); - return key; - } - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Keys/Key.cs.meta b/Assets/Scripts/Netezos/Keys/Key.cs.meta deleted file mode 100644 index ab7afbe0..00000000 --- a/Assets/Scripts/Netezos/Keys/Key.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: db434d2d9f98042c78c765cd7225b159 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/PubKey.cs b/Assets/Scripts/Netezos/Keys/PubKey.cs deleted file mode 100644 index a85360bb..00000000 --- a/Assets/Scripts/Netezos/Keys/PubKey.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using Netezos.Encoding; -using Netezos.Utils; - -namespace Netezos.Keys -{ - public class PubKey - { - string _Address; - public string Address - { - get - { - if (_Address == null) - { - using (Store.Unlock()) - { - _Address = Base58.Convert(Blake2b.GetDigest(Store.Data, 160), Curve.AddressPrefix); - } - } - - return _Address; - } - } - - internal readonly Curve Curve; - internal readonly ISecretStore Store; - - internal PubKey(byte[] bytes, ECKind kind, bool flush = false) - { - if (kind == ECKind.Ed25519 && bytes.Length != 32 || kind != ECKind.Ed25519 && bytes.Length != 33) - throw new ArgumentException("Invalid public key length", nameof(bytes)); - - Curve = Curve.FromKind(kind); - Store = new PlainSecretStore(bytes); - if (flush) bytes.Flush(); - } - - public byte[] GetBytes() - { - using (Store.Unlock()) - { - var bytes = new byte[Store.Data.Length]; - Buffer.BlockCopy(Store.Data, 0, bytes, 0, Store.Data.Length); - return bytes; - } - } - - public string GetBase58() - { - using (Store.Unlock()) - { - return Base58.Convert(Store.Data, Curve.PublicKeyPrefix); - - } - } - - public string GetHex() - { - using (Store.Unlock()) - { - return Hex.Convert(Store.Data); - } - } - - public bool Verify(byte[] data, byte[] signature) - { - using (Store.Unlock()) - { - return Curve.Verify(data, signature, Store.Data); - } - } - - public bool Verify(byte[] data, string signature) - { - using (Store.Unlock()) - { - return Base58.TryParse(signature, Curve.SignaturePrefix, out var signatureBytes) - && Curve.Verify(data, signatureBytes, Store.Data); - } - } - - public bool Verify(string message, string signature) - { - using (Store.Unlock()) - { - return Utf8.TryParse(message, out var messageBytes) - && Base58.TryParse(signature, Curve.SignaturePrefix, out var signatureBytes) - && Curve.Verify(messageBytes, signatureBytes, Store.Data); - } - } - - public override string ToString() => GetBase58(); - - #region static - public static PubKey FromBytes(byte[] bytes, ECKind kind = ECKind.Ed25519) - => new PubKey(bytes, kind); - - public static PubKey FromHex(string hex, ECKind kind = ECKind.Ed25519) - => new PubKey(Hex.Parse(hex), kind, true); - - public static PubKey FromBase64(string base64, ECKind kind = ECKind.Ed25519) - => new PubKey(Base64.Parse(base64), kind, true); - - public static PubKey FromBase58(string base58) - { - var curve = Curve.FromPrefix(base58.Substring(0, 4)); - var bytes = Base58.Parse(base58, curve.PublicKeyPrefix); - - return new PubKey(bytes, curve.Kind, true); - } - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Keys/PubKey.cs.meta b/Assets/Scripts/Netezos/Keys/PubKey.cs.meta deleted file mode 100644 index e3f1b955..00000000 --- a/Assets/Scripts/Netezos/Keys/PubKey.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f52cbab9e132c4cc5ac1fc6487762d49 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/SecretStore.meta b/Assets/Scripts/Netezos/Keys/SecretStore.meta deleted file mode 100644 index 0a63502b..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eefbf8829b3b04044be0c103206a9e84 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/ISecretStore.cs b/Assets/Scripts/Netezos/Keys/SecretStore/ISecretStore.cs deleted file mode 100644 index ebbe1fa4..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/ISecretStore.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Netezos.Keys -{ - interface ISecretStore - { - byte[] Data { get; } - - void Lock(); - StoreLocker Unlock(); - } -} diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/ISecretStore.cs.meta b/Assets/Scripts/Netezos/Keys/SecretStore/ISecretStore.cs.meta deleted file mode 100644 index 764b6ad7..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/ISecretStore.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8d0f5dc1579a148b5892063af6125942 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/PlainSecretStore.cs b/Assets/Scripts/Netezos/Keys/SecretStore/PlainSecretStore.cs deleted file mode 100644 index 515c23ad..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/PlainSecretStore.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace Netezos.Keys -{ - class PlainSecretStore : ISecretStore - { - public byte[] Data { get; private set; } - - public PlainSecretStore(byte[] data) - { - Data = new byte[data.Length]; - Buffer.BlockCopy(data, 0, Data, 0, data.Length); - } - - public void Lock() { } - - public StoreLocker Unlock() => new StoreLocker(this); - } -} diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/PlainSecretStore.cs.meta b/Assets/Scripts/Netezos/Keys/SecretStore/PlainSecretStore.cs.meta deleted file mode 100644 index 21f7cfa8..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/PlainSecretStore.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: be1440462ebaf4237938f178514ce314 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/SecureSecretStore.cs b/Assets/Scripts/Netezos/Keys/SecretStore/SecureSecretStore.cs deleted file mode 100644 index 3aacb522..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/SecureSecretStore.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Netezos.Keys -{ - class SecureSecretStore - { - //TODO: implement secure store - } -} diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/SecureSecretStore.cs.meta b/Assets/Scripts/Netezos/Keys/SecretStore/SecureSecretStore.cs.meta deleted file mode 100644 index b5c550d2..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/SecureSecretStore.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 44dab8a64d59c4bb381507ebccda5a5a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/StoreLocker.cs b/Assets/Scripts/Netezos/Keys/SecretStore/StoreLocker.cs deleted file mode 100644 index 92c292ec..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/StoreLocker.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Netezos.Keys -{ - class StoreLocker : IDisposable - { - ISecretStore Store; - - public StoreLocker(ISecretStore store) => Store = store; - - public void Dispose() => Store.Lock(); - } -} diff --git a/Assets/Scripts/Netezos/Keys/SecretStore/StoreLocker.cs.meta b/Assets/Scripts/Netezos/Keys/SecretStore/StoreLocker.cs.meta deleted file mode 100644 index c7cbd5e4..00000000 --- a/Assets/Scripts/Netezos/Keys/SecretStore/StoreLocker.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9d35074605fce4d23a22bae48ac2d9bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Keys/Signature.cs b/Assets/Scripts/Netezos/Keys/Signature.cs deleted file mode 100644 index 3f0bd5f3..00000000 --- a/Assets/Scripts/Netezos/Keys/Signature.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Netezos.Encoding; - -namespace Netezos.Keys -{ - public class Signature - { - readonly byte[] Bytes; - readonly byte[] Prefix; - - public Signature(byte[] bytes, byte[] prefix) - { - Bytes = bytes; - Prefix = prefix; - } - - public byte[] ToBytes() => Bytes; - - public string ToBase58() => Base58.Convert(Bytes, Prefix); - - public string ToHex() => Hex.Convert(Bytes); - - public override string ToString() => ToBase58(); - - public static implicit operator byte[] (Signature s) => s.ToBytes(); - - public static implicit operator string (Signature s) => s.ToBase58(); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Keys/Signature.cs.meta b/Assets/Scripts/Netezos/Keys/Signature.cs.meta deleted file mode 100644 index 507bd4f7..00000000 --- a/Assets/Scripts/Netezos/Keys/Signature.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 276387d9358334f5dbd2594e8acbc5af -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc.meta b/Assets/Scripts/Netezos/Rpc.meta deleted file mode 100644 index 80d240c9..00000000 --- a/Assets/Scripts/Netezos/Rpc.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 79dd58e8dd40641f297f0f9667a2311b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base.meta b/Assets/Scripts/Netezos/Rpc/Base.meta deleted file mode 100644 index ef6c9e38..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 46c10aed8dcfd4adfb3a83ed8f00a625 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcDictionary.cs b/Assets/Scripts/Netezos/Rpc/Base/DeepRpcDictionary.cs deleted file mode 100644 index bda61228..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcDictionary.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc -{ - /// - /// Rpc query to get a dictionary of json objects, which can also be accessed by key - /// - /// Type of the keys to access the objects in the dictionary - /// Type of the objects in the dictionary - public class DeepRpcDictionary : RpcDictionary where TValue : RpcObject - { - internal DeepRpcDictionary(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Executes the query and returns the dynamic json object - /// Returns a dynamic json. - /// - /// Depth - /// - public IEnumerator GetAsync(int depth) => Client.GetJson($"{Query}?depth={depth}"); - - /// - /// Executes the query and returns the json object, deserealized to the specified type - /// - /// Type of the object to deserialize to - /// Depth - /// - public IEnumerator GetAsync(int depth) => Client.GetJson($"{Query}?depth={depth}"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcDictionary.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/DeepRpcDictionary.cs.meta deleted file mode 100644 index 557f6c1f..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcDictionary.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4fb9fef8816d6446e9051998632a466e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcObject.cs b/Assets/Scripts/Netezos/Rpc/Base/DeepRpcObject.cs deleted file mode 100644 index 95c8e254..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcObject.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc -{ - /// - /// Rpc query to get a json object - /// - public class DeepRpcObject : RpcObject - { - internal DeepRpcObject(RpcClient client, string query) : base(client, query) { } - - internal DeepRpcObject(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Executes the query and returns the dynamic json object. - /// Returns a dynamic json. - /// - /// Depth - /// - public IEnumerator GetAsync(int depth) => Client.GetJson($"{Query}?depth={depth}"); - - /// - /// Executes the query and returns the json object, deserealized to the specified type - /// - /// Type of the object to deserialize to - /// Depth - /// - public IEnumerator GetAsync(int depth) => Client.GetJson($"{Query}?depth={depth}"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcObject.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/DeepRpcObject.cs.meta deleted file mode 100644 index ca27db3b..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/DeepRpcObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 61e0f9dc79c754c5b9f71c5e1e383cbd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcArray.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcArray.cs deleted file mode 100644 index 8b0046be..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcArray.cs +++ /dev/null @@ -1,62 +0,0 @@ -namespace Netezos.Rpc -{ - /// - /// Rpc query to get an array of json objects, which can also be accessed by index - /// - /// Type of the objects in the array - public class RpcArray : RpcObject where T : RpcObject - { - #region static - static Creator _CreateRpcObject = null; - static Creator CreateRpcObject - { - get - { - if (_CreateRpcObject == null) - _CreateRpcObject = GetCreator(); - - return _CreateRpcObject; - } - } - #endregion - - /// - /// Gets the query to object at the specified index in the array - /// - /// Zero-based index of the object to query - /// - public T this[int index] => CreateRpcObject(this, $"{index}/"); - - internal RpcArray(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } - - /// - /// Rpc query to get json objects by id or index - /// - /// Type of the objects in the array - public class RpcSimpleArray : RpcQuery where T : RpcQuery - { - #region static - static RpcObject.Creator _CreateRpcObject = null; - static RpcObject.Creator CreateRpcObject - { - get - { - if (_CreateRpcObject == null) - _CreateRpcObject = RpcObject.GetCreator(); - - return _CreateRpcObject; - } - } - #endregion - - /// - /// Gets the query to object at the specified index in the array - /// - /// Zero-based index of the object to query - /// - public T this[int index] => CreateRpcObject(this, $"{index}/"); - - internal RpcSimpleArray(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcArray.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcArray.cs.meta deleted file mode 100644 index da82c44c..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcArray.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e08760c4c6ec449429617d382235a98a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcClient.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcClient.cs deleted file mode 100644 index 36771eb0..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcClient.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Collections; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Reflection; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; - -using Dynamic.Json; -using Dynamic.Json.Extensions; -using UnityEngine; -using UnityEngine.Networking; - -namespace Netezos.Rpc -{ - class RpcClient : IDisposable - { - #region static - static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(2); - - static readonly JsonSerializerOptions DefaultOptions = new JsonSerializerOptions - { - AllowTrailingCommas = true, - DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, - MaxDepth = 100_000, - NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString, - PropertyNamingPolicy = new SnakeCaseNamingPolicy() - }; - #endregion - - Uri BaseAddress { get; } - TimeSpan RequestTimeout { get; } - DateTime Expiration; - - HttpClient _HttpClient; - protected HttpClient HttpClient - { - get - { - lock (this) - { - // Workaround for https://github.com/dotnet/runtime/issues/18348 - if (DateTime.UtcNow > Expiration) - { - _HttpClient?.Dispose(); - _HttpClient = new HttpClient(); - - _HttpClient.BaseAddress = BaseAddress; - _HttpClient.DefaultRequestHeaders.Accept.Add( - new MediaTypeWithQualityHeaderValue("application/json")); - _HttpClient.DefaultRequestHeaders.UserAgent.Add( - new ProductInfoHeaderValue("Netezos", Version)); - _HttpClient.Timeout = RequestTimeout; - - Expiration = DateTime.UtcNow.AddMinutes(60); - } - } - - return _HttpClient; - } - } - - public RpcClient(string baseUri, int timeoutSec = 30) - { - if (string.IsNullOrEmpty(baseUri)) - throw new ArgumentNullException(nameof(baseUri)); - - if (!Uri.IsWellFormedUriString(baseUri, UriKind.Absolute)) - throw new ArgumentException("Invalid URI"); - - BaseAddress = new Uri($"{baseUri.TrimEnd('/')}/"); - RequestTimeout = TimeSpan.FromSeconds(timeoutSec); - } - - public RpcClient(HttpClient client) - { - _HttpClient = client ?? throw new ArgumentNullException(nameof(client)); - _HttpClient.DefaultRequestHeaders.UserAgent.Add( - new ProductInfoHeaderValue("Netezos", Version)); - - Expiration = DateTime.MaxValue; - } - - /// - /// Returns a dynamic json - /// - /// - /// - /// - public IEnumerator GetJson(string path) - { - using (var newRequest = UnityWebRequest.Get(BaseAddress + path)) - { - newRequest.SetRequestHeader("Accept", "application/json"); - newRequest.SetRequestHeader("Content-Type", "application/json"); - newRequest.SetRequestHeader("User-Agent", "Netezos/" + Assembly.GetExecutingAssembly().GetName().Version.ToString(2)); - newRequest.timeout = (int)10; - newRequest.SendWebRequest(); - - yield return new WaitWhile(() => !newRequest.isDone); - - var jsonText = newRequest.downloadHandler.text; - - var djson = DJson.Parse(jsonText, DefaultOptions); - - yield return djson; - //yield return JsonSerializer.Deserialize(jsonText, DefaultOptions); - } - } - - public IEnumerator GetJson(string path) - { - using (var newRequest = UnityWebRequest.Get(BaseAddress + path)) - { - Debug.Log("GET path: " + BaseAddress + path); - - newRequest.SetRequestHeader("Accept", "application/json"); - newRequest.SetRequestHeader("Content-Type", "application/json"); - newRequest.SetRequestHeader("User-Agent", "Netezos/" + Assembly.GetExecutingAssembly().GetName().Version.ToString(2)); - newRequest.timeout = (int)10; - newRequest.SendWebRequest(); - - yield return new WaitWhile(() => !newRequest.isDone); - - yield return JsonSerializer.Deserialize(newRequest.downloadHandler.text, DefaultOptions); - } - } - - /// - /// Returns dynamyc type - /// - /// - /// - /// - /// - public IEnumerator PostJson(string path, object data) - { - var content = JsonSerializer.Serialize(data, DefaultOptions); - yield return PostJson(path, content); - } - - /// - /// Returns dynamyc json type - /// - /// - /// - /// - /// - public IEnumerator PostJson(string path, string content) - { - using (var newRequest = new UnityWebRequest(BaseAddress + path, "POST")) - { - newRequest.SetRequestHeader("Accept", "application/json"); - newRequest.SetRequestHeader("Content-Type", "application/json"); - newRequest.SetRequestHeader("User-Agent", "Netezos/" + Assembly.GetExecutingAssembly().GetName().Version.ToString(2)); - - byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes(content); - newRequest.uploadHandler = new UploadHandlerRaw(jsonToSend); - newRequest.downloadHandler = new DownloadHandlerBuffer(); - - newRequest.timeout = (int)10; - newRequest.SendWebRequest(); - - yield return new WaitWhile(() => !newRequest.isDone); - - Debug.Log("POST: " + BaseAddress + path); - yield return EnsureResponseSuccessfull(newRequest.result, newRequest.responseCode, newRequest.error + " | " + newRequest.downloadHandler.text); - - yield return DJson.Parse(newRequest.downloadHandler.text, DefaultOptions); - //yield return JsonSerializer.Deserialize(newRequest.downloadHandler.text, DefaultOptions); - } - } - - public IEnumerator PostJson(string path, object data) => PostJson(path, - //data.ToString() - JsonSerializer.Serialize(data, - DefaultOptions - //new JsonSerializerOptions { WriteIndented = true, Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping } - )/*.Replace("\u0022", "\"")*/ // replace unicode double quotes due to serialization with actual quotes - ); - - public IEnumerator PostJson(string path, string content) - { - using (var newRequest = new UnityWebRequest(BaseAddress + path, "POST")) - { - newRequest.SetRequestHeader("Accept", "application/json"); - newRequest.SetRequestHeader("Content-Type", "application/json"); - newRequest.SetRequestHeader("User-Agent", "Netezos/" + Assembly.GetExecutingAssembly().GetName().Version.ToString(2)); - - Debug.Log("POST path: " + BaseAddress + path); - Debug.Log("content: " + content); - - var jsonToSend = new System.Text.UTF8Encoding().GetBytes(content); - newRequest.uploadHandler = new UploadHandlerRaw(jsonToSend); - newRequest.downloadHandler = new DownloadHandlerBuffer(); - - newRequest.timeout = (int)10; - newRequest.SendWebRequest(); - - yield return new WaitWhile(() => !newRequest.isDone); - - Debug.Log("POST: " + BaseAddress + path); - Debug.Log("content: " + content); - yield return EnsureResponseSuccessfull(newRequest.result, newRequest.responseCode, newRequest.error + " | " + newRequest.downloadHandler.text); - - if (newRequest.result != UnityWebRequest.Result.Success) - yield return default(T); - - else - { - var textResult = newRequest.downloadHandler.text; - var jsonResult = JsonSerializer.Deserialize(textResult, DefaultOptions); - Debug.Log("Result: " + jsonResult); - yield return jsonResult; - } - } - } - - public void Dispose() - { - _HttpClient?.Dispose(); - } - - private IEnumerator EnsureResponseSuccessfull(UnityWebRequest.Result response, long responseCode, string errorMessage) - { - if (response != UnityWebRequest.Result.Success) - { - /* - switch (responseCode) - { - case 400: - throw new BadRequestException(errorMessage); - case 500: - throw new InternalErrorException(errorMessage); - default: - throw new RpcException((HttpStatusCode)responseCode, errorMessage); - } - */ - Debug.LogError(errorMessage); - } - yield return null; - } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcClient.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcClient.cs.meta deleted file mode 100644 index df1a56b6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8705ac549739c48f6baddbc695dbc7d3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcDictionary.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcDictionary.cs deleted file mode 100644 index d0e76aaf..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcDictionary.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace Netezos.Rpc -{ - /// - /// Rpc query to get a dictionary of json objects, which can also be accessed by key - /// - /// Type of the keys to access the objects in the dictionary - /// Type of the objects in the dictionary - public class RpcDictionary : RpcObject where TValue : RpcObject - { - #region static - static Creator _CreateRpcObject = null; - static Creator CreateRpcObject - { - get - { - if (_CreateRpcObject == null) - _CreateRpcObject = GetCreator(); - - return _CreateRpcObject; - } - } - #endregion - - /// - /// Gets the query to object associated with the specified key - /// - /// Key of the object to query - /// - public TValue this[TKey key] => CreateRpcObject(this, $"{key}/"); - - internal RpcDictionary(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } - - /// - /// Rpc query to get json objects by key - /// - /// Type of the keys to access the objects in the dictionary - /// Type of the objects in the dictionary - public class RpcSimpleDictionary : RpcQuery where TValue : RpcQuery - { - #region static - static RpcObject.Creator _CreateRpcObject = null; - static RpcObject.Creator CreateRpcObject - { - get - { - if (_CreateRpcObject == null) - _CreateRpcObject = RpcObject.GetCreator(); - - return _CreateRpcObject; - } - } - #endregion - - /// - /// Gets the query to object associated with the specified key - /// - /// Key of the object to query - /// - public TValue this[TKey key] => CreateRpcObject(this, $"{key}/"); - - internal RpcSimpleDictionary(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcDictionary.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcDictionary.cs.meta deleted file mode 100644 index d451aec2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcDictionary.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a3e48a87670724de5bb9ba4ee7004fbc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcMethod.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcMethod.cs deleted file mode 100644 index 0a4c065f..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcMethod.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc -{ - /// - /// RPC query to POST a json object - /// - public class RpcMethod : RpcQuery - { - internal RpcMethod(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Send a POST request with specified json content and returns the dynamic json object - /// - /// Json content to send - /// - public IEnumerator PostAsync(string content) => Client.PostJson(Query, content); - - /// - /// Send a POST request with specified json object content and returns the dynamic json object - /// - /// Object to send - /// - public IEnumerator PostAsync(object content) => Client.PostJson(Query, content); - - /// - /// Send a POST request with specified json content and returns the json object, deserialized to the specified type - /// - /// Type of the object to deserialize to - /// Json content to send - /// - public IEnumerator PostAsync(string content) => Client.PostJson(Query, content); - - /// - /// Send a POST request with specified json object content and returns the json object, deserialized to the specified type - /// - /// Type of the object to deserialize to - /// Object to send - /// - public IEnumerator PostAsync(object content) => Client.PostJson(Query, content); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcMethod.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcMethod.cs.meta deleted file mode 100644 index ef4d8d80..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcMethod.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5c12b5bbd30e9442185b5707f495a4f1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcObject.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcObject.cs deleted file mode 100644 index ff3a20c1..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcObject.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections; -using System.Linq.Expressions; -using System.Reflection; -using System.Threading; -using System.Threading.Tasks; - -namespace Netezos.Rpc -{ - /// - /// Rpc query to GET a json object - /// - public class RpcObject : RpcQuery - { - #region static - internal delegate T Creator(RpcQuery baseQuery, string append); - - internal static Creator GetCreator() where T : RpcQuery - { - var ctor = typeof(T).GetConstructor( - BindingFlags.NonPublic | BindingFlags.Instance, - null, - new[] { typeof(RpcQuery), typeof(string) }, - null); - - if (ctor == null) - throw new Exception($"Can't find apropriate constructor in {typeof(T)}"); - - var args = new[] - { - Expression.Parameter(typeof(RpcQuery)), - Expression.Parameter(typeof(string)) - }; - - var lambda = Expression.Lambda( - typeof(Creator), - Expression.New(ctor, args), - args); - - return (Creator)lambda.Compile(); - } - #endregion - - internal RpcObject(RpcClient client, string query) : base(client, query) { } - - internal RpcObject(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Executes the query and returns the dynamic json object - /// Returns a dynamic json. - /// - /// - public IEnumerator GetAsync() => Client.GetJson(Query); - - /// - /// Executes the query and returns the json object, deserialized to the specified type - /// - /// Type of the object to deserialize to - /// - public IEnumerator GetAsync() => Client.GetJson(Query); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcObject.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcObject.cs.meta deleted file mode 100644 index cd9102b2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 628803762f554452984ce940278aa88d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcObjectRaw.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcObjectRaw.cs deleted file mode 100644 index b4396408..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcObjectRaw.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Netezos.Rpc -{ - /// - /// Rpc query to GET a json object - /// - public class RpcObjectRaw : RpcObject - { - /// - /// Gets the query to the raw (unparsed) data - /// - public RpcObject Raw => new RpcObject(this, "raw/"); - - internal RpcObjectRaw(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcObjectRaw.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcObjectRaw.cs.meta deleted file mode 100644 index 8c404609..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcObjectRaw.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7e58e125f7fdc4bb3aa8ca7063f370b4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcQuery.cs b/Assets/Scripts/Netezos/Rpc/Base/RpcQuery.cs deleted file mode 100644 index 421da99c..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcQuery.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Netezos.Rpc -{ - /// - /// Base class for RPC queries - /// - public class RpcQuery - { - internal RpcQuery Base; - internal RpcClient Client; - internal string Query; - - internal RpcQuery(RpcClient client, string query) - { - Client = client; - Query = query; - } - - internal RpcQuery(RpcQuery baseQuery, string append) - { - Base = baseQuery; - Client = baseQuery.Client; - Query = baseQuery.Query + append; - } - - public override string ToString() => Query; - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Base/RpcQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Base/RpcQuery.cs.meta deleted file mode 100644 index 8fee0f91..00000000 --- a/Assets/Scripts/Netezos/Rpc/Base/RpcQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 29da0a51b47a0413fa885ceffea85bf4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Enums.cs b/Assets/Scripts/Netezos/Rpc/Enums.cs deleted file mode 100644 index 6ba757d2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Enums.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Netezos.Rpc -{ - /// - /// Type of chain - /// - public enum Chain - { - Main, - Test - } - - /// - /// Status of delegate - /// - public enum DelegateStatus - { - Active, - Inactive - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Enums.cs.meta b/Assets/Scripts/Netezos/Rpc/Enums.cs.meta deleted file mode 100644 index 91bbf4df..00000000 --- a/Assets/Scripts/Netezos/Rpc/Enums.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 88970ea6990d5490f9eff74919f8dd45 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions.meta b/Assets/Scripts/Netezos/Rpc/Exceptions.meta deleted file mode 100644 index e71470f2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 33e8ced371aa24db3b80e4e0fa7deff4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions/BadRequestException.cs b/Assets/Scripts/Netezos/Rpc/Exceptions/BadRequestException.cs deleted file mode 100644 index 821a4cf1..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions/BadRequestException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Net; - -namespace Netezos.Rpc -{ - /// - /// Represents the RPC error with HTTP status code 400 - /// - public class BadRequestException : RpcException - { - public BadRequestException(string message) : base( HttpStatusCode.BadRequest, message) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions/BadRequestException.cs.meta b/Assets/Scripts/Netezos/Rpc/Exceptions/BadRequestException.cs.meta deleted file mode 100644 index 8ddc02e6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions/BadRequestException.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c5cc9a79226cf4c0185a7441b2baa6d0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions/InternalErrorException.cs b/Assets/Scripts/Netezos/Rpc/Exceptions/InternalErrorException.cs deleted file mode 100644 index c4e298a6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions/InternalErrorException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Net; - -namespace Netezos.Rpc -{ - /// - /// Represents the RPC error with HTTP status code 500 - /// - public class InternalErrorException : RpcException - { - public InternalErrorException(string message) : base(HttpStatusCode.InternalServerError, message) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions/InternalErrorException.cs.meta b/Assets/Scripts/Netezos/Rpc/Exceptions/InternalErrorException.cs.meta deleted file mode 100644 index d00bd3aa..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions/InternalErrorException.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c5fc90ce7d4b04de0b20f4f17118bb7d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions/RpcException.cs b/Assets/Scripts/Netezos/Rpc/Exceptions/RpcException.cs deleted file mode 100644 index fc4c4fe9..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions/RpcException.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Net; -using UnityEngine.Networking; - -namespace Netezos.Rpc -{ - /// - /// Represents errors that occur during RPC requests execution - /// - public class RpcException : Exception - { - /// - /// Gets HTTP status code returned by the RPC server - /// - public HttpStatusCode StatusCode { get; set; } - - public RpcException(HttpStatusCode code, string message) : base(message) => StatusCode = code; - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Exceptions/RpcException.cs.meta b/Assets/Scripts/Netezos/Rpc/Exceptions/RpcException.cs.meta deleted file mode 100644 index 0a59904b..00000000 --- a/Assets/Scripts/Netezos/Rpc/Exceptions/RpcException.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0cafec7d6bc5e409da6cf097dc33a682 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries.meta b/Assets/Scripts/Netezos/Rpc/Queries.meta deleted file mode 100644 index 3954f5df..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 191df603991904fbba0413b9ad62d33d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BakingRightsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/BakingRightsQuery.cs deleted file mode 100644 index 35cbc926..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BakingRightsQuery.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to get baking rights - /// - public class BakingRightsQuery : RpcObject - { - internal BakingRightsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json - /// - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetAsync(bool all = false) - => Client.GetJson($"{Query}?all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json. - /// - /// Delegate whose baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetAsync(string baker, bool all = false) - => Client.GetJson($"{Query}?delegate={baker}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// Returns a dynamic json. - /// - /// Maximum priority of baking rights to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetAsync(int maxPriority, bool all = false) - => Client.GetJson($"{Query}?max_priority={maxPriority}&all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json. - /// - /// Level of the block at which the baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromLevelAsync(int level, bool all = false) - => Client.GetJson($"{Query}?level={level}&all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json. - /// - /// Level of the block at which the baking rights are to be returned - /// Delegate whose baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromLevelAsync(int level, string baker, bool all = false) - => Client.GetJson($"{Query}?level={level}&delegate={baker}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// Returns a dynamic json. - /// - /// Level of the block at which the baking rights are to be returned - /// Maximum priority of baking rights to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromLevelAsync(int level, int maxPriority, bool all = false) - => Client.GetJson($"{Query}?level={level}&max_priority={maxPriority}&all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json. - /// - /// Cycle at which the baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromCycleAsync(int cycle, bool all = false) - => Client.GetJson($"{Query}?cycle={cycle}&all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json. - /// - /// Cycle at which the baking rights are to be returned - /// Delegate whose baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromCycleAsync(int cycle, string baker, bool all = false) - => Client.GetJson($"{Query}?cycle={cycle}&delegate={baker}&all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// Returns a dynamic json. - /// - /// Cycle at which the baking rights are to be returned - /// Maximum priority of baking rights to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromCycleAsync(int cycle, int maxPriority, bool all = false) - => Client.GetJson($"{Query}?cycle={cycle}&max_priority={maxPriority}&all={all}"); - - /// - /// Executes the query and returns the baking rights. - /// - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetAsync(bool all = false) - => Client.GetJson($"{Query}?all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Delegate whose baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetAsync(string baker, bool all = false) - => Client.GetJson($"{Query}?delegate={baker}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Maximum priority of baking rights to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetAsync(int maxPriority, bool all = false) - => Client.GetJson($"{Query}?max_priority={maxPriority}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Level of the block at which the baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromLevelAsync(int level, bool all = false) - => Client.GetJson($"{Query}?level={level}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Level of the block at which the baking rights are to be returned - /// Delegate whose baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromLevelAsync(int level, string baker, bool all = false) - => Client.GetJson($"{Query}?level={level}&delegate={baker}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Level of the block at which the baking rights are to be returned - /// Maximum priority of baking rights to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromLevelAsync(int level, int maxPriority, bool all = false) - => Client.GetJson($"{Query}?level={level}&max_priority={maxPriority}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Cycle at which the baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromCycleAsync(int cycle, bool all = false) - => Client.GetJson($"{Query}?cycle={cycle}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Cycle at which the baking rights are to be returned - /// Delegate whose baking rights are to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromCycleAsync(int cycle, string baker, bool all = false) - => Client.GetJson($"{Query}?cycle={cycle}&delegate={baker}&all={all}"); - - /// - /// Executes the query and returns the baking rights - /// - /// Cycle at which the baking rights are to be returned - /// Maximum priority of baking rights to be returned - /// Specifies whether all baking opportunities for each baker will be returned or only the first one - /// - public IEnumerator GetFromCycleAsync(int cycle, int maxPriority, bool all = false) - => Client.GetJson($"{Query}?cycle={cycle}&max_priority={maxPriority}&all={all}"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BakingRightsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/BakingRightsQuery.cs.meta deleted file mode 100644 index 6dcb9ae2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BakingRightsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bf44604d97a1e47aebd993f56de2b6b9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BigMapsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/BigMapsQuery.cs deleted file mode 100644 index d5a077e2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BigMapsQuery.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// Access the value associated with a key in a big map. - /// - public class BigMapsQuery : RpcObject - { - /// - /// Access the value associated with a key in a big map, normalize the output using the requested unparsing mode. - /// - public NormalizedQuery Normalized => new NormalizedQuery(this, "normalized/"); - - internal BigMapsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BigMapsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/BigMapsQuery.cs.meta deleted file mode 100644 index 6e8d741b..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BigMapsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eb925cb65b6384cb7870f97513c76262 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BlockHeaderQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/BlockHeaderQuery.cs deleted file mode 100644 index ce4a02e6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BlockHeaderQuery.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access block header data - /// - public class BlockHeaderQuery : RpcObjectRaw - { - /// - /// Gets the query to the protocol data - /// - public RpcObjectRaw ProtocolData => new RpcObjectRaw(this, "protocol_data/"); - - /// - /// Gets the query to the shell data - /// - public RpcObject Shell => new RpcObject(this, "shell/"); - - internal BlockHeaderQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BlockHeaderQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/BlockHeaderQuery.cs.meta deleted file mode 100644 index 234f8e72..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BlockHeaderQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1487dd585ce6c4d93ace8ac2ec856dbe -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BlockQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/BlockQuery.cs deleted file mode 100644 index ce416569..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BlockQuery.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access block data - /// - public class BlockQuery : RpcObject - { - /// - /// Gets the query to the block hash - /// - public RpcObject Hash => new RpcObject(this, "hash"); - - /// - /// Gets the query to the block header - /// - public BlockHeaderQuery Header => new BlockHeaderQuery(this, "header/"); - - /// - /// Gets the query to the block metadata - /// - public RpcObject Metadata => new RpcObject(this, "metadata"); - - /// - /// Gets the query to the list of the ancestors of the block which, - /// if referred to as the branch in an operation header, are recent enough - /// for that operation to be included in the current block - /// - public RpcObject LiveBlocks => new RpcObject(this, "live_blocks/"); - - /// - /// Gets the query to the context associated with the block - /// - public ContextQuery Context => new ContextQuery(this, "context/"); - - /// - /// Gets the query to the helpers associated with the block - /// - public HelpersQuery Helpers => new HelpersQuery(this, "helpers/"); - - /// - /// Current and next protocol. - /// - public RpcObject Protocols => new RpcObject(this, "protocols/"); - - /// - /// Gets the query to votes data associated with the block - /// - public VotesQuery Votes => new VotesQuery(this, "votes/"); - - /// - /// Gets the query to the list of lists of operations hashes in the block - /// - public RpcArray> OperationsHashes - => new RpcArray>(this, "operation_hashes/"); - - /// - /// Gets the query to the list of lists of operations in the block - /// - public RpcArray> Operations - => new RpcArray>(this, "operations/"); - - internal BlockQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BlockQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/BlockQuery.cs.meta deleted file mode 100644 index 85aaf3fe..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BlockQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75f039c937e4d44569489ea52a629a3b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BlocksQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/BlocksQuery.cs deleted file mode 100644 index 6306c6c8..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BlocksQuery.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using System.Threading.Tasks; -using System.Collections; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access blocks data - /// - public class BlocksQuery : RpcObject - { - /// - /// Gets the query to the current head - /// - public BlockQuery Head => new BlockQuery(this, "head/"); - - /// - /// Gets the query to the block at the specified level - /// - /// Level of the block. If level < 0, then it will be used as [head - level]. - /// - public BlockQuery this[int level] - => level >= 0 ? new BlockQuery(this, $"{level}/") : new BlockQuery(this, $"head~{-level}/"); - - /// - /// Gets the query to the block with the specified hash - /// - /// Hash of the block - /// - public BlockQuery this[string hash] => new BlockQuery(this, $"{hash}/"); - - internal BlocksQuery(RpcClient client, string query) : base(client, query) { } - - /// - /// Executes the query and returns known heads of the blockchain, sorted with decreasing fitness. - /// Returns a dynamic json. - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson(Query); - - /// - /// Executes the query and returns known heads of the blockchain, sorted with decreasing fitness. - /// Returns a dynamic json. - /// - /// Number of blocks per head (head + predessors) to returns - /// - public IEnumerator GetAsync(int length) - => Client.GetJson($"{Query}?length={length}"); - - /// - /// Executes the query and returns known heads of the blockchain, sorted with decreasing fitness. - /// Returns a dynamic json. - /// - /// Datetime before which the heads are filtered out - /// Number of blocks per head (head + predessors) to returns - /// - public IEnumerator GetAsync(DateTime minDate, int length = 1) - => Client.GetJson($"{Query}?min_date={minDate.ToUnixTime()}&length={length}"); - - /// - /// Executes the query and returns the fragment of the chain before the specified block. - /// Returns a dynamic json. - /// - /// Hash of the block which is considered head - /// Number of blocks (head + predessors) to returns - /// - public IEnumerator GetAsync(string head, int length = 1) - => Client.GetJson($"{Query}?head={head}&length={length}"); - - /// - /// Executes the query and returns the fragments of the chain before the specified blocks. - /// Returns a dynamic json. - /// - /// Hashes of the blocks which are considered heads - /// Number of blocks per head (head + predessors) to returns - /// - public IEnumerator GetAsync(List heads, int length = 1) - => Client.GetJson($"{Query}?{String.Join("&", heads.Select(h => $"head={h}"))}&length={length}"); - - /// - /// Executes the query and returns known heads of the blockchain, sorted with decreasing fitness - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson(Query); - - /// - /// Executes the query and returns known heads of the blockchain, sorted with decreasing fitness - /// - /// Number of blocks per head (head + predessors) to returns - /// - public IEnumerator GetAsync(int length) - => Client.GetJson($"{Query}?length={length}"); - - /// - /// Executes the query and returns known heads of the blockchain, sorted with decreasing fitness - /// - /// Datetime before which the heads are filtered out - /// Number of blocks per head (head + predessors) to returns - /// - public IEnumerator GetAsync(DateTime minDate, int length = 1) - => Client.GetJson($"{Query}?min_date={minDate.ToUnixTime()}&length={length}"); - - /// - /// Executes the query and returns the fragment of the chain before the specified block - /// - /// Hash of the block which is considered head - /// Number of blocks (head + predessors) to returns - /// - public IEnumerator GetAsync(string head, int length = 1) - => Client.GetJson($"{Query}?head={head}&length={length}"); - - /// - /// Executes the query and returns the fragments of the chain before the specified blocks - /// - /// Hashes of the blocks which are considered heads - /// Number of blocks per head (head + predessors) to returns - /// - public IEnumerator GetAsync(List heads, int length = 1) - => Client.GetJson($"{Query}?{String.Join("&", heads.Select(h => $"head={h}"))}&length={length}"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/BlocksQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/BlocksQuery.cs.meta deleted file mode 100644 index 40c544e6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/BlocksQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 65d5809ce5c074e10ae5582c06aa4129 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ConstantsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ConstantsQuery.cs deleted file mode 100644 index 675628e6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ConstantsQuery.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access constants data - /// - public class ConstantsQuery : RpcObject - { - /// - /// Gets the query to the schema for all RPC errors from this protocol version - /// - public RpcObject Errors => new RpcObject(this, "errors"); - - internal ConstantsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ConstantsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ConstantsQuery.cs.meta deleted file mode 100644 index e714f21f..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ConstantsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1e952d866efdd4f85affaffd3927bdc4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ContextQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ContextQuery.cs deleted file mode 100644 index 5f627307..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ContextQuery.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access context data - /// - public class ContextQuery : RpcQuery - { - /// - /// Gets the query to the protocol's constants - /// - public RpcSimpleArray> BigMaps - => new RpcSimpleArray>(this, "big_maps/"); - - /// - /// Gets the query to the protocol's constants - /// - public ConstantsQuery Constants => new ConstantsQuery(this, "constants/"); - - /// - /// Gets the query to all existing contracts (including non-empty default contracts) - /// - public ContractsQuery Contracts => new ContractsQuery(this, "contracts/"); - - /// - /// Gets the query to all registered delegates - /// - public DelegatesQuery Delegates => new DelegatesQuery(this, "delegates/"); - - /// - /// Gets the query to the info about the nonce of a previous block - /// - public NoncesQuery Nonces => new NoncesQuery(this, "nonces/"); - - /// - /// Gets the query to the raw context data - /// - public RawContextQuery Raw => new RawContextQuery(this, "raw/json/"); - - /// - /// Gets the query to the seed data - /// - public SeedQuery Seed => new SeedQuery(this, "seed"); - - internal ContextQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ContextQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ContextQuery.cs.meta deleted file mode 100644 index acc6dfcd..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ContextQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 45ff7e7ba790c40168d5e290fb5c470f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ContractQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ContractQuery.cs deleted file mode 100644 index 427e7992..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ContractQuery.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Netezos.Rpc.Queries.Post; -using System; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access contract data - /// - public class ContractQuery : RpcObject - { - /// - /// Gets the query to the balance of a contract - /// - public RpcObject Balance => new RpcObject(this, "balance/"); - - /// - /// Gets the query to the value associated with a key in the big map storage of the contract - /// - [Obsolete("This RPC query is deprecated. Use it on early protocols only.")] - public BigMapQuery BigMap => new BigMapQuery(this, "big_map_get/"); - - /// - /// Gets the query to the counter of a contract, if any - /// - public RpcObject Counter => new RpcObject(this, "counter/"); - - /// - /// Gets the query to the flag, indicating if the contract delegate can be changed - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Delegatable => new RpcObject(this, "delegatable/"); - - /// - /// Gets the query to the delegate of a contract, if any - /// - public RpcObject Delegate => new RpcObject(this, "delegate/"); - - /// - /// Return the list of entrypoints of the contract - /// - public EntrypointsQuery Entrypoints => new EntrypointsQuery(this, "entrypoints/"); - - /// - /// Gets the query to the manager of a contract - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Manager => new RpcObject(this, "manager/"); - - /// - /// Gets the query to the manager of a contract and his key - /// - public RpcObject ManagerKey => new RpcObject(this, "manager_key/"); - - /// - /// Gets the query to the code and data of the contract - /// - public ScriptQuery Script => new ScriptQuery(this, "script/"); - - /// - /// Gets the query to the flag, indicating if the contract tokens can be spent by the manager - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Spendable => new RpcObject(this, "spendable/"); - - /// - /// Gets the query to the data of the contract's storage - /// - public StorageQuery Storage => new StorageQuery(this, "storage/"); - - internal ContractQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ContractQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ContractQuery.cs.meta deleted file mode 100644 index cddd6ee3..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ContractQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 06383170151c64df7b9244b0fb505c7b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ContractsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ContractsQuery.cs deleted file mode 100644 index 6b5d28cc..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ContractsQuery.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access all existing contracts - /// - public class ContractsQuery : RpcObject - { - /// - /// Gets the query to the complete status of a contract by address - /// - /// Address of the contract - /// - public ContractQuery this[string address] => new ContractQuery(this, $"{address}/"); - - internal ContractsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ContractsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ContractsQuery.cs.meta deleted file mode 100644 index 1514ff24..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ContractsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d408bfb51fe9645c5b7b69734e9ad040 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/DelegateQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/DelegateQuery.cs deleted file mode 100644 index 3773af9f..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/DelegateQuery.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access contract data - /// - public class DelegateQuery : RpcObject - { - /// - /// Returns the current amount of the frozen deposits (in mutez). - /// - public RpcObject CurrentFrozenDeposits => new RpcObject(this, "current_frozen_deposits/"); - - /// - /// Gets the query to the full balance of a given delegate, including the frozen balances - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Balance => new RpcObject(this, "balance/"); - - /// - /// Gets the query to the full balance of a given delegate, including the frozen balances - /// - public RpcObject FullBalance => new RpcObject(this, "full_balance/"); - - /// - /// Gets the query to the flag, indicating whether the delegate is currently tagged as deactivated or not - /// - public RpcObject Deactivated => new RpcObject(this, "deactivated/"); - - /// - /// Gets the query to the balances of all the contracts that delegate to a given delegate. This excludes the delegate's own balance and its frozen balances - /// - public RpcObject DelegatedBalance => new RpcObject(this, "delegated_balance/"); - - /// - /// Gets the query to the list of contracts that delegate to a given delegate - /// - public RpcObject DelegatedContracts => new RpcObject(this, "delegated_contracts/"); - - /// - /// Gets the query to the total frozen balances of a given delegate, this includes the frozen deposits, rewards and fees - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject FrozenBalance => new RpcObject(this, "frozen_balance/"); - - /// - /// Gets the query to the frozen balances of a given delegate, indexed by the cycle by which it will be unfrozen - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject FrozenBalanceByCycle => new RpcObject(this, "frozen_balance_by_cycle/"); - - /// - /// Returns the initial amount (that is, at the beginning of a cycle) of the frozen deposits (in mutez). This amount is the same as the current amount of the frozen deposits, unless the delegate has been punished. - /// - public RpcObject FrozenDeposits => new RpcObject(this, "frozen_deposits/"); - - /// - /// Returns the frozen deposits limit for the given delegate or none if no limit is set. - /// - public RpcObject FrozenDepositsLimit => new RpcObject(this, "frozen_deposits_limit/"); - - /// - /// Gets the query to the cycle by the end of which the delegate might be deactivated if he fails to execute any delegate action - /// - public RpcObject GracePeriod => new RpcObject(this, "grace_period/"); - - /// - /// Returns cycle and level participation information. In particular this indicates, in the field 'expected_cycle_activity', - /// the number of slots the delegate is expected to have in the cycle based on its active stake. The field 'minimal_cycle_activity' indicates the minimal endorsing slots in the cycle required to get endorsing rewards. - /// It is computed based on 'expected_cycle_activity. The fields 'missed_slots' and 'missed_levels' indicate the number of missed endorsing slots and missed levels (for endorsing) in the cycle so far. - /// 'missed_slots' indicates the number of missed endorsing slots in the cycle so far. The field 'remaining_allowed_missed_slots' indicates the remaining amount of endorsing slots that can be missed in the cycle before forfeiting the rewards. - /// Finally, 'expected_endorsing_rewards' indicates the endorsing rewards that will be distributed at the end of the cycle if activity at that point will be greater than the minimal required; if the activity is already known to be below the required minimum, then the rewards are zero. - /// - public RpcObject Participation => new RpcObject(this, "participation/"); - - /// - /// Gets the query to the total amount of tokens delegated to a given delegate, including the balance of the delegate itself and its frozen fees and deposits - /// - public RpcObject StakingBalance => new RpcObject(this, "staking_balance/"); - - /// - /// The number of rolls in the vote listings for a given delegate - /// - public RpcObject VotingPower => new RpcObject(this, "voting_power/"); - - internal DelegateQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/DelegateQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/DelegateQuery.cs.meta deleted file mode 100644 index 9f87c1cb..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/DelegateQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7af1a5a7bce6f475a8984096933f47bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/DelegatesQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/DelegatesQuery.cs deleted file mode 100644 index b696ca3f..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/DelegatesQuery.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access all registered delegates - /// - public class DelegatesQuery : RpcObject - { - /// - /// Gets the query to the complete status of a delegate by address - /// - /// Address of the delegate - /// - public DelegateQuery this[string address] => new DelegateQuery(this, $"{address}/"); - - internal DelegatesQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Executes the query and returns all registered delegates. - /// Returns a dynamic json. - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson($"{Query}?active=true&inactive=true"); - - /// - /// Executes the query and returns all registered delegates with the specified status. - /// Returns a dynamic json. - /// - /// Status of the delegates to return - /// - public IEnumerator GetAsync(DelegateStatus status) - => Client.GetJson($"{Query}?{status.ToString().ToLower()}=true"); - - /// - /// Executes the query and returns all registered delegates - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson($"{Query}?active=true&inactive=true"); - - /// - /// Executes the query and returns all registered delegates with the specified status - /// - /// Status of the delegates to return - /// - public IEnumerator GetAsync(DelegateStatus status) - => Client.GetJson($"{Query}?{status.ToString().ToLower()}=true"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/DelegatesQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/DelegatesQuery.cs.meta deleted file mode 100644 index 9b1ef168..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/DelegatesQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 51a1604d33cc849c2a4510166c3439c4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/EndorsingRightsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/EndorsingRightsQuery.cs deleted file mode 100644 index 21e17202..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/EndorsingRightsQuery.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to get endorsing rights - /// - public class EndorsingRightsQuery : RpcObject - { - internal EndorsingRightsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Executes the query and returns the endorsing rights. - /// Returns a dynamic json. - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson(Query); - - /// - /// Executes the query and returns the endorsing rights. - /// Returns a dynamic json. - /// - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetAsync(string baker) - => Client.GetJson($"{Query}?delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights. - /// Returns a dynamic json. - /// - /// Level of the block at which the endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level) - => Client.GetJson($"{Query}?level={level}"); - - /// - /// Executes the query and returns the endorsing rights. - /// Returns a dynamic json. - /// - /// Level of the block at which the endorsing rights are to be returned - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level, string baker) - => Client.GetJson($"{Query}?level={level}&delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// Returns a dynamic json. - /// - /// Cycle at which the endorsing rights are to be returned - /// - public IEnumerator GetFromCycleAsync(int cycle) - => Client.GetJson($"{Query}?cycle={cycle}"); - - /// - /// Executes the query and returns the endorsing rights - /// Returns a dynamic json. - /// - /// Cycle at which the endorsing rights are to be returned - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetFromCycleAsync(int cycle, string baker) - => Client.GetJson($"{Query}?cycle={cycle}&delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson(Query); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetAsync(string baker) - => Client.GetJson($"{Query}?delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Level of the block at which the endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level) - => Client.GetJson($"{Query}?level={level}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Level of the block at which the endorsing rights are to be returned - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level, string baker) - => Client.GetJson($"{Query}?level={level}&delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Cycle at which the endorsing rights are to be returned - /// - public IEnumerator GetFromCycleAsync(int cycle) - => Client.GetJson($"{Query}?cycle={cycle}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Cycle at which the endorsing rights are to be returned - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetFromCycleAsync(int cycle, string baker) - => Client.GetJson($"{Query}?cycle={cycle}&delegate={baker}"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/EndorsingRightsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/EndorsingRightsQuery.cs.meta deleted file mode 100644 index acaf5726..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/EndorsingRightsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b3fb155deff3f4403b7d2839e44c6570 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/EntrypointsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/EntrypointsQuery.cs deleted file mode 100644 index b0b95fec..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/EntrypointsQuery.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access the contract entrypoints - /// - public class EntrypointsQuery : RpcObject - { - /// - /// Return the type of the given entrypoint of the contract - /// - /// Entrypoint of the contract - /// - public RpcObject this[string entrypoint] => new RpcObject(this, $"{entrypoint}/"); - - internal EntrypointsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/EntrypointsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/EntrypointsQuery.cs.meta deleted file mode 100644 index d471c82a..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/EntrypointsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9abbef8fcf6364d8690f3215be577cb7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ForgeQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ForgeQuery.cs deleted file mode 100644 index 66f439d4..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ForgeQuery.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// RPC query to access forging - /// - public class ForgeQuery : RpcQuery - { - /// - /// Gets the query to the block header forging - /// - public ForgeBlockHeaderQuery BlockHeader => new ForgeBlockHeaderQuery(Base, "forge_block_header/"); - - /// - /// Gets the query to the protocol data forging - /// - public ForgeProtocolDataQuery ProtocolData => new ForgeProtocolDataQuery(this, "protocol_data/"); - - /// - /// Gets the query to the operations forging - /// - public ForgeOperationsQuery Operations => new ForgeOperationsQuery(this, "operations/"); - - internal ForgeQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ForgeQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ForgeQuery.cs.meta deleted file mode 100644 index 234c8118..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ForgeQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b857f56869af44201a242d2fa808a181 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/FrozenBalanceQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/FrozenBalanceQuery.cs deleted file mode 100644 index 245dbec4..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/FrozenBalanceQuery.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to get the frozen balances - /// - public class FrozenBalanceQuery : RpcObject - { - /// - /// Gets the query to the frozen deposits - /// - public BlockQuery Deposits => new BlockQuery(this, "deposits/"); - - /// - /// Gets the query to the frozen fees - /// - public BlockQuery Fees => new BlockQuery(this, "fees/"); - - /// - /// Gets the query to the frozen rewards - /// - public BlockQuery Rewards => new BlockQuery(this, "rewards/"); - - internal FrozenBalanceQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/FrozenBalanceQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/FrozenBalanceQuery.cs.meta deleted file mode 100644 index 7c60e848..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/FrozenBalanceQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6de05cf6631274808ba01d3568c61eab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/HelpersQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/HelpersQuery.cs deleted file mode 100644 index 7632c145..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/HelpersQuery.cs +++ /dev/null @@ -1,55 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// RPC query to get helpers associated with a block - /// - public class HelpersQuery : RpcQuery - { - /// - /// Gets the query to the baking rights - /// - public BakingRightsQuery BakingRights => new BakingRightsQuery(this, "baking_rights"); - - /// - /// Returns the level of the interrogated block. - /// - public RpcObject CurrentLevel => new RpcObject(this, "current_level"); - - /// - /// Gets the query to the endorsing rights - /// - public EndorsingRightsQuery EndorsingRights => new EndorsingRightsQuery(this, "endorsing_rights"); - - /// - /// Gets the query to the forging - /// - public ForgeQuery Forge => new ForgeQuery(this, "forge/"); - - /// - /// Levels of a cycle - /// - public RpcObject LevelsInCurrentCycle => new RpcObject(this, "levels_in_current_cycle"); - - /// - /// Gets the query to the parsing - /// - public ParseQuery Parse => new ParseQuery(this, "parse/"); - - /// - /// Gets the query to the preapplying - /// - public PreapplyQuery Preapply => new PreapplyQuery(this, "preapply/"); - - /// - /// Gets the query to scripts - /// - public ScriptsQuery Scripts => new ScriptsQuery(this, "scripts/"); - - /// - /// Gets the query to validators - /// - public ValidatorsQuery Validators => new ValidatorsQuery(this, "validators"); - - internal HelpersQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/HelpersQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/HelpersQuery.cs.meta deleted file mode 100644 index e498f496..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/HelpersQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1321be20db485445eb26d9b4c21000e0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/InjectionQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/InjectionQuery.cs deleted file mode 100644 index 7b15c54d..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/InjectionQuery.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// RPC query to access injections - /// - public class InjectionQuery : RpcObject - { - /// - /// Gets the query to the block injection - /// - public InjectBlockQuery Block => new InjectBlockQuery(this, "block/"); - - /// - /// Gets the query to the operation injection - /// - public InjectOperationQuery Operation => new InjectOperationQuery(this, "operation/"); - - /// - /// Gets the query to the protocol injection - /// - public InjectProtocolQuery Protocol => new InjectProtocolQuery(this, "protocol/"); - - internal InjectionQuery(RpcClient client, string query) : base(client, query) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/InjectionQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/InjectionQuery.cs.meta deleted file mode 100644 index 2f5b5e78..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/InjectionQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ba2b24d0ae7a47029dc59725d3b18d5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/NoncesQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/NoncesQuery.cs deleted file mode 100644 index 443e89e0..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/NoncesQuery.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access nonces data - /// - public class NoncesQuery : RpcQuery - { - /// - /// Gets the query to the nonce of a previous block - /// - /// Level of the block - /// - public RpcObject this[int level] => new RpcObject(this, $"{level}"); - - internal NoncesQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/NoncesQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/NoncesQuery.cs.meta deleted file mode 100644 index 656f0759..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/NoncesQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37f71e7104a5946d381f25d26c2ac969 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ParseQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ParseQuery.cs deleted file mode 100644 index b454fe19..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ParseQuery.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// RPC query to get data parsing helpers associated with a block - /// - public class ParseQuery : RpcQuery - { - /// - /// Gets the query to the block parsing - /// - public ParseBlockQuery Block => new ParseBlockQuery(this, "block/"); - - /// - /// Gets the query to the operations parsing - /// - public ParseOperationsQuery Operations => new ParseOperationsQuery(this, "operations/"); - - internal ParseQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ParseQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ParseQuery.cs.meta deleted file mode 100644 index 9c328511..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ParseQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 45cabf2902df64df0a7bf5f6e59669e6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post.meta deleted file mode 100644 index fb576aec..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a7dcf0cf8aded4202af07e8ce34c14fc -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/BigMapQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/BigMapQuery.cs deleted file mode 100644 index 4db71493..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/BigMapQuery.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access big_map storage - /// - public class BigMapQuery : RpcMethod - { - internal BigMapQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Gets the value associated with a key in the big_map storage of the contract - /// - /// Key (micheline michelson expression) - /// Type of the key (micheline michelson expression) - /// Primitive michelson type - /// - public IEnumerator PostAsync(object key, string type, string prim) - => PostAsync(new - { - key = new Dictionary { { type, key } }, - type = new { prim } - }); - - /// - /// Gets the value associated with a key in the big_map storage of the contract - /// - /// Key (micheline michelson expression) - /// Type of the key (micheline michelson expression) - public IEnumerator PostAsync(object key, object type) - => PostAsync(new - { - key, - type - }); - - /// - /// Gets the value associated with a key in the big_map storage of the contract - /// - /// Type of the object to deserialize to - /// Key (micheline michelson expression) - /// Type of the key (micheline michelson expression) - /// Primitive michelson type - /// - public IEnumerator PostAsync(object key, string type, string prim) - => PostAsync(new - { - key = new Dictionary { { type, key } }, - type = new { prim } - }); - - /// - /// Gets the value associated with a key in the big_map storage of the contract - /// - /// Type of the object to deserialize to - /// Key (micheline michelson expression) - /// Type of the key (micheline michelson expression) - /// - public IEnumerator PostAsync(object key, object type) - => PostAsync(new - { - key, - type - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/BigMapQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/BigMapQuery.cs.meta deleted file mode 100644 index 5752eb33..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/BigMapQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 19c022be41b0744e1ac17ab7ceb4c8dc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeBlockHeaderQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeBlockHeaderQuery.cs deleted file mode 100644 index 0bd347e0..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeBlockHeaderQuery.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access block headers forging - /// - public class ForgeBlockHeaderQuery : RpcMethod - { - internal ForgeBlockHeaderQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Forges a block header and returns forged bytes - /// - /// Level of the block - /// Number of the protocol - /// Predecessor - /// Timestamp - /// Validation pass - /// A list of list of operations (Base58Check-encoded) - /// Fitness of the block - /// Context hash (Base58Check-encoded) - /// Protocol data hexadecimal string - /// - public IEnumerator PostAsync(int level, int proto, string predecessor, DateTime timestamp, - int validationPass, string operationsHash, List fitness, string context, string protocolData) - => PostAsync(new - { - level, - proto, - predecessor, - timestamp, - validation_pass = validationPass, - operations_hash = operationsHash, - fitness, - context, - protocol_data = protocolData - }); - - /// - /// Forges a block header and returns forged bytes - /// - /// Level of the block - /// Number of the protocol - /// Predecessor - /// Timestamp - /// Validation pass - /// A list of list of operations (Base58Check-encoded) - /// Fitness of the block - /// Context hash (Base58Check-encoded) - /// Protocol data hexadecimal string - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(int level, int proto, string predecessor, DateTime timestamp, - int validationPass, string operationsHash, List fitness, string context, string protocolData) - => PostAsync(new - { - level, - proto, - predecessor, - timestamp, - validation_pass = validationPass, - operations_hash = operationsHash, - fitness, - context, - protocol_data = protocolData - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeBlockHeaderQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeBlockHeaderQuery.cs.meta deleted file mode 100644 index 9d2c6534..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeBlockHeaderQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cf0474a6e002447b5a2e3fbe4bf7b667 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeOperationsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeOperationsQuery.cs deleted file mode 100644 index d2fe73d4..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeOperationsQuery.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access operations forging - /// - public class ForgeOperationsQuery : RpcMethod - { - internal ForgeOperationsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Forges an operation and returns operation bytes which can be signed - /// - /// Branch - /// List of operation contents - /// - public IEnumerator PostAsync(string branch, List contents) - => PostAsync(new - { - branch, - contents - }); - - /// - /// Forges an operation and returns operation bytes which can be signed - /// - /// Branch - /// List of operation contents - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(string branch, List contents) - => PostAsync(new - { - branch, - contents - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeOperationsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeOperationsQuery.cs.meta deleted file mode 100644 index 83b9a3c5..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeOperationsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7cfb3c39b90c74695a39a3e2ad19ef05 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeProtocolDataQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeProtocolDataQuery.cs deleted file mode 100644 index 8eaab23c..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeProtocolDataQuery.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access protocol data forging - /// - public class ForgeProtocolDataQuery : RpcMethod - { - internal ForgeProtocolDataQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Forges the protocol-specific part of a block header and returns forged bytes - /// - /// Priority - /// Nonce hash - /// Proof of work nonce (optional) - /// - public IEnumerator PostAsync(int priority, string nonceHash, string powNonce) - => PostAsync(new - { - priority, - nonce_hash = nonceHash, - proof_of_work_nonce = powNonce - }); - - /// - /// Forges the protocol-specific part of a block header and returns forged bytes - /// - /// Priority - /// Nonce hash - /// Proof of work nonce (optional) - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(int priority, string nonceHash, string powNonce) - => PostAsync(new - { - priority, - nonce_hash = nonceHash, - proof_of_work_nonce = powNonce - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeProtocolDataQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeProtocolDataQuery.cs.meta deleted file mode 100644 index 0eb7a672..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ForgeProtocolDataQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 15df7b7be6ca6487fa34a220dafcac05 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectBlockQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectBlockQuery.cs deleted file mode 100644 index 335dd33a..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectBlockQuery.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access blocks injection - /// - public class InjectBlockQuery : RpcMethod - { - internal InjectBlockQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Injects a block into the node and returns the ID of the block - /// - /// Forged block header data - /// List of operations - /// Async (optional) - /// Force (optional) - /// Chain (optional) - /// - public IEnumerator PostAsync(string data, List> operations,bool async = false, bool force = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&force={force}&chain={chain.ToString().ToLower()}", - new { data, operations }); - - /// - /// Injects a block into the node and returns the ID of the block - /// - /// Forged block header data - /// List of operations - /// Async (optional) - /// Force (optional) - /// Chain (optional) - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(string data, List> operations, bool async = false, bool force = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&force={force}&chain={chain.ToString().ToLower()}", - new { data, operations }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectBlockQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectBlockQuery.cs.meta deleted file mode 100644 index ecbb5590..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectBlockQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 80b423126ffdb4dff920494075eda030 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectOperationQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectOperationQuery.cs deleted file mode 100644 index 693feceb..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectOperationQuery.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; -using Netezos.Encoding; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access operations injection - /// - public class InjectOperationQuery : RpcMethod - { - internal InjectOperationQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Injects an operation into the node and returns the ID of the operation - /// - /// Signed operation bytes - /// Async (optional) - /// Chain (optional) - /// - public IEnumerator PostAsync(byte[] data, bool async = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&chain={chain.ToString().ToLower()}", - $"\"{Hex.Convert(data)}\""); - - /// - /// Injects an operation into the node and returns the ID of the operation - /// - /// Signed operation bytes - /// Async (optional) - /// Chain (optional) - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(byte[] data, bool async = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&chain={chain.ToString().ToLower()}", - $"\"{Hex.Convert(data)}\""); - - /// - /// Injects an operation into the node and returns the ID of the operation - /// - /// Signed operation bytes - /// Async (optional) - /// Chain (optional) - /// - public IEnumerator PostAsync(IEnumerable data, bool async = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&chain={chain.ToString().ToLower()}", - $"\"{Hex.Convert(data)}\""); - - /// - /// Injects an operation into the node and returns the ID of the operation - /// - /// Signed operation bytes - /// Async (optional) - /// Chain (optional) - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(IEnumerable data, bool async = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&chain={chain.ToString().ToLower()}", - $"\"{Hex.Convert(data)}\""); - - /// - /// Injects an operation into the node and returns the ID of the operation - /// - /// Signed operation hex bytes - /// Async (optional) - /// Chain (optional) - /// - public IEnumerator PostAsync(string data, bool async = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&chain={chain.ToString().ToLower()}", - $"\"{data}\""); - - /// - /// Injects an operation into the node and returns the ID of the operation - /// - /// Signed operation hex bytes - /// Async (optional) - /// Chain (optional) - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(string data, bool async = false, Chain chain = Chain.Main) - => Client.PostJson( - $"{Query}?async={async}&chain={chain.ToString().ToLower()}", - $"\"{data}\""); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectOperationQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectOperationQuery.cs.meta deleted file mode 100644 index 37a9abac..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectOperationQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ccd4b59b5aead4967badb284b2ea6433 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectProtocolQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectProtocolQuery.cs deleted file mode 100644 index 2de75cc0..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectProtocolQuery.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access protocols injection - /// - public class InjectProtocolQuery : RpcMethod - { - internal InjectProtocolQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Injects a protocol into the node and returns the ID of the protocol - /// - /// Expected environment version - /// List of components - /// Async (optional) - /// Force (optional) - /// - public IEnumerator PostAsync(int expectedEnvVersion, List components,bool async = false, bool force = false) - => Client.PostJson( - $"{Query}?async={async}&force={force}", - new - { - expected_env_version = expectedEnvVersion, - components - }); - - /// - /// Injects a protocol into the node and returns the ID of the protocol - /// - /// Expected environment version - /// List of components - /// Async (optional) - /// Force (optional) - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync(int expectedEnvVersion, List components, bool async = false, bool force = false) - => Client.PostJson( - $"{Query}?async={async}&force={force}", - new - { - expected_env_version = expectedEnvVersion, - components - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectProtocolQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectProtocolQuery.cs.meta deleted file mode 100644 index 66582a8a..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/InjectProtocolQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b89e67a6d4bb34056a5ffde13e6f3e08 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/NormalizedQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/NormalizedQuery.cs deleted file mode 100644 index 74dbb7aa..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/NormalizedQuery.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access normalized output - /// - public class NormalizedQuery : RpcMethod - { - internal NormalizedQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) - { - } - - /// - /// Normalize the output using the requested unparsing mode. - /// - /// Unparsing mode - /// - public IEnumerator PostAsync(UnparsingMode mode) - => PostAsync(new - { - unparsing_mode = mode.ToString() - }); - - public enum UnparsingMode - { - Readable, - Optimized, - Optimized_legacy - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/NormalizedQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/NormalizedQuery.cs.meta deleted file mode 100644 index 510455d2..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/NormalizedQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 140b1b142dc714d45a463b8ecd254639 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/PackDataQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/PackDataQuery.cs deleted file mode 100644 index 1848f484..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/PackDataQuery.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access data packing - /// - public class PackDataQuery : RpcMethod - { - internal PackDataQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Computes the serialized version of some data expression using the same algorithm as script instruction PACK - /// - /// Micheline michelson expression - /// Type of the data (micheline michelson expression) - /// Gas limit - /// - public IEnumerator PostAsync(object data, object type, long? gas = null) - => PostAsync(new - { - data, - type, - gas = gas?.ToString() - }); - - /// - /// Computes the serialized version of some data expression using the same algorithm as script instruction PACK - /// - /// Type of the object to deserialize to - /// Micheline michelson expression - /// Type of the data (micheline michelson expression) - /// Gas limit - /// - public IEnumerator PostAsync(object data, object type, long? gas = null) - => PostAsync(new - { - data, - type, - gas = gas?.ToString() - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/PackDataQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/PackDataQuery.cs.meta deleted file mode 100644 index 0921002b..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/PackDataQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6488afe9e67ab454a87497857e140b36 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseBlockQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseBlockQuery.cs deleted file mode 100644 index 092aee5e..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseBlockQuery.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access blocks parsing - /// - public class ParseBlockQuery : RpcMethod - { - internal ParseBlockQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Parses a block and returns the block header signed content - /// - /// Level of block - /// Protocol number - /// Predecessor - /// Timestamp - /// Validation pass - /// A list of list of operations (Base58Check-encoded) - /// Block fitness - /// Context hash (Base58Check-encoded) - /// Protocol data hexadecimal string - /// - public IEnumerator PostAsync(int level, int proto, string predecessor, DateTime timestamp, - int validationPass, string operationsHash, List fitness, string context, string protocolData) - => PostAsync(new - { - level, - proto, - predecessor, - timestamp, - validation_pass = validationPass, - operations_hash = operationsHash, - fitness, - context, - protocol_data = protocolData - }); - - /// - /// Parses a block and returns the block header signed content - /// - /// Type of the object to deserialize to - /// Level of block - /// Protocol number - /// Predecessor - /// Timestamp - /// Validation pass - /// A list of list of operations (Base58Check-encoded) - /// Block fitness - /// Context hash (Base58Check-encoded) - /// Protocol data hexadecimal string - /// - public IEnumerator PostAsync(int level, int proto, string predecessor, DateTime timestamp, - int validationPass, string operationsHash, List fitness, string context, string protocolData) - => PostAsync(new - { - level, - proto, - predecessor, - timestamp, - validation_pass = validationPass, - operations_hash = operationsHash, - fitness, - context, - protocol_data = protocolData - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseBlockQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseBlockQuery.cs.meta deleted file mode 100644 index 04211e7b..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseBlockQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a21ce3c09260940c9bb78a57b4dd27f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseOperationsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseOperationsQuery.cs deleted file mode 100644 index 4edb09e1..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseOperationsQuery.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access operations parsing - /// - public class ParseOperationsQuery : RpcMethod - { - internal ParseOperationsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Parses operations and returns the operations content - /// - /// List of operation - /// Check signature (optional) - /// - public IEnumerator PostAsync(List operations, bool? checkSignature = null) - => PostAsync(new - { - operations, - check_signature = checkSignature - }); - - /// - /// Parses operations and returns the operations content - /// - /// Type of the object to deserialize to - /// List of operation - /// Check signature (optional) - /// - public IEnumerator PostAsync(List operations, bool? checkSignature = null) - => PostAsync(new - { - operations, - check_signature = checkSignature - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseOperationsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseOperationsQuery.cs.meta deleted file mode 100644 index 0fa64af1..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/ParseOperationsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dfb209e551a4b4ae799ef117771c2277 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyBlockQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyBlockQuery.cs deleted file mode 100644 index 6180c570..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyBlockQuery.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access blocks preapplying - /// - public class PreapplyBlockQuery : RpcMethod - { - internal PreapplyBlockQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Simulates the validation of a block that would contain the given operations and returns the resulting fitness and context hash - /// - /// Protocol hash - /// Priority - /// Proof of work nonce - /// Signature - /// List of operations - /// Seed nonce hash (optional) - /// - public IEnumerator PostAsync(string protocol, int priority, string powNonce, string signature, List> operations, string seedNonceHash = null) - => PostAsync(new - { - protocol_data = new - { - protocol, - priority, - proof_of_work_nonce = powNonce, - seed_nonce_hash = seedNonceHash, - signature - }, - operations - }); - - /// - /// Simulates the validation of a block that would contain the given operations and returns the resulting fitness and context hash - /// - /// Protocol hash - /// Priority - /// Proof of work nonce - /// Signature - /// List of operations - /// Timestamp - /// Sort (optional) - /// Seed nonce hash (optional) - /// - public IEnumerator PostAsync(string protocol, int priority, string powNonce, string signature, - List> operations, DateTime timestamp, bool sort = false, string seedNonceHash = null) - => Client.PostJson( - $"{Query}?sort={sort}×tamp={timestamp.ToUnixTime()}", - new - { - protocol_data = new - { - protocol, - priority, - proof_of_work_nonce = powNonce, - seed_nonce_hash = seedNonceHash, - signature - }, - operations - }); - - /// - /// Simulates the validation of a block that would contain the given operations and returns the resulting fitness and context hash - /// - /// Type of the object to deserialize to - /// Protocol hash - /// Priority - /// Proof of work nonce - /// Signature - /// List of operations - /// Seed nonce hash (optional) - /// - public IEnumerator PostAsync(string protocol, int priority, string powNonce, string signature, List> operations, string seedNonceHash = null) - => PostAsync(new - { - protocol_data = new - { - protocol, - priority, - proof_of_work_nonce = powNonce, - seed_nonce_hash = seedNonceHash, - signature - }, - operations - }); - - /// - /// Simulates the validation of a block that would contain the given operations and returns the resulting fitness and context hash - /// - /// Type of the object to deserialize to - /// Protocol hash - /// Priority - /// Proof of work nonce - /// Signature - /// List of operations - /// Timestamp - /// Sort (optional) - /// Seed nonce hash (optional) - /// - public IEnumerator PostAsync(string protocol, int priority, string powNonce, string signature, - List> operations, DateTime timestamp, bool sort = false, string seedNonceHash = null) - => Client.PostJson( - $"{Query}?sort={sort}×tamp={timestamp.ToUnixTime()}", - new - { - protocol_data = new - { - protocol, - priority, - proof_of_work_nonce = powNonce, - seed_nonce_hash = seedNonceHash, - signature - }, - operations - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyBlockQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyBlockQuery.cs.meta deleted file mode 100644 index a3ca05c8..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyBlockQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cf4e31e67052f47e2a2c63bfad685bc6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyOperationQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyOperationQuery.cs deleted file mode 100644 index 298e25ea..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyOperationQuery.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access operations preapplying - /// - public class PreapplyOperationQuery : RpcMethod - { - internal PreapplyOperationQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Simulates the validation of an operation and returns the preapplied data - /// - /// Branch - /// Protocol hash - /// Signature - /// List of contents - /// - public IEnumerator PostAsync(string protocol, string signature, string branch, List contents) - => PostAsync(new[] - { - new - { - protocol, - signature, - branch, - contents - } - }); - - /// - /// Simulates the validation of an operation and returns the preapplied data - /// - /// Type of the object to deserialize to - /// Branch - /// Protocol hash - /// Signature - /// List of contents - /// - public IEnumerator PostAsync(string protocol, string signature, string branch, List contents) - => PostAsync(new[] - { - new - { - protocol, - signature, - branch, - contents - } - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyOperationQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyOperationQuery.cs.meta deleted file mode 100644 index cb9b0c2a..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/PreapplyOperationQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6e0a957227b9f44568952e4f76c642c3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunCodeQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/RunCodeQuery.cs deleted file mode 100644 index 7e88190d..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunCodeQuery.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access code running - /// - public class RunCodeQuery : RpcMethod - { - internal RunCodeQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Runs a piece of code in the current context and returns the storage, operations and big_map data - /// - /// Script (micheline michelson expression) - /// Storage (micheline michelson expression) - /// Input(micheline michelson expression) - /// Amount - /// Source (optional) - /// Payer (optional) - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object script, object storage, object input, long amount, string source = null, string payer = null, long? gas = null) - => PostAsync(new - { - script, - storage, - input, - amount = amount.ToString(), - source, - payer, - gas = gas?.ToString() - }); - - /// - /// Runs a piece of code in the current context and returns the storage, operations and big_map data - /// - /// Type of the object to deserialize to - /// Script (micheline michelson expression) - /// Storage (micheline michelson expression) - /// Input(micheline michelson expression) - /// Amount - /// Source (optional) - /// Payer (optional) - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object script, object storage, object input, long amount, string source = null, string payer = null, long? gas = null) - => PostAsync(new - { - script, - storage, - input, - amount = amount.ToString(), - entrypoint = "view1", - source, - payer, - gas = gas?.ToString() - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunCodeQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/RunCodeQuery.cs.meta deleted file mode 100644 index 54edd3ef..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunCodeQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 954446d0054a24d3bb63a1c010550a43 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunOperationQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/RunOperationQuery.cs deleted file mode 100644 index d80ab531..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunOperationQuery.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; -using Netezos.Forging.Models; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access operations running - /// - public class RunOperationQuery : RpcMethod - { - const string ChainStub = "NetXdQprcVkpaWU"; - const string BranchStub = "BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2"; - const string SignatureStub = "sigQFenAPMsrMxVvgH1K33sJgj5VqD3gajK1sBJyEugCzZ9EgTvHGiXii9opAgkei7tY1qpJKyB37YGdGGMAWdgodPyDcQvg"; - - internal RunOperationQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Runs an operation without signature checks and returns the operation result - /// - /// Operation content - /// - public IEnumerator PostAsync(params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch = BranchStub, - contents, - signature = SignatureStub - }, - chain_id = ChainStub - }); - - /// - /// Runs an operation without signature checks and returns the operation result - /// - /// Type of the object to deserialize to - /// Operation content - /// - public IEnumerator PostAsync(params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch = BranchStub, - contents, - signature = SignatureStub - }, - chain_id = ChainStub - }); - - /// - /// Runs an operation without signature checks and returns the operation result - /// - /// Chain id - /// Branch - /// List of operation contents - /// - public IEnumerator PostAsync(string chain_id, string branch, params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch, - contents, - signature = SignatureStub - }, - chain_id - }); - - /// - /// Runs an operation without signature checks and returns the operation result - /// - /// Type of the object to deserialize to - /// Chain id - /// Branch - /// List of operation contents - /// - public IEnumerator PostAsync(string chain_id, string branch, params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch, - contents, - signature = SignatureStub - }, - chain_id - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunOperationQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/RunOperationQuery.cs.meta deleted file mode 100644 index d5862f62..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/RunOperationQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 664769860e5564022919c08e610c7634 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/SeedQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/SeedQuery.cs deleted file mode 100644 index c15ba58d..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/SeedQuery.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access the seed - /// - public class SeedQuery : RpcMethod - { - internal SeedQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Gets the seed of the cycle to which the block belongs - /// - /// - public IEnumerator PostAsync() => PostAsync(new { }); - - /// - /// Gets the seed of the cycle to which the block belongs - /// - /// Type of the object to deserialize to - /// - public IEnumerator PostAsync() => PostAsync(new { }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/SeedQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/SeedQuery.cs.meta deleted file mode 100644 index 26e41794..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/SeedQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 82a19f48422c647158fa4c4d0d3b7c25 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/SimulateOperationQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/SimulateOperationQuery.cs deleted file mode 100644 index 67039c98..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/SimulateOperationQuery.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; -using Netezos.Forging.Models; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access operations simulation - /// - public class SimulateOperationQuery : RpcMethod - { - const string ChainStub = "NetXdQprcVkpaWU"; - const string BranchStub = "BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2"; - const string SignatureStub = "sigQFenAPMsrMxVvgH1K33sJgj5VqD3gajK1sBJyEugCzZ9EgTvHGiXii9opAgkei7tY1qpJKyB37YGdGGMAWdgodPyDcQvg"; - const int LatencyStub = 32767; - - internal SimulateOperationQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Simulate an operation - /// - /// Operation content - /// - public IEnumerator PostAsync(params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch = BranchStub, - contents, - signature = SignatureStub - }, - chain_id = ChainStub, - latency = LatencyStub - }); - - /// - /// Simulate an operation - /// - /// Type of the object to deserialize to - /// Operation content - /// - public IEnumerator PostAsync(params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch = BranchStub, - contents, - signature = SignatureStub - }, - chain_id = ChainStub, - latency = LatencyStub - }); - - /// - /// Simulate an operation - /// - /// Chain id - /// Branch - /// List of operation contents - /// Latency - /// - public IEnumerator PostAsync(string chain_id, string branch, int latency, params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch, - contents, - signature = SignatureStub - }, - chain_id, - latency - }); - - /// - /// Simulate an operation - /// - /// Type of the object to deserialize to - /// Chain id - /// Branch - /// List of operation contents - /// Latency - /// - public IEnumerator PostAsync(string chain_id, string branch, int latency, params OperationContent[] contents) - => PostAsync(new - { - operation = new - { - branch, - contents, - signature = SignatureStub - }, - chain_id, - latency - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/SimulateOperationQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/SimulateOperationQuery.cs.meta deleted file mode 100644 index b6dce1f6..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/SimulateOperationQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 32dbccf5c16ab439fb4c9e2d5f474743 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/TraceCodeQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/TraceCodeQuery.cs deleted file mode 100644 index 2d794ced..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/TraceCodeQuery.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access code trace - /// - public class TraceCodeQuery : RpcMethod - { - internal TraceCodeQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Runs a piece of code in the current context, keeping a trace, and returns the storage, operations, trace and big_map data - /// - /// Script (micheline michelson expression) - /// Storage (micheline michelson expression) - /// Input (micheline michelson expression) - /// Amount - /// Source (optional) - /// Payer (optional) - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object script, object storage, object input, long amount, string source = null, string payer = null, long? gas = null) - => PostAsync(new - { - script, - storage, - input, - amount = amount.ToString(), - source, - payer, - gas = gas?.ToString() - }); - - /// - /// Runs a piece of code in the current context, keeping a trace, and returns the storage, operations, trace and big_map data - /// - /// Type of the object to deserialize to - /// Script (micheline michelson expression) - /// Storage (micheline michelson expression) - /// Input (micheline michelson expression) - /// Amount - /// Source (optional) - /// Payer (optional) - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object script, object storage, object input, long amount, string source = null, string payer = null, long? gas = null) - => PostAsync(new - { - script, - storage, - input, - amount = amount.ToString(), - source, - payer, - gas = gas?.ToString() - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/TraceCodeQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/TraceCodeQuery.cs.meta deleted file mode 100644 index dd8dba7c..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/TraceCodeQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 51f74641b15b342738116eed88a98043 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckCodeQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckCodeQuery.cs deleted file mode 100644 index 96e7e1ff..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckCodeQuery.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access type checking - /// - public class TypeCheckCodeQuery : RpcMethod - { - internal TypeCheckCodeQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Typechecks a piece of code in the current context and returns the type map - /// - /// Program michelson expression - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object program, long? gas = null) - => base.PostAsync(new - { - program, - gas = gas?.ToString() - }); - - /// - /// Typechecks a piece of code in the current context and returns the type map - /// - /// Type of the object to deserialize to - /// Program michelson expression - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object program, long? gas = null) - => base.PostAsync(new - { - program, - gas = gas?.ToString() - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckCodeQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckCodeQuery.cs.meta deleted file mode 100644 index 864b8a26..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckCodeQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1207bc7de01d74588b41249b81443751 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckDataQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckDataQuery.cs deleted file mode 100644 index cee13861..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckDataQuery.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries.Post -{ - /// - /// Rpc query to access type checking - /// - public class TypeCheckDataQuery : RpcMethod - { - internal TypeCheckDataQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Checks that some data expression is well formed and of a given type in the current context and returns the consumed gas - /// - /// Data expression - /// Data expression type - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object data, object type, long? gas = null) - => PostAsync(new - { - data, - type, - gas = gas?.ToString() - }); - - /// - /// Checks that some data expression is well formed and of a given type in the current context and returns the consumed gas - /// - /// Type of the object to deserialize to - /// Data expression - /// Data expression type - /// Gas limit (optional) - /// - public IEnumerator PostAsync(object data, object type, long? gas = null) - => PostAsync(new - { - data, - type, - gas = gas?.ToString() - }); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckDataQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckDataQuery.cs.meta deleted file mode 100644 index 56e4c69c..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/Post/TypeCheckDataQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 86f55a4cebc664fb08ac5ab923c51cc1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/PreapplyQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/PreapplyQuery.cs deleted file mode 100644 index 80e6b46d..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/PreapplyQuery.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// RPC query to get preapplying helpers associated with a block - /// - public class PreapplyQuery : RpcQuery - { - /// - /// Gets the query to the block preapplying - /// - public PreapplyBlockQuery Block => new PreapplyBlockQuery(this, "block"); - - /// - /// Gets the query to the operations preapplying - /// - public PreapplyOperationQuery Operations => new PreapplyOperationQuery(this, "operations"); - - internal PreapplyQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/PreapplyQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/PreapplyQuery.cs.meta deleted file mode 100644 index 5d39b8e5..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/PreapplyQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5c8996ada2c954d0990a18521363b290 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawBigMapQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawBigMapQuery.cs deleted file mode 100644 index d95d8ed0..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawBigMapQuery.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - public class RawBigMapQuery : RpcObject - { - public RpcDictionary Contents - => new RpcDictionary(this, "contents/"); - - internal RawBigMapQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawBigMapQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawBigMapQuery.cs.meta deleted file mode 100644 index ce89655a..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawBigMapQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c63858fa1c063458eb697efcc6df0ded -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawContextQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawContextQuery.cs deleted file mode 100644 index 798efefe..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawContextQuery.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; - -namespace Netezos.Rpc.Queries -{ - public class RawContextQuery : DeepRpcObject - { - public DeepRpcDictionary ActiveDelegates - => new DeepRpcDictionary(this, "active_delegates_with_rolls/"); - - public RpcArray BigMaps - => new RpcArray(this, "big_maps/index/"); - - public DeepRpcDictionary Commitments - => new DeepRpcDictionary(this, "commitments/"); - - public RpcObject GlobalCounter - => new RpcObject(this, "contracts/global_counter/"); - - public DeepRpcDictionary Contracts - => new DeepRpcDictionary(this, "contracts/index/"); - - public DeepRpcDictionary Cycles - => new DeepRpcDictionary(this, "cycle/"); - - public DeepRpcDictionary Delegates - => new DeepRpcDictionary(this, "delegates/"); - - public DeepRpcDictionary> DelegatesWithFrozenBalance - => new DeepRpcDictionary>(this, "delegates_with_frozen_balance/"); - - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject LastBlockPriority - => new RpcObject(this, "last_block_priority/"); - - // TODO: describe this - public DeepRpcObject RampUp => new DeepRpcObject(this, "ramp_up/"); - - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RawRollsQuery Rolls => new RawRollsQuery(this, "rolls/"); - - public RawVotesQuery Votes => new RawVotesQuery(this, "votes/"); - - internal RawContextQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawContextQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawContextQuery.cs.meta deleted file mode 100644 index 0884d9ab..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawContextQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e5c7201f700984cbd808eb07130a2a69 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawContractQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawContractQuery.cs deleted file mode 100644 index b114cad7..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawContractQuery.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access contract data - /// - public class RawContractQuery : DeepRpcObject - { - /// - /// Gets the query to the balance of a contract - /// - public RpcObject Balance => new RpcObject(this, "balance/"); - - /// - /// Gets the query to the value associated with a key in the big map storage of the contract - /// - public RpcObject BigMap => new RpcObject(this, "big_map/"); - - /// - /// Gets the query to contract's code - /// - public RpcObject Code => new RpcObject(this, "code/"); - - /// - /// Gets the query to contract's change - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Change => new RpcObject(this, "change/"); - - /// - /// Gets the query to the counter of a contract, if any - /// - public RpcObject Counter => new RpcObject(this, "counter/"); - - /// - /// Gets the query to the flag, indicating if the contract delegate can be changed - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Delegatable => new RpcObject(this, "delegatable/"); - - /// - /// Gets the query to the delegate of a contract, if any - /// - public RpcObject Delegate => new RpcObject(this, "delegate/"); - - /// - /// - /// - public RpcObject DelegateDesactivation - => new RpcObject(this, "delegate_desactivation/"); - - /// - /// - /// - public RpcObject InactiveDelegate - => new RpcObject(this, "inactive_delegate/"); - - /// - /// Gets the query to all contracts delegated to this contract - /// - public DeepRpcDictionary - Delegated => new DeepRpcDictionary(this, "delegated/"); - - /// - /// Gets the query to the frozen balances - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public DeepRpcDictionary - FrozenBalance => new DeepRpcDictionary(this, "frozen_balance/"); - - /// - /// Gets the query to the frozen deposits - /// - public RpcObject - FrozenDeposits => new RpcObject(this, "frozen_deposits/"); - - /// - /// Gets the query to the manager of a contract - /// - public RpcObject Manager => new RpcObject(this, "manager/"); - - /// - /// Gets the query to the paid bytes - /// - public RpcObject PaidBytes => new RpcObject(this, "paid_bytes/"); - - /// - /// Gets the query to the roll list - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject RollList => new RpcObject(this, "roll_list/"); - - /// - /// Gets the query to the flag, indocating if the contract tokens can be spent by the manager - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject Spendable => new RpcObject(this, "spendable/"); - - /// - /// Gets the query to the data of the contract's storage - /// - public RpcObject Storage => new RpcObject(this, "storage/"); - - /// - /// Gets the query to the used bytes - /// - public RpcObject UsedBytes => new RpcObject(this, "used_bytes/"); - - internal RawContractQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawContractQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawContractQuery.cs.meta deleted file mode 100644 index 803d95e1..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawContractQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 388d8e96449664f878d760da3bacf459 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawCycleQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawCycleQuery.cs deleted file mode 100644 index 5ff90ac4..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawCycleQuery.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - public class RawCycleQuery : DeepRpcObject - { - public DeepRpcDictionary LastRoll - => new DeepRpcDictionary(this, "last_roll/"); - - /// - /// Warning: shouldn't be used to get all the nonces - /// - public DeepRpcDictionary Nonces - => new DeepRpcDictionary(this, "nonces/"); - - public RpcObject RandomSeed => new RpcObject(this, "random_seed/"); - - public RpcObject RollSnapshot => new RpcObject(this, "roll_snapshot/"); - - internal RawCycleQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawCycleQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawCycleQuery.cs.meta deleted file mode 100644 index 1368cf7d..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawCycleQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 85df2ffd7450a45d194e85be66b312d3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawRollQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawRollQuery.cs deleted file mode 100644 index c51b0319..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawRollQuery.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Netezos.Rpc.Queries -{ - public class RawRollQuery : RpcObject - { - public RpcObject Successor => new RpcObject(this, "successor/"); - - internal RawRollQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawRollQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawRollQuery.cs.meta deleted file mode 100644 index 23dbf084..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawRollQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5238640c2ea964aa8af92a96911d80b8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawRollsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawRollsQuery.cs deleted file mode 100644 index 19ad1d37..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawRollsQuery.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Netezos.Rpc.Queries -{ - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public class RawRollsQuery : DeepRpcObject - { - public RpcObject Limbo => new RpcObject(this, "limbo/"); - - public RpcObject Next => new RpcObject(this, "next/"); - - public DeepRpcDictionary Index - => new DeepRpcDictionary(this, "index/"); - - public DeepRpcDictionary OwnerCurrent - => new DeepRpcDictionary(this, "owner/current/"); - - public DeepRpcDictionary>> OwnerSnapshot - => new DeepRpcDictionary>>(this, "owner/snapshot/"); - - - internal RawRollsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawRollsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawRollsQuery.cs.meta deleted file mode 100644 index b9abe2f1..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawRollsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: db54a148af519405b9ffc5ec91595428 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawVotesQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/RawVotesQuery.cs deleted file mode 100644 index 3f5857dc..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawVotesQuery.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -namespace Netezos.Rpc.Queries -{ - public class RawVotesQuery : DeepRpcObject - { - public DeepRpcDictionary Ballots - => new DeepRpcDictionary(this, "ballots/"); - - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject CurrentPeriodKind => new RpcObject(this, "current_period_kind/"); - - public RpcObject CurrentProposal => new RpcObject(this, "current_proposal/"); - - public RpcObject CurrentQuorum => new RpcObject(this, "current_quorum/"); - - public DeepRpcDictionary Listings - => new DeepRpcDictionary(this, "listings/"); - - public RpcObject ListingsSize => new RpcObject(this, "listings_size/"); - - public DeepRpcDictionary> Proposals - => new DeepRpcDictionary>(this, "proposals/"); - - public DeepRpcDictionary ProposalsCount - => new DeepRpcDictionary(this, "proposals_count/"); - - internal RawVotesQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/RawVotesQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/RawVotesQuery.cs.meta deleted file mode 100644 index 1f42f6f7..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/RawVotesQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 81a1cd32adb944c26a421a44c783ce79 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ScriptQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ScriptQuery.cs deleted file mode 100644 index af482bb3..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ScriptQuery.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// Access the code and data of the contract. - /// - public class ScriptQuery : RpcObject - { - /// - /// Access the script of the contract and normalize it using the requested unparsing mode. - /// - public NormalizedQuery Normalized => new NormalizedQuery(this, "normalized/"); - - internal ScriptQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ScriptQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ScriptQuery.cs.meta deleted file mode 100644 index 5c32d8a9..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ScriptQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e7311b33d14b04875a6e026d89981a02 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ScriptsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ScriptsQuery.cs deleted file mode 100644 index fc44537f..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ScriptsQuery.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - public class ScriptsQuery : RpcQuery - { - /// - /// Gets the query to the pack data - /// - public PackDataQuery PackData => new PackDataQuery(this, "pack_data/"); - - /// - /// Gets the query to the code run - /// - public RunCodeQuery RunCode => new RunCodeQuery(this, "run_code/"); - - /// - /// Gets the query to the operation run - /// - public RunOperationQuery RunOperation => new RunOperationQuery(this, "run_operation/"); - - /// - /// Gets the query to the operation simulation - /// - public SimulateOperationQuery SimulateOperation => new SimulateOperationQuery(this, "simulate_operation/"); - - /// - /// Gets the query to the code trace - /// - public TraceCodeQuery TraceCode => new TraceCodeQuery(this, "trace_code/"); - - /// - /// Gets the query to the code typecheck - /// - public TypeCheckCodeQuery TypeCheckCode => new TypeCheckCodeQuery(this, "typecheck_code/"); - - /// - /// Gets the query to the data typecheck - /// - public TypeCheckDataQuery TypeCheckData => new TypeCheckDataQuery(this, "typecheck_data/"); - - internal ScriptsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ScriptsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ScriptsQuery.cs.meta deleted file mode 100644 index 4622f35d..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ScriptsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6cdbf2756d9fa4bb7a89afe8aa55290f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/StorageQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/StorageQuery.cs deleted file mode 100644 index 088ac2bc..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/StorageQuery.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Netezos.Rpc.Queries.Post; - -namespace Netezos.Rpc.Queries -{ - /// - /// Access the data of the contract. - /// - public class StorageQuery : RpcObject - { - /// - /// Access the data of the contract and normalize it using the requested unparsing mode. - /// - public NormalizedQuery Normalized => new NormalizedQuery(this, "normalized/"); - - internal StorageQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Rpc/Queries/StorageQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/StorageQuery.cs.meta deleted file mode 100644 index 9682a6fe..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/StorageQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 594c54e90c79c45b7816f43619a55c31 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ValidatorsQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/ValidatorsQuery.cs deleted file mode 100644 index 1249ab36..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ValidatorsQuery.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System.Collections; -using System.Threading.Tasks; - -namespace Netezos.Rpc.Queries -{ - /// - /// Retrieves the delegates allowed to endorse a block. - /// - public class ValidatorsQuery : RpcObject - { - internal ValidatorsQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - - /// - /// Gives the endorsing slots for delegates that have at least one in the next block. - /// Returns a dynamic json. - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson(Query); - - /// - /// Gives the endorsing slots for the delegate - /// Returns a dynamic json. - /// - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetAsync(string baker) - => Client.GetJson($"{Query}?delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// Returns a dynamic json. - /// - /// Level of the block at which the endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level) - => Client.GetJson($"{Query}?level={level}"); - - /// - /// Executes the query and returns the endorsing rights - /// Returns a dynamic json. - /// - /// Level of the block at which the endorsing rights are to be returned - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level, string baker) - => Client.GetJson($"{Query}?level={level}&delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// - public new IEnumerator GetAsync() - => Client.GetJson(Query); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetAsync(string baker) - => Client.GetJson($"{Query}?delegate={baker}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Level of the block at which the endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level) - => Client.GetJson($"{Query}?level={level}"); - - /// - /// Executes the query and returns the endorsing rights - /// - /// Level of the block at which the endorsing rights are to be returned - /// Delegate whose endorsing rights are to be returned - /// - public IEnumerator GetFromLevelAsync(int level, string baker) - => Client.GetJson($"{Query}?level={level}&delegate={baker}"); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/ValidatorsQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/ValidatorsQuery.cs.meta deleted file mode 100644 index 8ba38c7e..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/ValidatorsQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7a156a1ae98ab479cb8f1ac3e1f92a2a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/Queries/VotesQuery.cs b/Assets/Scripts/Netezos/Rpc/Queries/VotesQuery.cs deleted file mode 100644 index fd1ae7de..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/VotesQuery.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace Netezos.Rpc.Queries -{ - /// - /// Rpc query to access voting data - /// - public class VotesQuery : RpcQuery - { - /// - /// Gets the query to the ballots casted so far during a voting period - /// - public RpcObject BallotList => new RpcObject(this, "ballot_list"); - /// - /// Gets the query to the sum of ballots casted so far during a voting period - /// - public RpcObject Ballots => new RpcObject(this, "ballots"); - /// - /// Gets the query to the current period kind - /// - [Obsolete("This RPC query was removed. Use it on early protocols only.")] - public RpcObject CurrentPeriodKind => new RpcObject(this, "current_period_kind"); - /// - /// Gets the query to the current proposal under evaluation - /// - public RpcObject CurrentProposals => new RpcObject(this, "current_proposal"); - /// - /// Gets the query to the current expected quorum - /// - public RpcObject CurrentQuorum => new RpcObject(this, "current_quorum"); - /// - /// Gets the query to the list of delegates with their voting weight, in number of rolls - /// - public RpcObject Listings => new RpcObject(this, "listings"); - /// - /// Gets the query to the list of proposals with number of supporters - /// - public RpcObject Proposals => new RpcObject(this, "proposals"); - - internal VotesQuery(RpcQuery baseQuery, string append) : base(baseQuery, append) { } - } -} diff --git a/Assets/Scripts/Netezos/Rpc/Queries/VotesQuery.cs.meta b/Assets/Scripts/Netezos/Rpc/Queries/VotesQuery.cs.meta deleted file mode 100644 index cb7b8334..00000000 --- a/Assets/Scripts/Netezos/Rpc/Queries/VotesQuery.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e0d3031741cda4e8c9726ed29724c5ce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Rpc/TezosRpc.cs b/Assets/Scripts/Netezos/Rpc/TezosRpc.cs deleted file mode 100644 index 96aef258..00000000 --- a/Assets/Scripts/Netezos/Rpc/TezosRpc.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections; -using System.Net.Http; -using System.Threading.Tasks; -using Netezos.Rpc.Queries; - -namespace Netezos.Rpc -{ - /// - /// Rpc queries builder - /// - public class TezosRpc : IDisposable - { - /// - /// Gets the query to the blocks - /// - public BlocksQuery Blocks { get; } - - /// - /// Gets the query to the injection - /// - public InjectionQuery Inject { get; } - - string Chain { get; } - RpcClient Client { get; } - - /// - /// Creates the instanse of TezosRpc - /// - /// Base URI of the node - /// Chain to work with. - /// Note: this is not a network (mainnet or testnet), but a chain of the particular network. - /// In 99.99% cases you likely want to use Chain.Main, because Chain.Test is only relevant during the testing phase of the Tezos voting process. - public TezosRpc(string uri, Chain chain = Rpc.Chain.Main) - { - Client = new RpcClient(uri); - Chain = chain.ToString().ToLower(); - - Blocks = new BlocksQuery(Client, $"chains/{Chain}/blocks/"); - Inject = new InjectionQuery(Client, $"injection/"); - } - - /// - /// Creates the instanse of TezosRpc - /// - /// Base URI of the node - /// Timeout in seconds for the requests - /// Chain to work with. - /// Note: this is not a network (mainnet or testnet), but a chain of the network. - /// In 99.99% cases you likely want to use Chain.Main, because Chain.Test is only relevant during the testing phase of the Tezos voting process. - public TezosRpc(string uri, int timeout, Chain chain = Rpc.Chain.Main) - { - Client = new RpcClient(uri, timeout); - Chain = chain.ToString().ToLower(); - - Blocks = new BlocksQuery(Client, $"chains/{Chain}/blocks/"); - Inject = new InjectionQuery(Client, $"injection/"); - } - - /// - /// Creates the instanse of TezosRpc - /// - /// HttpClient instanse that will be used for sending RPC requests. - /// Chain to work with. - /// Note: this is not a network (mainnet or testnet), but a chain of the network. - /// In 99.99% cases you likely want to use Chain.Main, because Chain.Test is only relevant during the testing phase of the Tezos voting process. - public TezosRpc(HttpClient client, Chain chain = Rpc.Chain.Main) - { - Client = new RpcClient(client); - Chain = chain.ToString().ToLower(); - - Blocks = new BlocksQuery(Client, $"chains/{Chain}/blocks/"); - Inject = new InjectionQuery(Client, $"injection/"); - } - - /// - /// Sends request and returns the dynamic json object - /// Returns a dynamic json. - /// - /// Relative path to the RPC method - /// - public IEnumerator GetAsync(string query) => Client.GetJson(query); - - /// - /// Sends request and returns the json object, deserialized to the specified type - /// - /// Type of the object to deserialize to - /// Relative path to the RPC method - /// - public IEnumerator GetAsync(string query) => Client.GetJson(query); - - /// - /// Releases the unmanaged resourses and disposes of the managed resources used by the TezosRpc - /// - public void Dispose() => Client?.Dispose(); - } -} diff --git a/Assets/Scripts/Netezos/Rpc/TezosRpc.cs.meta b/Assets/Scripts/Netezos/Rpc/TezosRpc.cs.meta deleted file mode 100644 index f99b981d..00000000 --- a/Assets/Scripts/Netezos/Rpc/TezosRpc.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bb15744b18fa44bf8ad99780037fb10b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils.meta b/Assets/Scripts/Netezos/Utils.meta deleted file mode 100644 index 7940f59d..00000000 --- a/Assets/Scripts/Netezos/Utils.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f61bc740bdfbc48fc976b26471e3ad5c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Bytes.cs b/Assets/Scripts/Netezos/Utils/Bytes.cs deleted file mode 100644 index 5aa99f3e..00000000 --- a/Assets/Scripts/Netezos/Utils/Bytes.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Linq; - -namespace Netezos.Utils -{ - static class Bytes - { - public static byte[] Concat(params byte[][] arrays) - { - var res = new byte[arrays.Sum(x => x.Length)]; - - for (int s = 0, i = 0; i < arrays.Length; s += arrays[i].Length, i++) - Buffer.BlockCopy(arrays[i], 0, res, s, arrays[i].Length); - - return res; - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Bytes.cs.meta b/Assets/Scripts/Netezos/Utils/Bytes.cs.meta deleted file mode 100644 index 7785adc3..00000000 --- a/Assets/Scripts/Netezos/Utils/Bytes.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1fe98ce9c88504ba5b02e8d6a2a6dfbb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Crypto.meta b/Assets/Scripts/Netezos/Utils/Crypto.meta deleted file mode 100644 index 218e652f..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0dad23f0f2b8d4d7f835e6778d013a6e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Crypto/Blake2b.cs b/Assets/Scripts/Netezos/Utils/Crypto/Blake2b.cs deleted file mode 100644 index 075e04bf..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto/Blake2b.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Org.BouncyCastle.Crypto.Digests; - -namespace Netezos.Utils -{ - public static class Blake2b - { - public static byte[] GetDigest(byte[] msg) => GetDigest(msg, 256); - - public static byte[] GetDigest(byte[] msg, int size) - { - var result = new byte[size/8]; - var digest = new Blake2bDigest(size); - - digest.BlockUpdate(msg, 0, msg.Length); - digest.DoFinal(result, 0); - - return result; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Utils/Crypto/Blake2b.cs.meta b/Assets/Scripts/Netezos/Utils/Crypto/Blake2b.cs.meta deleted file mode 100644 index d22ddb01..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto/Blake2b.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 73f9bb0bdae22484fbc89a45072cb1cb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Crypto/Pbkdf2.cs b/Assets/Scripts/Netezos/Utils/Crypto/Pbkdf2.cs deleted file mode 100644 index cf97631f..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto/Pbkdf2.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.IO; -using System.Security.Cryptography; - -namespace Netezos.Utils -{ - public class Pbkdf2 : Stream - { - #region PBKDF2 - byte[] _saltBuffer, _digest, _digestT1; - - KeyedHashAlgorithm _hmacAlgorithm; - - int _iterations; - - public Pbkdf2(KeyedHashAlgorithm hmacAlgorithm, byte[] salt, int iterations) - { - int hmacLength = hmacAlgorithm.HashSize / 8; - _saltBuffer = new byte[salt.Length + 4]; - Array.Copy(salt, _saltBuffer, salt.Length); - _iterations = iterations; - _hmacAlgorithm = hmacAlgorithm; - _digest = new byte[hmacLength]; - _digestT1 = new byte[hmacLength]; - } - - public byte[] Read(int count) - { - byte[] buffer = new byte[count]; - int num = Read(buffer, 0, count); - if (num < count) - throw new ArgumentException("Can only return {0} bytes."); - return buffer; - } - - public static byte[] ComputeDerivedKey(KeyedHashAlgorithm hmacAlgorithm, byte[] salt, int iterations, int derivedKeyLength) - { - using (Pbkdf2 kdf = new Pbkdf2(hmacAlgorithm, salt, iterations)) - { - return kdf.Read(derivedKeyLength); - } - } - - public override void Close() - { - DisposeHmac(); - } - - private void DisposeHmac() - { - _hmacAlgorithm.Clear(); - } - - void BEBytesFromUInt32(uint value, byte[] bytes, int offset) - { - bytes[offset + 0] = (byte)(value >> 24); - bytes[offset + 1] = (byte)(value >> 16); - bytes[offset + 2] = (byte)(value >> 8); - bytes[offset + 3] = (byte)(value); - } - - void ComputeBlock(uint pos) - { - BEBytesFromUInt32(pos, _saltBuffer, _saltBuffer.Length - 4); - ComputeHmac(_saltBuffer, _digestT1); - Array.Copy(_digestT1, _digest, _digestT1.Length); - - for (int i = 1; i < _iterations; i++) - { - ComputeHmac(_digestT1, _digestT1); - for (int j = 0; j < _digest.Length; j++) - { - _digest[j] ^= _digestT1[j]; - } - } - } - - void ComputeHmac(byte[] input, byte[] output) - { - _hmacAlgorithm.Initialize(); - _hmacAlgorithm.TransformBlock(input, 0, input.Length, input, 0); - _hmacAlgorithm.TransformFinalBlock(new byte[0], 0, 0); - Array.Copy(_hmacAlgorithm.Hash, output, output.Length); - } - #endregion - - #region Stream - long _blockStart, _blockEnd, _pos; - - public override void Flush() { } - - public override int Read(byte[] buffer, int offset, int count) - { - int bytes = 0; - - while (count > 0) - { - if (Position < _blockStart || Position >= _blockEnd) - { - if (Position >= Length) - { - break; - } - - long pos = Position / _digest.Length; - ComputeBlock((uint)(pos + 1)); - _blockStart = pos * _digest.Length; - _blockEnd = _blockStart + _digest.Length; - } - - int bytesSoFar = (int)(Position - _blockStart); - int bytesThisTime = (int)Math.Min(_digest.Length - bytesSoFar, count); - Array.Copy(_digest, bytesSoFar, buffer, bytes, bytesThisTime); - count -= bytesThisTime; - bytes += bytesThisTime; - Position += bytesThisTime; - } - - return bytes; - } - - public override long Seek(long offset, SeekOrigin origin) - { - long pos; - - switch (origin) - { - case SeekOrigin.Begin: - pos = offset; - break; - case SeekOrigin.Current: - pos = Position + offset; - break; - case SeekOrigin.End: - pos = Length + offset; - break; - default: - throw new ArgumentException(); - } - - Position = pos; - return pos; - } - - public override void SetLength(long value) => throw new NotImplementedException(); - - public override void Write(byte[] buffer, int offset, int count) => throw new NotImplementedException(); - - public override bool CanRead => true; - - public override bool CanSeek => true; - - public override bool CanWrite => false; - - public override long Length => _digest.Length * uint.MaxValue; - - public override long Position { get => _pos; set => _pos = value; } - #endregion - } -} diff --git a/Assets/Scripts/Netezos/Utils/Crypto/Pbkdf2.cs.meta b/Assets/Scripts/Netezos/Utils/Crypto/Pbkdf2.cs.meta deleted file mode 100644 index d74da87c..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto/Pbkdf2.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 325894cd7aeb5453db7335762df05685 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Crypto/RNG.cs b/Assets/Scripts/Netezos/Utils/Crypto/RNG.cs deleted file mode 100644 index 37de0570..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto/RNG.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Security.Cryptography; - -namespace Netezos.Utils -{ - public static class RNG - { - static readonly RandomNumberGenerator Rng = RandomNumberGenerator.Create(); - - public static void WriteBytes(byte[] dest) - { - Rng.GetBytes(dest); - } - - public static byte[] GetBytes(int length) - { - var buf = new byte[length]; - Rng.GetBytes(buf); - return buf; - } - - public static byte[] GetNonZeroBytes(int length) - { - var buf = new byte[length]; - Rng.GetNonZeroBytes(buf); - return buf; - } - - public static int GetInt32() - { - return BitConverter.ToInt32(GetBytes(4), 0); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Utils/Crypto/RNG.cs.meta b/Assets/Scripts/Netezos/Utils/Crypto/RNG.cs.meta deleted file mode 100644 index fe5f557d..00000000 --- a/Assets/Scripts/Netezos/Utils/Crypto/RNG.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 10235f5f9307a4207b7515b22e4e748e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions.meta b/Assets/Scripts/Netezos/Utils/Extensions.meta deleted file mode 100644 index 5b0eefcc..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 04085910e490e4812801e5159401cdea -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions/BinaryReaderExtension.cs b/Assets/Scripts/Netezos/Utils/Extensions/BinaryReaderExtension.cs deleted file mode 100644 index 4ed6f4c3..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/BinaryReaderExtension.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.IO; - -namespace Netezos -{ - static class BinaryReaderExtension - { - public static int Read7BitInt(this BinaryReader reader) - { - var res = 0; - var bits = 0; - byte b = 0; - - while (bits < 28) - { - b = reader.ReadByte(); - res |= (b & 0x7F) << bits; - bits += 7; - - if (b < 0x80) return res; - } - - b = reader.ReadByte(); - if (b > 0x0F) throw new FormatException("Int32 overflow"); - - res |= b << 28; - return res; - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Extensions/BinaryReaderExtension.cs.meta b/Assets/Scripts/Netezos/Utils/Extensions/BinaryReaderExtension.cs.meta deleted file mode 100644 index 52d1bffa..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/BinaryReaderExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d66a6ce25355c4266a32aa4e914173ee -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions/BinaryWriterExtension.cs b/Assets/Scripts/Netezos/Utils/Extensions/BinaryWriterExtension.cs deleted file mode 100644 index fd0440e1..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/BinaryWriterExtension.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.IO; - -namespace Netezos -{ - static class BinaryWriterExtension - { - public static void Write7BitInt(this BinaryWriter writer, int value) - { - while (value > 0x7F) - { - writer.Write((byte)(value | ~0x7F)); - value >>= 7; - } - - writer.Write((byte)value); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Extensions/BinaryWriterExtension.cs.meta b/Assets/Scripts/Netezos/Utils/Extensions/BinaryWriterExtension.cs.meta deleted file mode 100644 index e6bf09f7..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/BinaryWriterExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 679277833e2e147459714fba7be1a638 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions/BytesExtension.cs b/Assets/Scripts/Netezos/Utils/Extensions/BytesExtension.cs deleted file mode 100644 index eac764df..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/BytesExtension.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; - -namespace Netezos -{ - static class BytesExtension - { - public static byte[] Align(this byte[] src, int length) - { - if (src.Length < length) - { - var res = new byte[length]; - Buffer.BlockCopy(src, 0, res, length - src.Length, src.Length); - return res; - } - - return src; - } - - public static byte[] Concat(this byte[] src, byte[] data) - { - byte[] res = new byte[src.Length + data.Length]; - Buffer.BlockCopy(src, 0, res, 0, src.Length); - Buffer.BlockCopy(data, 0, res, src.Length, data.Length); - return res; - } - - public static byte[] Concat(this byte[] src, byte[] data, int count) - { - byte[] res = new byte[src.Length + count]; - Buffer.BlockCopy(src, 0, res, 0, src.Length); - Buffer.BlockCopy(data, 0, res, src.Length, count); - return res; - } - - public static void CopyTo(this byte[] src, byte[] dst, int dstOffset) - { - Buffer.BlockCopy(src, 0, dst, dstOffset, src.Length); - } - - public static byte[] Copy(this byte[] src) - { - var res = new byte[src.Length]; - Buffer.BlockCopy(src, 0, res, 0, src.Length); - return res; - } - - public static byte[] Reverse(this byte[] data) - { - var res = new byte[data.Length]; - - for (int i = 0; i < data.Length; i++) - res[i] = data[data.Length - 1 - i]; - - return res; - } - - public static byte[] GetBytes(this byte[] src, int start, int length) - { - var res = new byte[length]; - Buffer.BlockCopy(src, start, res, 0, length); - return res; - } - - public static bool IsEqual(this byte[] src, byte[] data) - { - if (src.Length != data.Length) - return false; - - for (int i = 0; i < src.Length; i++) - if (src[i] != data[i]) - return false; - - return true; - } - - public static void Flush(this byte[] data) - { - for (int i = 0; i < data.Length; i++) - data[i] = 0; - } - - public static bool StartWith(this byte[] src, byte[] data) - { - if (src.Length < data.Length) - return false; - - for (int i = 0; i < data.Length; i++) - if (src[i] != data[i]) - return false; - - return true; - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Extensions/BytesExtension.cs.meta b/Assets/Scripts/Netezos/Utils/Extensions/BytesExtension.cs.meta deleted file mode 100644 index c93ddc66..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/BytesExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3fbedb25b47564b6283258adadf71b3d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions/DateTimeExtension.cs b/Assets/Scripts/Netezos/Utils/Extensions/DateTimeExtension.cs deleted file mode 100644 index 3860dfd4..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/DateTimeExtension.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace Netezos -{ - static class DateTimeExtension - { - static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0); - - public static int ToUnixTime(this DateTime datetime) - { - return (int)(datetime - Epoch).TotalSeconds; - } - - public static DateTime FromUnixTime(long seconds) - { - return Epoch.AddSeconds(seconds); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Extensions/DateTimeExtension.cs.meta b/Assets/Scripts/Netezos/Utils/Extensions/DateTimeExtension.cs.meta deleted file mode 100644 index 6d8053cc..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/DateTimeExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2418c2b5067e043beb160710e212163b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions/SecureStringExtension.cs b/Assets/Scripts/Netezos/Utils/Extensions/SecureStringExtension.cs deleted file mode 100644 index 8bedb79c..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/SecureStringExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace Netezos -{ - static class SecureStringExtension - { - public static string Unsecure(this SecureString value) - { - var valuePtr = IntPtr.Zero; - try - { - valuePtr = Marshal.SecureStringToGlobalAllocUnicode(value); - return Marshal.PtrToStringUni(valuePtr); - } - finally - { - Marshal.ZeroFreeGlobalAllocUnicode(valuePtr); - } - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Extensions/SecureStringExtension.cs.meta b/Assets/Scripts/Netezos/Utils/Extensions/SecureStringExtension.cs.meta deleted file mode 100644 index 29863b2f..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/SecureStringExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 761fb57aa995249798bd46b655a7a895 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Extensions/StringExtension.cs b/Assets/Scripts/Netezos/Utils/Extensions/StringExtension.cs deleted file mode 100644 index bd8b085c..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/StringExtension.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Security; - -namespace Netezos -{ - static class StringExtension - { - static readonly char[] AlphaNumeric = new char[123] - { - '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_', - '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_', - '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_', - '0','1','2','3','4','5','6','7','8','9','_','_','_','_','_','_', - '_','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - 'P','Q','R','S','T','U','V','W','X','Y','Z','_','_','_','_','_', - '_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', - 'p','q','r','s','t','u','v','w','x','y','z' - }; - - public static string ToAlphaNumeric(this string str) - { - var buf = new char[str.Length]; - var changed = false; - - for (int i = 0; i < buf.Length; i++) - { - buf[i] = str[i] <= 'z' ? AlphaNumeric[str[i]] : '_'; - if (buf[i] != str[i]) changed = true; - } - - return changed ? new string(buf) : str; - } - - public static SecureString Secure(this string plainString) - { - var secureString = new SecureString(); - - foreach (var c in plainString ?? throw new NullReferenceException()) - secureString.AppendChar(c); - - return secureString; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Utils/Extensions/StringExtension.cs.meta b/Assets/Scripts/Netezos/Utils/Extensions/StringExtension.cs.meta deleted file mode 100644 index abace45c..00000000 --- a/Assets/Scripts/Netezos/Utils/Extensions/StringExtension.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dd8aedebd9d3d42149afaff5487fbcbc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json.meta b/Assets/Scripts/Netezos/Utils/Json.meta deleted file mode 100644 index 1e4e1c61..00000000 --- a/Assets/Scripts/Netezos/Utils/Json.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8ad363e4ef4d74d87803a296c29f1b44 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/BigIntegerNullableStringConverter.cs b/Assets/Scripts/Netezos/Utils/Json/BigIntegerNullableStringConverter.cs deleted file mode 100644 index 41024b6b..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/BigIntegerNullableStringConverter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Numerics; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - class BigIntegerNullableStringConverter : JsonConverter - { - public override BigInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.TokenType == JsonTokenType.String - ? BigInteger.Parse(reader.GetString()) - : reader.TokenType == JsonTokenType.Number - ? reader.GetInt64() - : null; - } - - public override void Write(Utf8JsonWriter writer, BigInteger? value, JsonSerializerOptions options) - { - if (value != null) - writer.WriteStringValue(value.ToString()); - else - writer.WriteNullValue(); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/BigIntegerNullableStringConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/BigIntegerNullableStringConverter.cs.meta deleted file mode 100644 index c1a79671..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/BigIntegerNullableStringConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 001d23eb3dba644678acdaa3f6eac6c1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/HexConverter.cs b/Assets/Scripts/Netezos/Utils/Json/HexConverter.cs deleted file mode 100644 index 2a30871a..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/HexConverter.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Encoding -{ - class HexConverter : JsonConverter - { - public override byte[] Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return Hex.Parse(reader.GetString()); - } - - public override void Write(Utf8JsonWriter writer, byte[] value, JsonSerializerOptions options) - { - writer.WriteStringValue(Hex.Convert(value)); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/HexConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/HexConverter.cs.meta deleted file mode 100644 index 3a8f1451..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/HexConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1dcc561f689a44441a91c327f100ce6d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/Int32StringConverter.cs b/Assets/Scripts/Netezos/Utils/Json/Int32StringConverter.cs deleted file mode 100644 index 69dbb3a6..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/Int32StringConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - class Int32StringConverter : JsonConverter - { - public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.TokenType == JsonTokenType.String - ? int.Parse(reader.GetString()) - : reader.GetInt32(); - } - - public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options) - { - writer.WriteStringValue(value.ToString()); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/Int32StringConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/Int32StringConverter.cs.meta deleted file mode 100644 index 32e1b56b..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/Int32StringConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cbd917457097749f088b5d6e6fd56076 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/Int64NullableStringConverter.cs b/Assets/Scripts/Netezos/Utils/Json/Int64NullableStringConverter.cs deleted file mode 100644 index cfc40977..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/Int64NullableStringConverter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - class Int64NullableStringConverter : JsonConverter - { - public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.TokenType == JsonTokenType.String - ? long.Parse(reader.GetString()) - : reader.TokenType == JsonTokenType.Number - ? reader.GetInt64() - : null; - } - - public override void Write(Utf8JsonWriter writer, long? value, JsonSerializerOptions options) - { - if (value != null) - writer.WriteStringValue(value.ToString()); - else - writer.WriteNullValue(); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/Int64NullableStringConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/Int64NullableStringConverter.cs.meta deleted file mode 100644 index 01fa352c..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/Int64NullableStringConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a7551d2193aa64282b386080ee2c4534 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/Int64StringConverter.cs b/Assets/Scripts/Netezos/Utils/Json/Int64StringConverter.cs deleted file mode 100644 index dd5c4637..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/Int64StringConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - class Int64StringConverter : JsonConverter - { - public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.TokenType == JsonTokenType.String - ? long.Parse(reader.GetString()) - : reader.GetInt64(); - } - - public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options) - { - writer.WriteStringValue(value.ToString()); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/Int64StringConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/Int64StringConverter.cs.meta deleted file mode 100644 index 96a1f963..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/Int64StringConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 28a650a195bad4fafb286a969b1c2a60 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/JsonContent.cs b/Assets/Scripts/Netezos/Utils/Json/JsonContent.cs deleted file mode 100644 index 7f710e4d..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/JsonContent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Net.Http; -using System.Net.Http.Headers; - -namespace Netezos.Rpc -{ - class JsonContent : StringContent - { - public JsonContent(string content) : base(content) - { - Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/Utils/Json/JsonContent.cs.meta b/Assets/Scripts/Netezos/Utils/Json/JsonContent.cs.meta deleted file mode 100644 index b83f8927..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/JsonContent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2250a5ea71c6f4608a2b0af8b78d610d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/ManagerOperationContentConverter.cs b/Assets/Scripts/Netezos/Utils/Json/ManagerOperationContentConverter.cs deleted file mode 100644 index b44f3b31..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/ManagerOperationContentConverter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - class ManagerOperationContentConverter : JsonConverter - { - public override ManagerOperationContent Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var sideReader = reader; - - sideReader.Read(); - while (!sideReader.ValueTextEquals("kind")) - { - sideReader.Skip(); - sideReader.Read(); - } - - sideReader.Read(); - return sideReader.GetString() switch - { - "delegation" => JsonSerializer.Deserialize(ref reader, options), - "origination" => JsonSerializer.Deserialize(ref reader, options), - "transaction" => JsonSerializer.Deserialize(ref reader, options), - "reveal" => JsonSerializer.Deserialize(ref reader, options), - "register_global_constant" => JsonSerializer.Deserialize(ref reader, options), - "set_deposits_limit" => JsonSerializer.Deserialize(ref reader, options), - _ => throw new JsonException("Invalid operation kind"), - }; - } - - public override void Write(Utf8JsonWriter writer, ManagerOperationContent value, JsonSerializerOptions options) - { - JsonSerializer.Serialize(writer, value, value.GetType(), options); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/ManagerOperationContentConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/ManagerOperationContentConverter.cs.meta deleted file mode 100644 index c1749219..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/ManagerOperationContentConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 864bccfc516fa485b8a13ec8b2c6163d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/OperationContentConverter.cs b/Assets/Scripts/Netezos/Utils/Json/OperationContentConverter.cs deleted file mode 100644 index eb24509c..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/OperationContentConverter.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Netezos.Forging.Models -{ - class OperationContentConverter : JsonConverter - { - public override OperationContent Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var sideReader = reader; - - sideReader.Read(); - while (!sideReader.ValueTextEquals("kind")) - { - sideReader.Skip(); - sideReader.Read(); - } - - sideReader.Read(); - return sideReader.GetString() switch - { - "endorsement" => JsonSerializer.Deserialize(ref reader, options), - "preendorsement" => JsonSerializer.Deserialize(ref reader, options), - "ballot" => JsonSerializer.Deserialize(ref reader, options), - "proposals" => JsonSerializer.Deserialize(ref reader, options), - "activate_account" => JsonSerializer.Deserialize(ref reader, options), - "double_baking_evidence" => JsonSerializer.Deserialize(ref reader, options), - "double_endorsement_evidence" => JsonSerializer.Deserialize(ref reader, options), - "double_preendorsement_evidence" => JsonSerializer.Deserialize(ref reader, options), - "seed_nonce_revelation" => JsonSerializer.Deserialize(ref reader, options), - "delegation" => JsonSerializer.Deserialize(ref reader, options), - "origination" => JsonSerializer.Deserialize(ref reader, options), - "transaction" => JsonSerializer.Deserialize(ref reader, options), - "reveal" => JsonSerializer.Deserialize(ref reader, options), - "register_global_constant" => JsonSerializer.Deserialize(ref reader, options), - "set_deposits_limit" => JsonSerializer.Deserialize(ref reader, options), - "failing_noop" => JsonSerializer.Deserialize(ref reader, options), - _ => throw new JsonException("Invalid operation kind"), - }; - } - - public override void Write(Utf8JsonWriter writer, OperationContent value, JsonSerializerOptions options) - { - JsonSerializer.Serialize(writer, value, value.GetType(), options); - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Json/OperationContentConverter.cs.meta b/Assets/Scripts/Netezos/Utils/Json/OperationContentConverter.cs.meta deleted file mode 100644 index 06f086f5..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/OperationContentConverter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a0eaea53470b4c60949bee1ff6a5627 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Json/SnakeCaseNamingPolicy.cs.meta b/Assets/Scripts/Netezos/Utils/Json/SnakeCaseNamingPolicy.cs.meta deleted file mode 100644 index 2057f4f1..00000000 --- a/Assets/Scripts/Netezos/Utils/Json/SnakeCaseNamingPolicy.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a889de4a8549747c49bff89219dfeca0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Lengths.cs b/Assets/Scripts/Netezos/Utils/Lengths.cs deleted file mode 100644 index d740cd5e..00000000 --- a/Assets/Scripts/Netezos/Utils/Lengths.cs +++ /dev/null @@ -1,95 +0,0 @@ -namespace Netezos -{ - static class Lengths - { - /// - /// Block hash - /// - public static class B - { - public const int Encdoed = 51; - public const int Decoded = 32; - } - - /// - /// Operation list list hash - /// - public static class LLo - { - public const int Encdoed = 53; - public const int Decoded = 32; - } - - /// - /// Protocol hash - /// - public static class P - { - public const int Encdoed = 51; - public const int Decoded = 32; - } - - /// - /// Context hash - /// - public static class Co - { - public const int Encdoed = 52; - public const int Decoded = 32; - } - - /// - /// ed25519 public key hash - /// - public static class tz1 - { - public const int Encdoed = 36; - public const int Decoded = 20; - } - - /// - /// Originated address - /// - public static class KT1 - { - public const int Encdoed = 36; - public const int Decoded = 20; - } - - /// - /// Originated TX Rollup - /// - public static class txr1 - { - public const int Encdoed = 37; - public const int Decoded = 20; - } - - /// - /// generic signature - /// - public static class sig - { - public const int Encdoed = 96; - public const int Decoded = 64; - } - - /// - /// nce - /// - public static class nce - { - public const int Encdoed = 53; - public const int Decoded = 32; - } - - /// - /// vh - /// - public static class vh - { - public const int Encdoed = 52; - public const int Decoded = 32; - } - } -} diff --git a/Assets/Scripts/Netezos/Utils/Lengths.cs.meta b/Assets/Scripts/Netezos/Utils/Lengths.cs.meta deleted file mode 100644 index 1574d8d0..00000000 --- a/Assets/Scripts/Netezos/Utils/Lengths.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f6d16b81671f04231b2ea216ea99ffc6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/Utils/Prefix.cs b/Assets/Scripts/Netezos/Utils/Prefix.cs deleted file mode 100644 index 1310497c..00000000 --- a/Assets/Scripts/Netezos/Utils/Prefix.cs +++ /dev/null @@ -1,135 +0,0 @@ -namespace Netezos -{ - static class Prefix - { - /// - /// Block hash prefix - /// - public static readonly byte[] B = new byte[] { 1, 52 }; - - /// - /// Operation hash prefix - /// - public static readonly byte[] o = new byte[] { 5, 116 }; - - /// - /// Operation list hash prefix - /// - public static readonly byte[] Lo = new byte[] { 133, 233 }; - - /// - /// Operation list list hash prefix - /// - public static readonly byte[] LLo = new byte[] { 29, 159, 109 }; - - /// - /// Protocol hash prefix - /// - public static readonly byte[] P = new byte[] { 2, 170 }; - - /// - /// Context hash prefix - /// - public static readonly byte[] Co = new byte[] { 79, 199 }; - - /// - /// Address prefix for Ed25519 - /// - public static readonly byte[] tz1 = new byte[] { 6, 161, 159 }; - - /// - /// Address prefix for Secp256k1 - /// - public static readonly byte[] tz2 = new byte[] { 6, 161, 161 }; - - /// - /// Address prefix for Nistp256 - /// - public static readonly byte[] tz3 = new byte[] { 6, 161, 164 }; - - /// - /// Address prefix for TX Rollup L2 address - /// - public static readonly byte[] tz4 = new byte[] { 6, 161, 166 }; - - /// - /// Address prefix for originated contract - /// - public static readonly byte[] KT1 = new byte[] { 2, 90, 121 }; - - /// - /// Address prefix for originated tx rollup - /// - public static readonly byte[] txr1 = new byte[] { 1, 128, 120, 31 }; - - /// - /// Public key prefix for Ed25519 (tz1) - /// - public static readonly byte[] edpk = new byte[] { 13, 15, 37, 217 }; - - /// - /// Public key prefix for Secp256k1 (tz2) - /// - public static readonly byte[] sppk = new byte[] { 3, 254, 226, 86 }; - - /// - /// Public key prefix for Nistp256 (tz3) - /// - public static readonly byte[] p2pk = new byte[] { 3, 178, 139, 127 }; - - /// - /// Private key prefix for Ed25519 (tz1) - /// - public static readonly byte[] edsk = { 13, 15, 58, 7 }; - - /// - /// Private key prefix for Secp256k1 (tz2) - /// - public static readonly byte[] spsk = { 17, 162, 224, 201 }; - - /// - /// Private key prefix for Nistp256 (tz3) - /// - public static readonly byte[] p2sk = { 16, 81, 238, 189 }; - - /// - /// Signature prefix for Ed25519 (tz1) - /// - public static readonly byte[] edsig = { 9, 245, 205, 134, 18 }; - - /// - /// Signature prefix for Secp256k1 (tz2) - /// - public static readonly byte[] spsig = { 13, 115, 101, 19, 63 }; - - /// - /// Signature prefix for Nistp256 (tz3) - /// - public static readonly byte[] p2sig = { 54, 240, 44, 52 }; - - /// - /// Signature prefix - /// - public static readonly byte[] sig = new byte[] { 4, 130, 043 }; - - /// - /// Chain id prefix - /// - public static readonly byte[] Net = new byte[] { 87, 82, 0 }; - - /// - /// Seed nonce hash prefix - /// - public static readonly byte[] nce = new byte[] { 69, 220, 169 }; - - /// - /// Script expression - /// - public static readonly byte[] expr = new byte[] { 13, 44, 64, 27 }; - - /// - /// Consensus value hash (e.g. block payload hash) - /// - public static readonly byte[] vh = new byte[] { 1, 106, 242 }; - } -} diff --git a/Assets/Scripts/Netezos/Utils/Prefix.cs.meta b/Assets/Scripts/Netezos/Utils/Prefix.cs.meta deleted file mode 100644 index aa34e61a..00000000 --- a/Assets/Scripts/Netezos/Utils/Prefix.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b70f137be98184b4e8fa48f96ab32a32 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/bin.meta b/Assets/Scripts/Netezos/bin.meta deleted file mode 100644 index 98a3a7bc..00000000 --- a/Assets/Scripts/Netezos/bin.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9fe2b853b78c347388c6c6d2b6a2b748 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/bin/Debug.meta b/Assets/Scripts/Netezos/bin/Debug.meta deleted file mode 100644 index 1487ca1c..00000000 --- a/Assets/Scripts/Netezos/bin/Debug.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ad69074b3521a4cb6b756bbe43d4b5ef -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/bin/Debug/netstandard2.0.meta b/Assets/Scripts/Netezos/bin/Debug/netstandard2.0.meta deleted file mode 100644 index 3b5a1913..00000000 --- a/Assets/Scripts/Netezos/bin/Debug/netstandard2.0.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 13acac367e78349e5a3bf76e7910d33f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj.meta b/Assets/Scripts/Netezos/obj.meta deleted file mode 100644 index 56e204b2..00000000 --- a/Assets/Scripts/Netezos/obj.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 43508e4621e8940829c340ae1268d80b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/Debug.meta b/Assets/Scripts/Netezos/obj/Debug.meta deleted file mode 100644 index e76146fa..00000000 --- a/Assets/Scripts/Netezos/obj/Debug.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 116104171f5ff4b89ab749ec089937ed -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0.meta b/Assets/Scripts/Netezos/obj/Debug/netstandard2.0.meta deleted file mode 100644 index 43097092..00000000 --- a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 17066096e8010497db594a525856af9e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs b/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs deleted file mode 100644 index 4c9a2c18..00000000 --- a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] diff --git a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.AssemblyInfo.cs b/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.AssemblyInfo.cs deleted file mode 100644 index 3247e715..00000000 --- a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("Groxan")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Baking Bad 2019-2022")] -[assembly: System.Reflection.AssemblyDescriptionAttribute(".NET SDK for Tezos blockchain (.NET Stansard 2.0)")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("2.5.2.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.5.2")] -[assembly: System.Reflection.AssemblyProductAttribute("Netezos")] -[assembly: System.Reflection.AssemblyTitleAttribute("Netezos")] -[assembly: System.Reflection.AssemblyVersionAttribute("2.5.2.0")] -[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/baking-bad/netezos")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.AssemblyInfo.cs.meta b/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.AssemblyInfo.cs.meta deleted file mode 100644 index 74c3c229..00000000 --- a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.AssemblyInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fdd82b40e2b4c44839799a322e5bba6c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.GeneratedMSBuildEditorConfig.editorconfig b/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 00ba42d4..00000000 --- a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -is_global = true -build_property.RootNamespace = Netezos -build_property.ProjectDir = /Users/ambert01/Downloads/netezos-master/Netezos/ diff --git a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.GeneratedMSBuildEditorConfig.editorconfig.meta b/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.GeneratedMSBuildEditorConfig.editorconfig.meta deleted file mode 100644 index e3073e2c..00000000 --- a/Assets/Scripts/Netezos/obj/Debug/netstandard2.0/Netezos.GeneratedMSBuildEditorConfig.editorconfig.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c8be7e7b5bef344879fe05746149a7fb -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.dgspec.json b/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.dgspec.json deleted file mode 100644 index c8658365..00000000 --- a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.dgspec.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "format": 1, - "restore": { - "/Users/ambert01/Downloads/netezos-master/Netezos/Netezos.csproj": {} - }, - "projects": { - "/Users/ambert01/Downloads/netezos-master/Netezos/Netezos.csproj": { - "version": "2.5.2", - "restore": { - "projectUniqueName": "/Users/ambert01/Downloads/netezos-master/Netezos/Netezos.csproj", - "projectName": "Netezos", - "projectPath": "/Users/ambert01/Downloads/netezos-master/Netezos/Netezos.csproj", - "packagesPath": "/Users/ambert01/.nuget/packages/", - "outputPath": "/Users/ambert01/Downloads/netezos-master/Netezos/obj/", - "projectStyle": "PackageReference", - "configFilePaths": [ - "/Users/ambert01/.nuget/NuGet/NuGet.Config" - ], - "originalTargetFrameworks": [ - "netstandard2.0" - ], - "sources": { - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "dependencies": { - "Dynamic.Json": { - "target": "Package", - "version": "[1.3.0, )" - }, - "NETStandard.Library": { - "suppressParent": "All", - "target": "Package", - "version": "[2.0.3, )", - "autoReferenced": true - }, - "Portable.BouncyCastle": { - "target": "Package", - "version": "[1.9.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/6.0.301/RuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.props b/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.props deleted file mode 100644 index 67a7634c..00000000 --- a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - /Users/ambert01/.nuget/packages/ - /Users/ambert01/.nuget/packages/ - PackageReference - 6.0.0 - - - - - \ No newline at end of file diff --git a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.props.meta b/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.props.meta deleted file mode 100644 index e5645556..00000000 --- a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.props.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 910bc927ee8914abc87073c64ccd48d6 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.targets b/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.targets deleted file mode 100644 index 8284cdf4..00000000 --- a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.targets.meta b/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.targets.meta deleted file mode 100644 index 19321eaa..00000000 --- a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.g.targets.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 5da8c75e298f14d18b41e46a2cd86442 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Netezos/obj/project.assets.json b/Assets/Scripts/Netezos/obj/project.assets.json deleted file mode 100644 index 2c9cdd9a..00000000 --- a/Assets/Scripts/Netezos/obj/project.assets.json +++ /dev/null @@ -1,633 +0,0 @@ -{ - "version": 3, - "targets": { - ".NETStandard,Version=v2.0": { - "Dynamic.Json/1.3.0": { - "type": "package", - "dependencies": { - "System.Text.Json": "5.0.1" - }, - "compile": { - "lib/netstandard2.0/Dynamic.Json.dll": {} - }, - "runtime": { - "lib/netstandard2.0/Dynamic.Json.dll": {} - } - }, - "Microsoft.Bcl.AsyncInterfaces/5.0.0": { - "type": "package", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - }, - "compile": { - "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll": {} - }, - "runtime": { - "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll": {} - } - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "NETStandard.Library/2.0.3": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - }, - "build": { - "build/netstandard2.0/NETStandard.Library.targets": {} - } - }, - "Portable.BouncyCastle/1.9.0": { - "type": "package", - "compile": { - "lib/netstandard2.0/BouncyCastle.Crypto.dll": {} - }, - "runtime": { - "lib/netstandard2.0/BouncyCastle.Crypto.dll": {} - } - }, - "System.Buffers/4.5.1": { - "type": "package", - "compile": { - "ref/netstandard2.0/System.Buffers.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Buffers.dll": {} - } - }, - "System.Memory/4.5.4": { - "type": "package", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.4.0", - "System.Runtime.CompilerServices.Unsafe": "4.5.3" - }, - "compile": { - "lib/netstandard2.0/System.Memory.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Memory.dll": {} - } - }, - "System.Numerics.Vectors/4.5.0": { - "type": "package", - "compile": { - "ref/netstandard2.0/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Numerics.Vectors.dll": {} - } - }, - "System.Runtime.CompilerServices.Unsafe/5.0.0": { - "type": "package", - "compile": { - "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {} - } - }, - "System.Text.Encodings.Web/5.0.0": { - "type": "package", - "dependencies": { - "System.Memory": "4.5.4" - }, - "compile": { - "lib/netstandard2.0/System.Text.Encodings.Web.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Text.Encodings.Web.dll": {} - } - }, - "System.Text.Json/5.0.1": { - "type": "package", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "5.0.0", - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "5.0.0", - "System.Text.Encodings.Web": "5.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - }, - "compile": { - "lib/netstandard2.0/System.Text.Json.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Text.Json.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.5.4": { - "type": "package", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "4.5.3" - }, - "compile": { - "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": {} - }, - "runtime": { - "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": {} - } - } - } - }, - "libraries": { - "Dynamic.Json/1.3.0": { - "sha512": "5+MWsuNFKBotfoGf8zqRvtlSjQDsHUrkNawN/eCeG/FLSypJ3UYxjES10FDmHgPfGddzHqyHoDXVMR9rBteKwQ==", - "type": "package", - "path": "dynamic.json/1.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "dynamic.json.1.3.0.nupkg.sha512", - "dynamic.json.nuspec", - "lib/netstandard2.0/Dynamic.Json.dll" - ] - }, - "Microsoft.Bcl.AsyncInterfaces/5.0.0": { - "sha512": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==", - "type": "package", - "path": "microsoft.bcl.asyncinterfaces/5.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/Microsoft.Bcl.AsyncInterfaces.dll", - "lib/net461/Microsoft.Bcl.AsyncInterfaces.xml", - "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll", - "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.xml", - "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll", - "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.xml", - "microsoft.bcl.asyncinterfaces.5.0.0.nupkg.sha512", - "microsoft.bcl.asyncinterfaces.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "type": "package", - "path": "microsoft.netcore.platforms/1.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "microsoft.netcore.platforms.1.1.0.nupkg.sha512", - "microsoft.netcore.platforms.nuspec", - "runtime.json" - ] - }, - "NETStandard.Library/2.0.3": { - "sha512": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "type": "package", - "path": "netstandard.library/2.0.3", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "build/netstandard2.0/NETStandard.Library.targets", - "build/netstandard2.0/ref/Microsoft.Win32.Primitives.dll", - "build/netstandard2.0/ref/System.AppContext.dll", - "build/netstandard2.0/ref/System.Collections.Concurrent.dll", - "build/netstandard2.0/ref/System.Collections.NonGeneric.dll", - "build/netstandard2.0/ref/System.Collections.Specialized.dll", - "build/netstandard2.0/ref/System.Collections.dll", - "build/netstandard2.0/ref/System.ComponentModel.Composition.dll", - "build/netstandard2.0/ref/System.ComponentModel.EventBasedAsync.dll", - "build/netstandard2.0/ref/System.ComponentModel.Primitives.dll", - "build/netstandard2.0/ref/System.ComponentModel.TypeConverter.dll", - "build/netstandard2.0/ref/System.ComponentModel.dll", - "build/netstandard2.0/ref/System.Console.dll", - "build/netstandard2.0/ref/System.Core.dll", - "build/netstandard2.0/ref/System.Data.Common.dll", - "build/netstandard2.0/ref/System.Data.dll", - "build/netstandard2.0/ref/System.Diagnostics.Contracts.dll", - "build/netstandard2.0/ref/System.Diagnostics.Debug.dll", - "build/netstandard2.0/ref/System.Diagnostics.FileVersionInfo.dll", - "build/netstandard2.0/ref/System.Diagnostics.Process.dll", - "build/netstandard2.0/ref/System.Diagnostics.StackTrace.dll", - "build/netstandard2.0/ref/System.Diagnostics.TextWriterTraceListener.dll", - "build/netstandard2.0/ref/System.Diagnostics.Tools.dll", - "build/netstandard2.0/ref/System.Diagnostics.TraceSource.dll", - "build/netstandard2.0/ref/System.Diagnostics.Tracing.dll", - "build/netstandard2.0/ref/System.Drawing.Primitives.dll", - "build/netstandard2.0/ref/System.Drawing.dll", - "build/netstandard2.0/ref/System.Dynamic.Runtime.dll", - "build/netstandard2.0/ref/System.Globalization.Calendars.dll", - "build/netstandard2.0/ref/System.Globalization.Extensions.dll", - "build/netstandard2.0/ref/System.Globalization.dll", - "build/netstandard2.0/ref/System.IO.Compression.FileSystem.dll", - "build/netstandard2.0/ref/System.IO.Compression.ZipFile.dll", - "build/netstandard2.0/ref/System.IO.Compression.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.DriveInfo.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.Primitives.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.Watcher.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.dll", - "build/netstandard2.0/ref/System.IO.IsolatedStorage.dll", - "build/netstandard2.0/ref/System.IO.MemoryMappedFiles.dll", - "build/netstandard2.0/ref/System.IO.Pipes.dll", - "build/netstandard2.0/ref/System.IO.UnmanagedMemoryStream.dll", - "build/netstandard2.0/ref/System.IO.dll", - "build/netstandard2.0/ref/System.Linq.Expressions.dll", - "build/netstandard2.0/ref/System.Linq.Parallel.dll", - "build/netstandard2.0/ref/System.Linq.Queryable.dll", - "build/netstandard2.0/ref/System.Linq.dll", - "build/netstandard2.0/ref/System.Net.Http.dll", - "build/netstandard2.0/ref/System.Net.NameResolution.dll", - "build/netstandard2.0/ref/System.Net.NetworkInformation.dll", - "build/netstandard2.0/ref/System.Net.Ping.dll", - "build/netstandard2.0/ref/System.Net.Primitives.dll", - "build/netstandard2.0/ref/System.Net.Requests.dll", - "build/netstandard2.0/ref/System.Net.Security.dll", - "build/netstandard2.0/ref/System.Net.Sockets.dll", - "build/netstandard2.0/ref/System.Net.WebHeaderCollection.dll", - "build/netstandard2.0/ref/System.Net.WebSockets.Client.dll", - "build/netstandard2.0/ref/System.Net.WebSockets.dll", - "build/netstandard2.0/ref/System.Net.dll", - "build/netstandard2.0/ref/System.Numerics.dll", - "build/netstandard2.0/ref/System.ObjectModel.dll", - "build/netstandard2.0/ref/System.Reflection.Extensions.dll", - "build/netstandard2.0/ref/System.Reflection.Primitives.dll", - "build/netstandard2.0/ref/System.Reflection.dll", - "build/netstandard2.0/ref/System.Resources.Reader.dll", - "build/netstandard2.0/ref/System.Resources.ResourceManager.dll", - "build/netstandard2.0/ref/System.Resources.Writer.dll", - "build/netstandard2.0/ref/System.Runtime.CompilerServices.VisualC.dll", - "build/netstandard2.0/ref/System.Runtime.Extensions.dll", - "build/netstandard2.0/ref/System.Runtime.Handles.dll", - "build/netstandard2.0/ref/System.Runtime.InteropServices.RuntimeInformation.dll", - "build/netstandard2.0/ref/System.Runtime.InteropServices.dll", - "build/netstandard2.0/ref/System.Runtime.Numerics.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Formatters.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Json.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Primitives.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Xml.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.dll", - "build/netstandard2.0/ref/System.Runtime.dll", - "build/netstandard2.0/ref/System.Security.Claims.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Algorithms.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Csp.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Encoding.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Primitives.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.X509Certificates.dll", - "build/netstandard2.0/ref/System.Security.Principal.dll", - "build/netstandard2.0/ref/System.Security.SecureString.dll", - "build/netstandard2.0/ref/System.ServiceModel.Web.dll", - "build/netstandard2.0/ref/System.Text.Encoding.Extensions.dll", - "build/netstandard2.0/ref/System.Text.Encoding.dll", - "build/netstandard2.0/ref/System.Text.RegularExpressions.dll", - "build/netstandard2.0/ref/System.Threading.Overlapped.dll", - "build/netstandard2.0/ref/System.Threading.Tasks.Parallel.dll", - "build/netstandard2.0/ref/System.Threading.Tasks.dll", - "build/netstandard2.0/ref/System.Threading.Thread.dll", - "build/netstandard2.0/ref/System.Threading.ThreadPool.dll", - "build/netstandard2.0/ref/System.Threading.Timer.dll", - "build/netstandard2.0/ref/System.Threading.dll", - "build/netstandard2.0/ref/System.Transactions.dll", - "build/netstandard2.0/ref/System.ValueTuple.dll", - "build/netstandard2.0/ref/System.Web.dll", - "build/netstandard2.0/ref/System.Windows.dll", - "build/netstandard2.0/ref/System.Xml.Linq.dll", - "build/netstandard2.0/ref/System.Xml.ReaderWriter.dll", - "build/netstandard2.0/ref/System.Xml.Serialization.dll", - "build/netstandard2.0/ref/System.Xml.XDocument.dll", - "build/netstandard2.0/ref/System.Xml.XPath.XDocument.dll", - "build/netstandard2.0/ref/System.Xml.XPath.dll", - "build/netstandard2.0/ref/System.Xml.XmlDocument.dll", - "build/netstandard2.0/ref/System.Xml.XmlSerializer.dll", - "build/netstandard2.0/ref/System.Xml.dll", - "build/netstandard2.0/ref/System.dll", - "build/netstandard2.0/ref/mscorlib.dll", - "build/netstandard2.0/ref/netstandard.dll", - "build/netstandard2.0/ref/netstandard.xml", - "lib/netstandard1.0/_._", - "netstandard.library.2.0.3.nupkg.sha512", - "netstandard.library.nuspec" - ] - }, - "Portable.BouncyCastle/1.9.0": { - "sha512": "eZZBCABzVOek+id9Xy04HhmgykF0wZg9wpByzrWN7q8qEI0Qen9b7tfd7w8VA3dOeesumMG7C5ZPy0jk7PSRHw==", - "type": "package", - "path": "portable.bouncycastle/1.9.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "lib/net40/BouncyCastle.Crypto.dll", - "lib/net40/BouncyCastle.Crypto.xml", - "lib/netstandard2.0/BouncyCastle.Crypto.dll", - "lib/netstandard2.0/BouncyCastle.Crypto.xml", - "portable.bouncycastle.1.9.0.nupkg.sha512", - "portable.bouncycastle.nuspec" - ] - }, - "System.Buffers/4.5.1": { - "sha512": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", - "type": "package", - "path": "system.buffers/4.5.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/System.Buffers.dll", - "lib/net461/System.Buffers.xml", - "lib/netcoreapp2.0/_._", - "lib/netstandard1.1/System.Buffers.dll", - "lib/netstandard1.1/System.Buffers.xml", - "lib/netstandard2.0/System.Buffers.dll", - "lib/netstandard2.0/System.Buffers.xml", - "lib/uap10.0.16299/_._", - "ref/net45/System.Buffers.dll", - "ref/net45/System.Buffers.xml", - "ref/netcoreapp2.0/_._", - "ref/netstandard1.1/System.Buffers.dll", - "ref/netstandard1.1/System.Buffers.xml", - "ref/netstandard2.0/System.Buffers.dll", - "ref/netstandard2.0/System.Buffers.xml", - "ref/uap10.0.16299/_._", - "system.buffers.4.5.1.nupkg.sha512", - "system.buffers.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Memory/4.5.4": { - "sha512": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", - "type": "package", - "path": "system.memory/4.5.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/System.Memory.dll", - "lib/net461/System.Memory.xml", - "lib/netcoreapp2.1/_._", - "lib/netstandard1.1/System.Memory.dll", - "lib/netstandard1.1/System.Memory.xml", - "lib/netstandard2.0/System.Memory.dll", - "lib/netstandard2.0/System.Memory.xml", - "ref/netcoreapp2.1/_._", - "system.memory.4.5.4.nupkg.sha512", - "system.memory.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Numerics.Vectors/4.5.0": { - "sha512": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==", - "type": "package", - "path": "system.numerics.vectors/4.5.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Numerics.Vectors.dll", - "lib/net46/System.Numerics.Vectors.xml", - "lib/netcoreapp2.0/_._", - "lib/netstandard1.0/System.Numerics.Vectors.dll", - "lib/netstandard1.0/System.Numerics.Vectors.xml", - "lib/netstandard2.0/System.Numerics.Vectors.dll", - "lib/netstandard2.0/System.Numerics.Vectors.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.xml", - "lib/uap10.0.16299/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/System.Numerics.Vectors.dll", - "ref/net45/System.Numerics.Vectors.xml", - "ref/net46/System.Numerics.Vectors.dll", - "ref/net46/System.Numerics.Vectors.xml", - "ref/netcoreapp2.0/_._", - "ref/netstandard1.0/System.Numerics.Vectors.dll", - "ref/netstandard1.0/System.Numerics.Vectors.xml", - "ref/netstandard2.0/System.Numerics.Vectors.dll", - "ref/netstandard2.0/System.Numerics.Vectors.xml", - "ref/uap10.0.16299/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.numerics.vectors.4.5.0.nupkg.sha512", - "system.numerics.vectors.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Runtime.CompilerServices.Unsafe/5.0.0": { - "sha512": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==", - "type": "package", - "path": "system.runtime.compilerservices.unsafe/5.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net45/System.Runtime.CompilerServices.Unsafe.dll", - "lib/net45/System.Runtime.CompilerServices.Unsafe.xml", - "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll", - "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.xml", - "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", - "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", - "ref/net461/System.Runtime.CompilerServices.Unsafe.dll", - "ref/net461/System.Runtime.CompilerServices.Unsafe.xml", - "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", - "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", - "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", - "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", - "ref/netstandard2.1/System.Runtime.CompilerServices.Unsafe.dll", - "ref/netstandard2.1/System.Runtime.CompilerServices.Unsafe.xml", - "system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512", - "system.runtime.compilerservices.unsafe.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Text.Encodings.Web/5.0.0": { - "sha512": "EEslUvHKll1ftizbn20mX3Ix/l4Ygk/bdJ2LY6/X6FlGaP0RIhKMo9nS6JIGnKKT6KBP2PGj6JC3B9/ZF6ErqQ==", - "type": "package", - "path": "system.text.encodings.web/5.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/System.Text.Encodings.Web.dll", - "lib/net461/System.Text.Encodings.Web.xml", - "lib/netcoreapp3.0/System.Text.Encodings.Web.dll", - "lib/netcoreapp3.0/System.Text.Encodings.Web.xml", - "lib/netstandard1.0/System.Text.Encodings.Web.dll", - "lib/netstandard1.0/System.Text.Encodings.Web.xml", - "lib/netstandard2.0/System.Text.Encodings.Web.dll", - "lib/netstandard2.0/System.Text.Encodings.Web.xml", - "lib/netstandard2.1/System.Text.Encodings.Web.dll", - "lib/netstandard2.1/System.Text.Encodings.Web.xml", - "system.text.encodings.web.5.0.0.nupkg.sha512", - "system.text.encodings.web.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Text.Json/5.0.1": { - "sha512": "/UM3UK1dXKl8Ybysg/21gM4S8DJgkR+yLU8JwqCVbuNqQNImelntgYFAN5QxR8sJJ1kMx//hOUdf0lltosi8cQ==", - "type": "package", - "path": "system.text.json/5.0.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/System.Text.Json.dll", - "lib/net461/System.Text.Json.xml", - "lib/netcoreapp3.0/System.Text.Json.dll", - "lib/netcoreapp3.0/System.Text.Json.xml", - "lib/netstandard2.0/System.Text.Json.dll", - "lib/netstandard2.0/System.Text.Json.xml", - "system.text.json.5.0.1.nupkg.sha512", - "system.text.json.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Threading.Tasks.Extensions/4.5.4": { - "sha512": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", - "type": "package", - "path": "system.threading.tasks.extensions/4.5.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net461/System.Threading.Tasks.Extensions.dll", - "lib/net461/System.Threading.Tasks.Extensions.xml", - "lib/netcoreapp2.1/_._", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", - "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard2.0/System.Threading.Tasks.Extensions.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netcoreapp2.1/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.threading.tasks.extensions.4.5.4.nupkg.sha512", - "system.threading.tasks.extensions.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - } - }, - "projectFileDependencyGroups": { - ".NETStandard,Version=v2.0": [ - "Dynamic.Json >= 1.3.0", - "NETStandard.Library >= 2.0.3", - "Portable.BouncyCastle >= 1.9.0" - ] - }, - "packageFolders": { - "/Users/ambert01/.nuget/packages/": {} - }, - "project": { - "version": "2.5.2", - "restore": { - "projectUniqueName": "/Users/ambert01/Downloads/netezos-master/Netezos/Netezos.csproj", - "projectName": "Netezos", - "projectPath": "/Users/ambert01/Downloads/netezos-master/Netezos/Netezos.csproj", - "packagesPath": "/Users/ambert01/.nuget/packages/", - "outputPath": "/Users/ambert01/Downloads/netezos-master/Netezos/obj/", - "projectStyle": "PackageReference", - "configFilePaths": [ - "/Users/ambert01/.nuget/NuGet/NuGet.Config" - ], - "originalTargetFrameworks": [ - "netstandard2.0" - ], - "sources": { - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "dependencies": { - "Dynamic.Json": { - "target": "Package", - "version": "[1.3.0, )" - }, - "NETStandard.Library": { - "suppressParent": "All", - "target": "Package", - "version": "[2.0.3, )", - "autoReferenced": true - }, - "Portable.BouncyCastle": { - "target": "Package", - "version": "[1.9.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/6.0.301/RuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/NetezosTest.cs b/Assets/Scripts/NetezosTest.cs deleted file mode 100644 index 82f6f909..00000000 --- a/Assets/Scripts/NetezosTest.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Netezos.Forging; -using Netezos.Forging.Models; -using Netezos.Keys; -using Netezos.Rpc; -using UnityEngine; -using UnityEngine.Networking; - -public class NetezosTest : MonoBehaviour -{ - // Start is called before the first frame update - IEnumerator Start() - { - Mnemonic mnemonic = new Mnemonic("degree saddle wedding essence rubber fire dismiss catalog deal remain about reason"); - var key = Key.FromMnemonic(mnemonic, "Testwallet123"); - - - Debug.LogError($"Secret key {key.GetBase58()}"); - Debug.LogError($"Tz address {key.PubKey.Address}"); - - // use this address to receive some tez - var address = key.PubKey.Address; // tz1fKvpg4tNM5EjhjSStm9yTfqKRLuL1KDFZ - - using var rpc = new TezosRpc("https://rpczero.tzbeta.net/"); - - CoroutineWrapper headCoroutine = new CoroutineWrapper(rpc.Blocks.Head.Hash.GetAsync()); - yield return headCoroutine; - - string head = headCoroutine.Result; - Debug.LogError(head); - - - // get account's counter - CoroutineWrapper counterCoroutine = new CoroutineWrapper( rpc.Blocks.Head.Context.Contracts[address].Counter.GetAsync()); - yield return counterCoroutine; - int counter = counterCoroutine.Result; - - Debug.LogError(counter); - - var content = new ManagerOperationContent[] - { - new RevealContent - { - Source = address, - Counter = ++counter, - PublicKey = key.PubKey.GetBase58(), - GasLimit = 1500, - Fee = 1275 // 0.001 tez - }, - new TransactionContent - { - Source = address, - Counter = ++counter, - Amount = 1000000, // 1 tez - Destination = "tz1KhnTgwoRRALBX6vRHRnydDGSBFsWtcJxc", - GasLimit = 1500, - Fee = 1275 // 0.001 tez - } - }; - - CoroutineWrapper bytesCoroutine = new CoroutineWrapper(new LocalForge().ForgeOperationGroupAsync(head, content)); - yield return bytesCoroutine; - var bytes = bytesCoroutine.Result; - - // sign the operation bytes - byte[] signature = key.SignOperation(bytes); - - - // inject the operation and get its id (operation hash) - CoroutineWrapper dynamicCoroutine = new CoroutineWrapper(rpc.Inject.Operation.PostAsync(bytes.Concat(signature))); - yield return dynamicCoroutine; - dynamic result = dynamicCoroutine.Result; - } - - private IEnumerator Coroutine() - { - using (var newRequest = UnityWebRequest.Get("https://mainnet-tezos.giganode.io/chains/main/blocks/head/hash")) - { - newRequest.SetRequestHeader("Accept", "application/json"); - newRequest.SetRequestHeader("Content-Type", "application/json"); - newRequest.SetRequestHeader("User-Agent", "Netezos/" + Assembly.GetExecutingAssembly().GetName().Version.ToString(2)); - newRequest.timeout = (int)10; - newRequest.SendWebRequest(); - while (!newRequest.isDone) - { - Debug.LogError(newRequest.downloadProgress); - yield return null; - } - - Debug.LogError(newRequest.result); - Debug.LogError(newRequest.downloadHandler.text); - } - } -} diff --git a/Assets/Scripts/NetezosTest.cs.meta b/Assets/Scripts/NetezosTest.cs.meta deleted file mode 100644 index 241cfea6..00000000 --- a/Assets/Scripts/NetezosTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 968a3add9143d44558f7d2aaf9fba691 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Samples.meta b/Assets/Scripts/Samples.meta deleted file mode 100644 index ad20f74a..00000000 --- a/Assets/Scripts/Samples.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3cc864e0165d64f5d86ae03a79627310 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Samples/NetezosTransactionSample.cs b/Assets/Scripts/Samples/NetezosTransactionSample.cs deleted file mode 100644 index b1c9f337..00000000 --- a/Assets/Scripts/Samples/NetezosTransactionSample.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.Collections; -using System.Linq; -using Netezos.Forging; -using Netezos.Forging.Models; -using Netezos.Keys; -using Netezos.Rpc; -using UnityEngine; - -/// -/// This is a sample with the steps needed to transfer some Tez -/// from account A to account B. -/// -/// And this also helps to exemplifies how to use -/// instead of async operations. -/// -public class NetezosTransactionSample : MonoBehaviour -{ - /// - /// Key that will be used to transfer tez - /// - [SerializeField, Tooltip("Key that will be used to transfer tez")] - private string _privateKeyBase58 = "edsk34ZXiGFoxJZrovxtQhFLTGhVLkZKRSzy3AzjnuoHTm5QDgPBp3"; - - /// - /// Address where the transfer will arrive - /// - [SerializeField, Tooltip("Address where the transfer will arrive")] - private string _destinationAddress = "tz1fKvpg4tNM5EjhjSStm9yTfqKRLuL1KDFZ"; - - /// - /// URI of the network to connect the rpc - /// - [SerializeField, Tooltip("URI of the network to connect the rpc")] - private string _rpcNetwork = "https://jakartanet.ecadinfra.com"; - - /// - /// Amount of ꜩ to transfer (1000000ꜩ is equal to 1 tez) - /// - [SerializeField, Tooltip("Amount of ꜩ to transfer (1000000ꜩ is equal to 1 tez)")] - private long _amount = 100000000; - - [SerializeField] - private int _gasLimit = 150307; - - [SerializeField] - private long _fee = 1282; - - IEnumerator Start() - { - // This is an account used for testing purpuses. - var key = Key.FromBase58(_privateKeyBase58); - Debug.Log($"Secret key: {key.GetBase58()}"); - Debug.Log($"tz Address {key.Address}"); - Debug.Log($"Pub key: {key.PubKey}"); - - // Connecting to jakartanet for testing purpuses - var rpc = new TezosRpc(_rpcNetwork); - - // Get counter - var counterOperation = new CoroutineWrapper(rpc.Blocks.Head.Context.Contracts[key.PubKey.Address].Counter.GetAsync()); - yield return counterOperation; - int counter = counterOperation.Result; - - var content = new ManagerOperationContent[] - { - // Note: Reveal operation should be used only if the account wasn't reveled before - // otherwise it can be removed. - /* - new RevealContent - { - Source = key.PubKey.Address, - Counter = ++counter, - PublicKey = key.PubKey.GetBase58(), - GasLimit = 1500, - Fee = 1000 // 0.001 tez - }, - */ - new TransactionContent - { - Source = key.PubKey.Address, - Counter = ++counter, - // 100000000 is 100 tez - Amount = _amount, - Destination = _destinationAddress, - GasLimit = _gasLimit, - Fee = _fee, - } - }; - - var branchOperation = new CoroutineWrapper(rpc.Blocks.Head.Hash.GetAsync()); - yield return branchOperation; - var branch = branchOperation.Result; - Debug.Log("Branch " + branch); - - // Forge the operation locally - var forgeOperation = new CoroutineWrapper(new LocalForge().ForgeOperationGroupAsync(branch, content)); - yield return forgeOperation; - var bytes = forgeOperation.Result; - Debug.Log("Forge"); - - // Sign the operation - byte[] signature = key.SignOperation(bytes); - Debug.Log("Signed"); - - // Inject operation - var injectOperation = new CoroutineWrapper(rpc.Inject.Operation.PostAsync(bytes.Concat(signature))); - yield return injectOperation; - //Debug.Log("Injected " + injectOperation.Result); - - yield return null; - } -} diff --git a/Assets/Scripts/Samples/NetezosTransactionSample.cs.meta b/Assets/Scripts/Samples/NetezosTransactionSample.cs.meta deleted file mode 100644 index 56ba00a6..00000000 --- a/Assets/Scripts/Samples/NetezosTransactionSample.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f75138f27f5fb4e8c9193d7dfac525af -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/TezosAPI/Tezos.cs b/Assets/Scripts/TezosAPI/Tezos.cs deleted file mode 100644 index 79b87a95..00000000 --- a/Assets/Scripts/TezosAPI/Tezos.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections; -using System.Text.Json; -using System.Threading.Tasks; -using BeaconSDK; -using UnityEngine; - -namespace TezosAPI -{ - /// - /// Implementation of the ITezosAPI. - /// Exposes the main functions of the Tezos API in Unity - /// - public class Tezos : ITezosAPI - { - private string _networkName; - private string _networkNode; - private string _indexerNode; - private IBeaconConnector _beaconConnector; - - private string _handshake; - private string _pubKey; - private string _signature; - private string _transactionHash; - - public BeaconMessageReceiver MessageReceiver { get; private set; } - - public Tezos(string networkName = "", string customNode = "", string indexerNode = "") - { - _networkName = networkName; - _networkNode = customNode; - _indexerNode = indexerNode; - - InitBeaconConnector(); - } - - private void InitBeaconConnector() - { - // Create a BeaconMessageReceiver Game object to receive callback messages - MessageReceiver = new GameObject("UnityBeacon").AddComponent(); - - // Assign the BeaconConnector depending on the platform. -#if UNITY_WEBGL && !UNITY_EDITOR - _beaconConnector = new BeaconConnectorWebGl(); - _beaconConnector.SetNetwork(_networkName, _networkNode); -#elif UNITY_IOS && !UNITY_EDITOR - _beaconConnector = new BeaconConnectorIOS(); - (_beaconConnector as BeaconConnectorIOS)?.SetBeaconMessageReceiver(MessageReceiver); - _beaconConnector.ConnectAccount(); - MessageReceiver.PairingCompleted += (_) => RequestPermission(); -#elif UNITY_ANDROID && !UNITY_EDITOR - _beaconConnector = new BeaconConnectorAndroid(); - _beaconConnector.ConnectAccount(); -#elif UNITY_STANDALONE || UNITY_EDITOR - _beaconConnector = new BeaconConnectorDotNet(); - _beaconConnector.SetNetwork(_networkName, _networkNode); - (_beaconConnector as BeaconConnectorDotNet)?.SetBeaconMessageReceiver(MessageReceiver); - _beaconConnector.ConnectAccount(); - MessageReceiver.PairingCompleted += (_) => RequestPermission(); -#else - _beaconConnector = new BeaconConnectorNull(); -#endif - - MessageReceiver.ClientCreated += (_) => { _beaconConnector.RequestHandshake(); }; - MessageReceiver.HandshakeReceived += (handshake) => - { - _handshake = handshake; - }; - - MessageReceiver.AccountConnected += (account) => - { - var json = JsonSerializer.Deserialize(account); - if (json.TryGetProperty("account", out json)) - { - _pubKey = json.GetProperty("publicKey").GetString(); - - Debug.Log("my pubkey: " + _pubKey); - } - }; - MessageReceiver.PayloadSigned += (payload) => - { - var json = JsonSerializer.Deserialize(payload); - var signature = json.GetProperty("signature").GetString(); - _signature = signature; - }; - MessageReceiver.ContractCallCompleted += (transaction) => - { - var json = JsonSerializer.Deserialize(transaction); - var transactionHash = json.GetProperty("transactionHash").GetString(); - MessageReceiver.StartCoroutine(MessageReceiver.ContractCallInjection(_indexerNode, transactionHash)); - }; - } - - public void ConnectWallet() - { -#if UNITY_WEBGL - _beaconConnector.ConnectAccount(); -#elif UNITY_ANDROID - RequestPermission(); - Application.OpenURL($"tezos://?type=tzip10&data={_handshake}"); -#elif UNITY_IPHONE - _beaconConnector.ConnectAccount(); - Application.OpenURL($"tezos://?type=tzip10&data={_handshake}"); -#endif - } - - public void DisconnectWallet() - { - _beaconConnector.DisconnectAccount(); - } - - public string GetActiveWalletAddress() - { - return _beaconConnector.GetActiveAccountAddress(); - } - - public IEnumerator ReadBalance(Action callback) - { - var address = _beaconConnector.GetActiveAccountAddress(); - return NetezosExtensions.ReadTZBalance(_networkNode, address, callback); - } - - public IEnumerator ReadView(string contractAddress, string entryPoint, object input, Action callback) - { - return NetezosExtensions.ReadView(_networkNode,contractAddress, entryPoint, input, callback); - } - - public void CallContract(string contractAddress, string entryPoint, string input, ulong amount = 0) - { - _beaconConnector.RequestTezosOperation(contractAddress, entryPoint, input, - amount , _networkName, _networkNode); - } - - public void RequestPermission() - { - _beaconConnector.RequestTezosPermission(_networkName, _networkNode); - } - - public void RequestSignPayload(int signingType, string payload) - { - _beaconConnector.RequestTezosSignPayload(signingType, payload); - } - - public bool VerifySignedPayload(string payload) - { - var key = _pubKey; - var signature = _signature; - return NetezosExtensions.VerifySignature(key, payload, signature); - } - } -} diff --git a/Assets/WebGLCopyAndPaste/Scripts.meta b/Assets/WebGLCopyAndPaste/Scripts.meta deleted file mode 100644 index 34001d34..00000000 --- a/Assets/WebGLCopyAndPaste/Scripts.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -<<<<<<<< HEAD:UnityTezosAirgap/Assets/WebGLCopyAndPaste/Scripts.meta -guid: 778b2fd8714c2cb4eade5a16d45a54ca -======== -guid: d2c6bd9d1e01c46ba8b50e1bb4d40b77 ->>>>>>>> netezos_for_michelson:UnityTezosAirgap/Assets/Scripts.meta -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6f818e..1293485e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.0] - 2023-03-31 +### Added +- UPM-compatible Package +- CI to publish package to NPM registry +- Cross-Session-Persistence to authentication + +### Fixed +- Bugs on sample project + +### Changed +- Beacon SDK version + + ## [Unreleased] ### Changed - Added dependencies to manifest.json @@ -29,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The project has now a CHANGELOG - Added auto releases with GH actions +[1.1.0]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/1.1.0 [unreleased]: https://github.com/trilitech/tezos-unity-sdk/compare/0.0.2...HEAD [0.0.2]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/0.0.2 [0.0.1]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/0.0.1 diff --git a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.dgspec.json.meta b/CHANGELOG.md.meta similarity index 75% rename from Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.dgspec.json.meta rename to CHANGELOG.md.meta index aa3df725..ad4871bd 100644 --- a/Assets/Scripts/Netezos/obj/Netezos.csproj.nuget.dgspec.json.meta +++ b/CHANGELOG.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ad623c719c98408b9cd709bc9d30428 +guid: a7c48d72816b54510ab5bd2c714f06d5 TextScriptImporter: externalObjects: {} userData: diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..67e9959f --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Trilitech + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/LICENSE.md.meta b/LICENSE.md.meta new file mode 100644 index 00000000..a9a27086 --- /dev/null +++ b/LICENSE.md.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3179983ecc804a76b1768e7df1f17c95 +timeCreated: 1679676674 \ No newline at end of file diff --git a/Packages/manifest.json b/Packages/manifest.json deleted file mode 100644 index 56d04155..00000000 --- a/Packages/manifest.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "dependencies": { - "com.unity.collab-proxy": "2.0.0", - "com.unity.feature.2d": "1.0.0", - "com.unity.ide.rider": "3.0.18", - "com.unity.ide.visualstudio": "2.0.17", - "com.unity.ide.vscode": "1.2.5", - "com.unity.nuget.newtonsoft-json": "3.0.2", - "com.unity.test-framework": "1.1.31", - "com.unity.textmeshpro": "3.0.6", - "com.unity.timeline": "1.6.4", - "com.unity.toolchain.macos-x86_64-linux-x86_64": "2.0.2", - "com.unity.ugui": "1.0.0", - "com.unity.visualscripting": "1.8.0", - "com.unity.modules.ai": "1.0.0", - "com.unity.modules.androidjni": "1.0.0", - "com.unity.modules.animation": "1.0.0", - "com.unity.modules.assetbundle": "1.0.0", - "com.unity.modules.audio": "1.0.0", - "com.unity.modules.cloth": "1.0.0", - "com.unity.modules.director": "1.0.0", - "com.unity.modules.imageconversion": "1.0.0", - "com.unity.modules.imgui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.particlesystem": "1.0.0", - "com.unity.modules.physics": "1.0.0", - "com.unity.modules.physics2d": "1.0.0", - "com.unity.modules.screencapture": "1.0.0", - "com.unity.modules.terrain": "1.0.0", - "com.unity.modules.terrainphysics": "1.0.0", - "com.unity.modules.tilemap": "1.0.0", - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.uielements": "1.0.0", - "com.unity.modules.umbra": "1.0.0", - "com.unity.modules.unityanalytics": "1.0.0", - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.modules.unitywebrequestassetbundle": "1.0.0", - "com.unity.modules.unitywebrequestaudio": "1.0.0", - "com.unity.modules.unitywebrequesttexture": "1.0.0", - "com.unity.modules.unitywebrequestwww": "1.0.0", - "com.unity.modules.vehicles": "1.0.0", - "com.unity.modules.video": "1.0.0", - "com.unity.modules.vr": "1.0.0", - "com.unity.modules.wind": "1.0.0", - "com.unity.modules.xr": "1.0.0" - } -} diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json deleted file mode 100644 index 2c585477..00000000 --- a/Packages/packages-lock.json +++ /dev/null @@ -1,496 +0,0 @@ -{ - "dependencies": { - "com.unity.2d.animation": { - "version": "7.0.8", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.2d.common": "6.0.5", - "com.unity.2d.sprite": "1.0.0", - "com.unity.modules.animation": "1.0.0", - "com.unity.modules.uielements": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.2d.common": { - "version": "6.0.5", - "depth": 2, - "source": "registry", - "dependencies": { - "com.unity.2d.sprite": "1.0.0", - "com.unity.mathematics": "1.1.0", - "com.unity.modules.uielements": "1.0.0", - "com.unity.burst": "1.5.1" - }, - "url": "https://packages.unity.com" - }, - "com.unity.2d.path": { - "version": "5.0.2", - "depth": 2, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.2d.pixel-perfect": { - "version": "5.0.1", - "depth": 1, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.2d.psdimporter": { - "version": "6.0.6", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.2d.animation": "7.0.8", - "com.unity.2d.common": "6.0.5", - "com.unity.2d.sprite": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.2d.sprite": { - "version": "1.0.0", - "depth": 1, - "source": "builtin", - "dependencies": {} - }, - "com.unity.2d.spriteshape": { - "version": "7.0.6", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.mathematics": "1.1.0", - "com.unity.2d.common": "6.0.4", - "com.unity.2d.path": "5.0.2", - "com.unity.modules.physics2d": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.2d.tilemap": { - "version": "1.0.0", - "depth": 1, - "source": "builtin", - "dependencies": {} - }, - "com.unity.2d.tilemap.extras": { - "version": "2.2.3", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.modules.tilemap": "1.0.0", - "com.unity.2d.tilemap": "1.0.0", - "com.unity.ugui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.burst": { - "version": "1.6.6", - "depth": 3, - "source": "registry", - "dependencies": { - "com.unity.mathematics": "1.2.1" - }, - "url": "https://packages.unity.com" - }, - "com.unity.collab-proxy": { - "version": "2.0.0", - "depth": 0, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.ext.nunit": { - "version": "1.0.6", - "depth": 1, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.feature.2d": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.2d.animation": "7.0.8", - "com.unity.2d.pixel-perfect": "5.0.1", - "com.unity.2d.psdimporter": "6.0.6", - "com.unity.2d.sprite": "1.0.0", - "com.unity.2d.spriteshape": "7.0.6", - "com.unity.2d.tilemap": "1.0.0", - "com.unity.2d.tilemap.extras": "2.2.3" - } - }, - "com.unity.ide.rider": { - "version": "3.0.18", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.ext.nunit": "1.0.6" - }, - "url": "https://packages.unity.com" - }, - "com.unity.ide.visualstudio": { - "version": "2.0.17", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.test-framework": "1.1.9" - }, - "url": "https://packages.unity.com" - }, - "com.unity.ide.vscode": { - "version": "1.2.5", - "depth": 0, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.mathematics": { - "version": "1.2.6", - "depth": 2, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.nuget.newtonsoft-json": { - "version": "3.0.2", - "depth": 0, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.sysroot": { - "version": "2.0.3", - "depth": 1, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, - "com.unity.sysroot.linux-x86_64": { - "version": "2.0.2", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.sysroot": "2.0.3" - }, - "url": "https://packages.unity.com" - }, - "com.unity.test-framework": { - "version": "1.1.31", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.ext.nunit": "1.0.6", - "com.unity.modules.imgui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.textmeshpro": { - "version": "3.0.6", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.ugui": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.timeline": { - "version": "1.6.4", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.modules.director": "1.0.0", - "com.unity.modules.animation": "1.0.0", - "com.unity.modules.audio": "1.0.0", - "com.unity.modules.particlesystem": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.toolchain.macos-x86_64-linux-x86_64": { - "version": "2.0.2", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.sysroot": "2.0.3", - "com.unity.sysroot.linux-x86_64": "2.0.2" - }, - "url": "https://packages.unity.com" - }, - "com.unity.ugui": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.imgui": "1.0.0" - } - }, - "com.unity.visualscripting": { - "version": "1.8.0", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.ugui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0" - }, - "url": "https://packages.unity.com" - }, - "com.unity.modules.ai": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.androidjni": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.animation": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.assetbundle": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.audio": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.cloth": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.physics": "1.0.0" - } - }, - "com.unity.modules.director": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.audio": "1.0.0", - "com.unity.modules.animation": "1.0.0" - } - }, - "com.unity.modules.imageconversion": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.imgui": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.jsonserialize": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.particlesystem": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.physics": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.physics2d": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.screencapture": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.imageconversion": "1.0.0" - } - }, - "com.unity.modules.subsystems": { - "version": "1.0.0", - "depth": 1, - "source": "builtin", - "dependencies": { - "com.unity.modules.jsonserialize": "1.0.0" - } - }, - "com.unity.modules.terrain": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.terrainphysics": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.physics": "1.0.0", - "com.unity.modules.terrain": "1.0.0" - } - }, - "com.unity.modules.tilemap": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.physics2d": "1.0.0" - } - }, - "com.unity.modules.ui": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.uielements": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.imgui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.uielementsnative": "1.0.0" - } - }, - "com.unity.modules.uielementsnative": { - "version": "1.0.0", - "depth": 1, - "source": "builtin", - "dependencies": { - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.imgui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0" - } - }, - "com.unity.modules.umbra": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.unityanalytics": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0" - } - }, - "com.unity.modules.unitywebrequest": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.unitywebrequestassetbundle": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.assetbundle": "1.0.0", - "com.unity.modules.unitywebrequest": "1.0.0" - } - }, - "com.unity.modules.unitywebrequestaudio": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.modules.audio": "1.0.0" - } - }, - "com.unity.modules.unitywebrequesttexture": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.modules.imageconversion": "1.0.0" - } - }, - "com.unity.modules.unitywebrequestwww": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.modules.unitywebrequestassetbundle": "1.0.0", - "com.unity.modules.unitywebrequestaudio": "1.0.0", - "com.unity.modules.audio": "1.0.0", - "com.unity.modules.assetbundle": "1.0.0", - "com.unity.modules.imageconversion": "1.0.0" - } - }, - "com.unity.modules.vehicles": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.physics": "1.0.0" - } - }, - "com.unity.modules.video": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.audio": "1.0.0", - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.unitywebrequest": "1.0.0" - } - }, - "com.unity.modules.vr": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.physics": "1.0.0", - "com.unity.modules.xr": "1.0.0" - } - }, - "com.unity.modules.wind": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": {} - }, - "com.unity.modules.xr": { - "version": "1.0.0", - "depth": 0, - "source": "builtin", - "dependencies": { - "com.unity.modules.physics": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.subsystems": "1.0.0" - } - } - } -} diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset deleted file mode 100644 index 27287fec..00000000 --- a/ProjectSettings/AudioManager.asset +++ /dev/null @@ -1,19 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!11 &1 -AudioManager: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Volume: 1 - Rolloff Scale: 1 - Doppler Factor: 1 - Default Speaker Mode: 2 - m_SampleRate: 0 - m_DSPBufferSize: 1024 - m_VirtualVoiceCount: 512 - m_RealVoiceCount: 32 - m_SpatializerPlugin: - m_AmbisonicDecoderPlugin: - m_DisableAudio: 0 - m_VirtualizeEffects: 1 - m_RequestedDSPBufferSize: 0 diff --git a/ProjectSettings/BurstAotSettings_Android.json b/ProjectSettings/BurstAotSettings_Android.json deleted file mode 100644 index 771d37b7..00000000 --- a/ProjectSettings/BurstAotSettings_Android.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "MonoBehaviour": { - "Version": 4, - "EnableBurstCompilation": true, - "EnableOptimisations": true, - "EnableSafetyChecks": false, - "EnableDebugInAllBuilds": false, - "CpuMinTargetX32": 0, - "CpuMaxTargetX32": 0, - "CpuMinTargetX64": 0, - "CpuMaxTargetX64": 0, - "OptimizeFor": 0 - } -} diff --git a/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/ProjectSettings/BurstAotSettings_StandaloneWindows.json deleted file mode 100644 index e02ae332..00000000 --- a/ProjectSettings/BurstAotSettings_StandaloneWindows.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "MonoBehaviour": { - "Version": 4, - "EnableBurstCompilation": true, - "EnableOptimisations": true, - "EnableSafetyChecks": false, - "EnableDebugInAllBuilds": false, - "UsePlatformSDKLinker": false, - "CpuMinTargetX32": 0, - "CpuMaxTargetX32": 0, - "CpuMinTargetX64": 0, - "CpuMaxTargetX64": 0, - "CpuTargetsX32": 6, - "CpuTargetsX64": 72, - "OptimizeFor": 0 - } -} diff --git a/ProjectSettings/BurstAotSettings_WebGL.json b/ProjectSettings/BurstAotSettings_WebGL.json deleted file mode 100644 index 771d37b7..00000000 --- a/ProjectSettings/BurstAotSettings_WebGL.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "MonoBehaviour": { - "Version": 4, - "EnableBurstCompilation": true, - "EnableOptimisations": true, - "EnableSafetyChecks": false, - "EnableDebugInAllBuilds": false, - "CpuMinTargetX32": 0, - "CpuMaxTargetX32": 0, - "CpuMinTargetX64": 0, - "CpuMaxTargetX64": 0, - "OptimizeFor": 0 - } -} diff --git a/ProjectSettings/BurstAotSettings_iOS.json b/ProjectSettings/BurstAotSettings_iOS.json deleted file mode 100644 index 771d37b7..00000000 --- a/ProjectSettings/BurstAotSettings_iOS.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "MonoBehaviour": { - "Version": 4, - "EnableBurstCompilation": true, - "EnableOptimisations": true, - "EnableSafetyChecks": false, - "EnableDebugInAllBuilds": false, - "CpuMinTargetX32": 0, - "CpuMaxTargetX32": 0, - "CpuMinTargetX64": 0, - "CpuMaxTargetX64": 0, - "OptimizeFor": 0 - } -} diff --git a/ProjectSettings/ClusterInputManager.asset b/ProjectSettings/ClusterInputManager.asset deleted file mode 100644 index e7886b26..00000000 --- a/ProjectSettings/ClusterInputManager.asset +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!236 &1 -ClusterInputManager: - m_ObjectHideFlags: 0 - m_Inputs: [] diff --git a/ProjectSettings/CommonBurstAotSettings.json b/ProjectSettings/CommonBurstAotSettings.json deleted file mode 100644 index 0293dafc..00000000 --- a/ProjectSettings/CommonBurstAotSettings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "MonoBehaviour": { - "Version": 4, - "DisabledWarnings": "" - } -} diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset deleted file mode 100644 index 72d14303..00000000 --- a/ProjectSettings/DynamicsManager.asset +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!55 &1 -PhysicsManager: - m_ObjectHideFlags: 0 - serializedVersion: 13 - m_Gravity: {x: 0, y: -9.81, z: 0} - m_DefaultMaterial: {fileID: 0} - m_BounceThreshold: 2 - m_DefaultMaxDepenetrationVelocity: 10 - m_SleepThreshold: 0.005 - m_DefaultContactOffset: 0.01 - m_DefaultSolverIterations: 6 - m_DefaultSolverVelocityIterations: 1 - m_QueriesHitBackfaces: 0 - m_QueriesHitTriggers: 1 - m_EnableAdaptiveForce: 0 - m_ClothInterCollisionDistance: 0.1 - m_ClothInterCollisionStiffness: 0.2 - m_ContactsGeneration: 1 - m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - m_AutoSimulation: 1 - m_AutoSyncTransforms: 0 - m_ReuseCollisionCallbacks: 1 - m_ClothInterCollisionSettingsToggle: 0 - m_ClothGravity: {x: 0, y: -9.81, z: 0} - m_ContactPairsMode: 0 - m_BroadphaseType: 0 - m_WorldBounds: - m_Center: {x: 0, y: 0, z: 0} - m_Extent: {x: 250, y: 250, z: 250} - m_WorldSubdivisions: 8 - m_FrictionType: 0 - m_EnableEnhancedDeterminism: 0 - m_EnableUnifiedHeightmaps: 1 - m_SolverType: 0 - m_DefaultMaxAngularSpeed: 50 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset deleted file mode 100644 index 38c9de06..00000000 --- a/ProjectSettings/EditorBuildSettings.asset +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1045 &1 -EditorBuildSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Scenes: - - enabled: 1 - path: Assets/Scenes/Demo Example.unity - guid: 052b58d73b545cc4a85ac8ab2a3b670b - m_configObjects: {} diff --git a/ProjectSettings/EditorBuildSettings.asset.bak b/ProjectSettings/EditorBuildSettings.asset.bak deleted file mode 100644 index ef162e10..00000000 --- a/ProjectSettings/EditorBuildSettings.asset.bak +++ /dev/null @@ -1,23 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1045 &1 -EditorBuildSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Scenes: - - enabled: 0 - path: Assets/Scenes/BeaconWebGL.unity - guid: 279d78ef595aa406bb24793db445aa7d - - enabled: 0 - path: Assets/Scenes/BeaconMobile.unity - guid: 5986c101cc09149f1a649f4e779a82ff -<<<<<<< HEAD - - enabled: 0 - path: Assets/Scenes/Demo Example_old.unity - guid: 93dd23a522efe1f438f353e18184c2c5 -======= ->>>>>>> tarek-dev - - enabled: 1 - path: Assets/Scenes/Demo Example.unity - guid: 052b58d73b545cc4a85ac8ab2a3b670b - m_configObjects: {} diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset deleted file mode 100644 index fa3ed494..00000000 --- a/ProjectSettings/EditorSettings.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!159 &1 -EditorSettings: - m_ObjectHideFlags: 0 - serializedVersion: 11 - m_SerializationMode: 2 - m_LineEndingsForNewScripts: 0 - m_DefaultBehaviorMode: 1 - m_PrefabRegularEnvironment: {fileID: 0} - m_PrefabUIEnvironment: {fileID: 0} - m_SpritePackerMode: 4 - m_SpritePackerPaddingPower: 1 - m_EtcTextureCompressorBehavior: 1 - m_EtcTextureFastCompressor: 1 - m_EtcTextureNormalCompressor: 2 - m_EtcTextureBestCompressor: 4 - m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp - m_ProjectGenerationRootNamespace: - m_EnableTextureStreamingInEditMode: 1 - m_EnableTextureStreamingInPlayMode: 1 - m_AsyncShaderCompilation: 1 - m_CachingShaderPreprocessor: 1 - m_PrefabModeAllowAutoSave: 1 - m_EnterPlayModeOptionsEnabled: 0 - m_EnterPlayModeOptions: 3 - m_GameObjectNamingDigits: 1 - m_GameObjectNamingScheme: 0 - m_AssetNamingUsesSpace: 1 - m_UseLegacyProbeSampleCount: 0 - m_SerializeInlineMappingsOnOneLine: 1 - m_DisableCookiesInLightmapper: 1 - m_AssetPipelineMode: 1 - m_CacheServerMode: 0 - m_CacheServerEndpoint: - m_CacheServerNamespacePrefix: default - m_CacheServerEnableDownload: 1 - m_CacheServerEnableUpload: 1 - m_CacheServerEnableAuth: 0 - m_CacheServerEnableTls: 0 diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset deleted file mode 100644 index c165afb2..00000000 --- a/ProjectSettings/GraphicsSettings.asset +++ /dev/null @@ -1,64 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!30 &1 -GraphicsSettings: - m_ObjectHideFlags: 0 - serializedVersion: 13 - m_Deferred: - m_Mode: 1 - m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} - m_DeferredReflections: - m_Mode: 1 - m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} - m_ScreenSpaceShadows: - m_Mode: 1 - m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} - m_LegacyDeferred: - m_Mode: 1 - m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} - m_DepthNormals: - m_Mode: 1 - m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} - m_MotionVectors: - m_Mode: 1 - m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} - m_LightHalo: - m_Mode: 1 - m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} - m_LensFlare: - m_Mode: 1 - m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} - m_VideoShadersIncludeMode: 2 - m_AlwaysIncludedShaders: - - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} - m_PreloadedShaders: [] - m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_CustomRenderPipeline: {fileID: 0} - m_TransparencySortMode: 0 - m_TransparencySortAxis: {x: 0, y: 0, z: 1} - m_DefaultRenderingPath: 1 - m_DefaultMobileRenderingPath: 1 - m_TierSettings: [] - m_LightmapStripping: 0 - m_FogStripping: 0 - m_InstancingStripping: 0 - m_LightmapKeepPlain: 1 - m_LightmapKeepDirCombined: 1 - m_LightmapKeepDynamicPlain: 1 - m_LightmapKeepDynamicDirCombined: 1 - m_LightmapKeepShadowMask: 1 - m_LightmapKeepSubtractive: 1 - m_FogKeepLinear: 1 - m_FogKeepExp: 1 - m_FogKeepExp2: 1 - m_AlbedoSwatchInfos: [] - m_LightsUseLinearIntensity: 0 - m_LightsUseColorTemperature: 0 - m_DefaultRenderingLayerMask: 1 - m_LogWhenShaderIsCompiled: 0 diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset deleted file mode 100644 index b16147e9..00000000 --- a/ProjectSettings/InputManager.asset +++ /dev/null @@ -1,487 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!13 &1 -InputManager: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Axes: - - serializedVersion: 3 - m_Name: Horizontal - descriptiveName: - descriptiveNegativeName: - negativeButton: left - positiveButton: right - altNegativeButton: a - altPositiveButton: d - gravity: 3 - dead: 0.001 - sensitivity: 3 - snap: 1 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Vertical - descriptiveName: - descriptiveNegativeName: - negativeButton: down - positiveButton: up - altNegativeButton: s - altPositiveButton: w - gravity: 3 - dead: 0.001 - sensitivity: 3 - snap: 1 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Fire1 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: left ctrl - altNegativeButton: - altPositiveButton: mouse 0 - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Fire2 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: left alt - altNegativeButton: - altPositiveButton: mouse 1 - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Fire3 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: left shift - altNegativeButton: - altPositiveButton: mouse 2 - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Jump - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: space - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Mouse X - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: - altNegativeButton: - altPositiveButton: - gravity: 0 - dead: 0 - sensitivity: 0.1 - snap: 0 - invert: 0 - type: 1 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Mouse Y - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: - altNegativeButton: - altPositiveButton: - gravity: 0 - dead: 0 - sensitivity: 0.1 - snap: 0 - invert: 0 - type: 1 - axis: 1 - joyNum: 0 - - serializedVersion: 3 - m_Name: Mouse ScrollWheel - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: - altNegativeButton: - altPositiveButton: - gravity: 0 - dead: 0 - sensitivity: 0.1 - snap: 0 - invert: 0 - type: 1 - axis: 2 - joyNum: 0 - - serializedVersion: 3 - m_Name: Horizontal - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: - altNegativeButton: - altPositiveButton: - gravity: 0 - dead: 0.19 - sensitivity: 1 - snap: 0 - invert: 0 - type: 2 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Vertical - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: - altNegativeButton: - altPositiveButton: - gravity: 0 - dead: 0.19 - sensitivity: 1 - snap: 0 - invert: 1 - type: 2 - axis: 1 - joyNum: 0 - - serializedVersion: 3 - m_Name: Fire1 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: joystick button 0 - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Fire2 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: joystick button 1 - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Fire3 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: joystick button 2 - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Jump - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: joystick button 3 - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Submit - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: return - altNegativeButton: - altPositiveButton: joystick button 0 - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Submit - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: enter - altNegativeButton: - altPositiveButton: space - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Cancel - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: escape - altNegativeButton: - altPositiveButton: joystick button 1 - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Enable Debug Button 1 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: left ctrl - altNegativeButton: - altPositiveButton: joystick button 8 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Enable Debug Button 2 - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: backspace - altNegativeButton: - altPositiveButton: joystick button 9 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Reset - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: left alt - altNegativeButton: - altPositiveButton: joystick button 1 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Next - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: page down - altNegativeButton: - altPositiveButton: joystick button 5 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Previous - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: page up - altNegativeButton: - altPositiveButton: joystick button 4 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Validate - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: return - altNegativeButton: - altPositiveButton: joystick button 0 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Persistent - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: right shift - altNegativeButton: - altPositiveButton: joystick button 2 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Multiplier - descriptiveName: - descriptiveNegativeName: - negativeButton: - positiveButton: left shift - altNegativeButton: - altPositiveButton: joystick button 3 - gravity: 0 - dead: 0 - sensitivity: 0 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Horizontal - descriptiveName: - descriptiveNegativeName: - negativeButton: left - positiveButton: right - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Vertical - descriptiveName: - descriptiveNegativeName: - negativeButton: down - positiveButton: up - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 0 - axis: 0 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Vertical - descriptiveName: - descriptiveNegativeName: - negativeButton: down - positiveButton: up - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 2 - axis: 6 - joyNum: 0 - - serializedVersion: 3 - m_Name: Debug Horizontal - descriptiveName: - descriptiveNegativeName: - negativeButton: left - positiveButton: right - altNegativeButton: - altPositiveButton: - gravity: 1000 - dead: 0.001 - sensitivity: 1000 - snap: 0 - invert: 0 - type: 2 - axis: 5 - joyNum: 0 diff --git a/ProjectSettings/MemorySettings.asset b/ProjectSettings/MemorySettings.asset deleted file mode 100644 index 5b5facec..00000000 --- a/ProjectSettings/MemorySettings.asset +++ /dev/null @@ -1,35 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!387306366 &1 -MemorySettings: - m_ObjectHideFlags: 0 - m_EditorMemorySettings: - m_MainAllocatorBlockSize: -1 - m_ThreadAllocatorBlockSize: -1 - m_MainGfxBlockSize: -1 - m_ThreadGfxBlockSize: -1 - m_CacheBlockSize: -1 - m_TypetreeBlockSize: -1 - m_ProfilerBlockSize: -1 - m_ProfilerEditorBlockSize: -1 - m_BucketAllocatorGranularity: -1 - m_BucketAllocatorBucketsCount: -1 - m_BucketAllocatorBlockSize: -1 - m_BucketAllocatorBlockCount: -1 - m_ProfilerBucketAllocatorGranularity: -1 - m_ProfilerBucketAllocatorBucketsCount: -1 - m_ProfilerBucketAllocatorBlockSize: -1 - m_ProfilerBucketAllocatorBlockCount: -1 - m_TempAllocatorSizeMain: -1 - m_JobTempAllocatorBlockSize: -1 - m_BackgroundJobTempAllocatorBlockSize: -1 - m_JobTempAllocatorReducedBlockSize: -1 - m_TempAllocatorSizeGIBakingWorker: -1 - m_TempAllocatorSizeNavMeshWorker: -1 - m_TempAllocatorSizeAudioWorker: -1 - m_TempAllocatorSizeCloudWorker: -1 - m_TempAllocatorSizeGfx: -1 - m_TempAllocatorSizeJobWorker: -1 - m_TempAllocatorSizeBackgroundWorker: -1 - m_TempAllocatorSizePreloadManager: -1 - m_PlatformMemorySettings: {} diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset deleted file mode 100644 index ad2654e0..00000000 --- a/ProjectSettings/NavMeshAreas.asset +++ /dev/null @@ -1,93 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!126 &1 -NavMeshProjectSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - areas: - - name: Walkable - cost: 1 - - name: Not Walkable - cost: 1 - - name: Jump - cost: 2 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - - name: - cost: 1 - m_LastAgentTypeID: -887442657 - m_Settings: - - serializedVersion: 2 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.75 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - manualTileSize: 0 - tileSize: 256 - accuratePlacement: 0 - maxJobWorkers: 0 - preserveTilesOutsideBounds: 0 - debug: - m_Flags: 0 - m_SettingNames: - - Humanoid diff --git a/ProjectSettings/NetworkManager.asset b/ProjectSettings/NetworkManager.asset deleted file mode 100644 index 5dc6a831..00000000 --- a/ProjectSettings/NetworkManager.asset +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!149 &1 -NetworkManager: - m_ObjectHideFlags: 0 - m_DebugLevel: 0 - m_Sendrate: 15 - m_AssetToPrefab: {} diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset deleted file mode 100644 index f8f0cac4..00000000 --- a/ProjectSettings/PackageManagerSettings.asset +++ /dev/null @@ -1,35 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &1 -MonoBehaviour: - m_ObjectHideFlags: 61 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} - m_Name: - m_EditorClassIdentifier: - m_EnablePreReleasePackages: 1 - m_EnablePackageDependencies: 0 - m_AdvancedSettingsExpanded: 1 - m_ScopedRegistriesSettingsExpanded: 1 - m_SeeAllPackageVersions: 0 - oneTimeWarningShown: 1 - m_Registries: - - m_Id: main - m_Name: - m_Url: https://packages.unity.com - m_Scopes: [] - m_IsDefault: 1 - m_Capabilities: 7 - m_UserSelectedRegistryName: - m_UserAddingNewScopedRegistry: 0 - m_RegistryInfoDraft: - m_Modified: 0 - m_ErrorMessage: - m_UserModificationsInstanceId: -828 - m_OriginalInstanceId: -830 - m_LoadAssets: 0 diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset deleted file mode 100644 index 6cfcddaa..00000000 --- a/ProjectSettings/Physics2DSettings.asset +++ /dev/null @@ -1,56 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!19 &1 -Physics2DSettings: - m_ObjectHideFlags: 0 - serializedVersion: 5 - m_Gravity: {x: 0, y: -9.81} - m_DefaultMaterial: {fileID: 0} - m_VelocityIterations: 8 - m_PositionIterations: 3 - m_VelocityThreshold: 1 - m_MaxLinearCorrection: 0.2 - m_MaxAngularCorrection: 8 - m_MaxTranslationSpeed: 100 - m_MaxRotationSpeed: 360 - m_BaumgarteScale: 0.2 - m_BaumgarteTimeOfImpactScale: 0.75 - m_TimeToSleep: 0.5 - m_LinearSleepTolerance: 0.01 - m_AngularSleepTolerance: 2 - m_DefaultContactOffset: 0.01 - m_JobOptions: - serializedVersion: 2 - useMultithreading: 0 - useConsistencySorting: 0 - m_InterpolationPosesPerJob: 100 - m_NewContactsPerJob: 30 - m_CollideContactsPerJob: 100 - m_ClearFlagsPerJob: 200 - m_ClearBodyForcesPerJob: 200 - m_SyncDiscreteFixturesPerJob: 50 - m_SyncContinuousFixturesPerJob: 50 - m_FindNearestContactsPerJob: 100 - m_UpdateTriggerContactsPerJob: 100 - m_IslandSolverCostThreshold: 100 - m_IslandSolverBodyCostScale: 1 - m_IslandSolverContactCostScale: 10 - m_IslandSolverJointCostScale: 10 - m_IslandSolverBodiesPerJob: 50 - m_IslandSolverContactsPerJob: 50 - m_SimulationMode: 0 - m_QueriesHitTriggers: 1 - m_QueriesStartInColliders: 1 - m_CallbacksOnDisable: 1 - m_ReuseCollisionCallbacks: 1 - m_AutoSyncTransforms: 0 - m_AlwaysShowColliders: 0 - m_ShowColliderSleep: 1 - m_ShowColliderContacts: 0 - m_ShowColliderAABB: 0 - m_ContactArrowScale: 0.2 - m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} - m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} - m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} - m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} - m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/ProjectSettings/PresetManager.asset b/ProjectSettings/PresetManager.asset deleted file mode 100644 index 67a94dae..00000000 --- a/ProjectSettings/PresetManager.asset +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1386491679 &1 -PresetManager: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_DefaultPresets: {} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset deleted file mode 100644 index ca73adb2..00000000 --- a/ProjectSettings/ProjectSettings.asset +++ /dev/null @@ -1,907 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!129 &1 -PlayerSettings: - m_ObjectHideFlags: 0 - serializedVersion: 23 - productGUID: 0378bc8e489544daca5932b58f71adb8 - AndroidProfiler: 0 - AndroidFilterTouchesWhenObscured: 0 - AndroidEnableSustainedPerformanceMode: 0 - defaultScreenOrientation: 2 - targetDevice: 2 - useOnDemandResources: 0 - accelerometerFrequency: 60 - companyName: Unity - productName: UnityTezosAirgap - defaultCursor: {fileID: 0} - cursorHotspot: {x: 0, y: 0} - m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} - m_ShowUnitySplashScreen: 1 - m_ShowUnitySplashLogo: 1 - m_SplashScreenOverlayOpacity: 1 - m_SplashScreenAnimation: 1 - m_SplashScreenLogoStyle: 1 - m_SplashScreenDrawMode: 0 - m_SplashScreenBackgroundAnimationZoom: 1 - m_SplashScreenLogoAnimationZoom: 1 - m_SplashScreenBackgroundLandscapeAspect: 1 - m_SplashScreenBackgroundPortraitAspect: 1 - m_SplashScreenBackgroundLandscapeUvs: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - m_SplashScreenBackgroundPortraitUvs: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - m_SplashScreenLogos: [] - m_VirtualRealitySplashScreen: {fileID: 0} - m_HolographicTrackingLossScreen: {fileID: 0} - defaultScreenWidth: 1920 - defaultScreenHeight: 1080 - defaultScreenWidthWeb: 960 - defaultScreenHeightWeb: 600 - m_StereoRenderingPath: 0 - m_ActiveColorSpace: 0 - m_MTRendering: 1 - mipStripping: 0 - numberOfMipsStripped: 0 - m_StackTraceTypes: 010000000100000001000000010000000100000001000000 - iosShowActivityIndicatorOnLoading: -1 - androidShowActivityIndicatorOnLoading: -1 - iosUseCustomAppBackgroundBehavior: 0 - iosAllowHTTPDownload: 1 - allowedAutorotateToPortrait: 1 - allowedAutorotateToPortraitUpsideDown: 1 - allowedAutorotateToLandscapeRight: 1 - allowedAutorotateToLandscapeLeft: 1 - useOSAutorotation: 1 - use32BitDisplayBuffer: 1 - preserveFramebufferAlpha: 0 - disableDepthAndStencilBuffers: 0 - androidStartInFullscreen: 1 - androidRenderOutsideSafeArea: 1 - androidUseSwappy: 1 - androidBlitType: 0 - androidResizableWindow: 0 - androidDefaultWindowWidth: 1920 - androidDefaultWindowHeight: 1080 - androidMinimumWindowWidth: 400 - androidMinimumWindowHeight: 300 - androidFullscreenMode: 1 - defaultIsNativeResolution: 1 - macRetinaSupport: 1 - runInBackground: 0 - captureSingleScreen: 0 - muteOtherAudioSources: 0 - Prepare IOS For Recording: 0 - Force IOS Speakers When Recording: 0 - deferSystemGesturesMode: 0 - hideHomeButton: 0 - submitAnalytics: 1 - usePlayerLog: 1 - bakeCollisionMeshes: 0 - forceSingleInstance: 0 - useFlipModelSwapchain: 1 - resizableWindow: 0 - useMacAppStoreValidation: 0 - macAppStoreCategory: public.app-category.games - gpuSkinning: 0 - xboxPIXTextureCapture: 0 - xboxEnableAvatar: 0 - xboxEnableKinect: 0 - xboxEnableKinectAutoTracking: 0 - xboxEnableFitness: 0 - visibleInBackground: 1 - allowFullscreenSwitch: 1 - fullscreenMode: 1 - xboxSpeechDB: 0 - xboxEnableHeadOrientation: 0 - xboxEnableGuest: 0 - xboxEnablePIXSampling: 0 - metalFramebufferOnly: 0 - xboxOneResolution: 0 - xboxOneSResolution: 0 - xboxOneXResolution: 3 - xboxOneMonoLoggingLevel: 0 - xboxOneLoggingLevel: 1 - xboxOneDisableEsram: 0 - xboxOneEnableTypeOptimization: 0 - xboxOnePresentImmediateThreshold: 0 - switchQueueCommandMemory: 1048576 - switchQueueControlMemory: 16384 - switchQueueComputeMemory: 262144 - switchNVNShaderPoolsGranularity: 33554432 - switchNVNDefaultPoolsGranularity: 16777216 - switchNVNOtherPoolsGranularity: 16777216 - switchNVNMaxPublicTextureIDCount: 0 - switchNVNMaxPublicSamplerIDCount: 0 - stadiaPresentMode: 0 - stadiaTargetFramerate: 0 - vulkanNumSwapchainBuffers: 3 - vulkanEnableSetSRGBWrite: 0 - vulkanEnablePreTransform: 0 - vulkanEnableLateAcquireNextImage: 0 - vulkanEnableCommandBufferRecycling: 1 - m_SupportedAspectRatios: - 4:3: 1 - 5:4: 1 - 16:10: 1 - 16:9: 1 - Others: 1 - bundleVersion: 0.01 - preloadedAssets: [] - metroInputSource: 0 - wsaTransparentSwapchain: 0 - m_HolographicPauseOnTrackingLoss: 1 - xboxOneDisableKinectGpuReservation: 1 - xboxOneEnable7thCore: 1 - vrSettings: - enable360StereoCapture: 0 - isWsaHolographicRemotingEnabled: 0 - enableFrameTimingStats: 0 - enableOpenGLProfilerGPURecorders: 1 - useHDRDisplay: 0 - D3DHDRBitDepth: 0 - m_ColorGamuts: 00000000 - targetPixelDensity: 30 - resolutionScalingMode: 0 - resetResolutionOnWindowResize: 0 - androidSupportedAspectRatio: 1 - androidMaxAspectRatio: 2.1 - applicationIdentifier: - Android: com.unity.unitytezosairgap - Standalone: com.DefaultCompany.2DProject - iPhone: com.unity.tezos-unity-sdk - buildNumber: - Standalone: 0 - iPhone: 0 - tvOS: 0 - overrideDefaultApplicationIdentifier: 1 - AndroidBundleVersionCode: 2 - AndroidMinSdkVersion: 23 - AndroidTargetSdkVersion: 31 - AndroidPreferredInstallLocation: 1 - aotOptions: - stripEngineCode: 1 - iPhoneStrippingLevel: 0 - iPhoneScriptCallOptimization: 0 - ForceInternetPermission: 1 - ForceSDCardPermission: 0 - CreateWallpaper: 0 - APKExpansionFiles: 0 - keepLoadedShadersAlive: 0 - StripUnusedMeshComponents: 0 - VertexChannelCompressionMask: 4054 - iPhoneSdkVersion: 988 - iOSTargetOSVersionString: 13.0 - tvOSSdkVersion: 0 - tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 11.0 - uIPrerenderedIcon: 0 - uIRequiresPersistentWiFi: 0 - uIRequiresFullScreen: 1 - uIStatusBarHidden: 1 - uIExitOnSuspend: 0 - uIStatusBarStyle: 0 - appleTVSplashScreen: {fileID: 0} - appleTVSplashScreen2x: {fileID: 0} - tvOSSmallIconLayers: [] - tvOSSmallIconLayers2x: [] - tvOSLargeIconLayers: [] - tvOSLargeIconLayers2x: [] - tvOSTopShelfImageLayers: [] - tvOSTopShelfImageLayers2x: [] - tvOSTopShelfImageWideLayers: [] - tvOSTopShelfImageWideLayers2x: [] - iOSLaunchScreenType: 0 - iOSLaunchScreenPortrait: {fileID: 0} - iOSLaunchScreenLandscape: {fileID: 0} - iOSLaunchScreenBackgroundColor: - serializedVersion: 2 - rgba: 0 - iOSLaunchScreenFillPct: 100 - iOSLaunchScreenSize: 100 - iOSLaunchScreenCustomXibPath: - iOSLaunchScreeniPadType: 0 - iOSLaunchScreeniPadImage: {fileID: 0} - iOSLaunchScreeniPadBackgroundColor: - serializedVersion: 2 - rgba: 0 - iOSLaunchScreeniPadFillPct: 100 - iOSLaunchScreeniPadSize: 100 - iOSLaunchScreeniPadCustomXibPath: - iOSLaunchScreenCustomStoryboardPath: - iOSLaunchScreeniPadCustomStoryboardPath: - iOSDeviceRequirements: [] - iOSURLSchemes: [] - macOSURLSchemes: [] - iOSBackgroundModes: 0 - iOSMetalForceHardShadows: 0 - metalEditorSupport: 1 - metalAPIValidation: 1 - iOSRenderExtraFrameOnPause: 0 - iosCopyPluginsCodeInsteadOfSymlink: 0 - appleDeveloperTeamID: - iOSManualSigningProvisioningProfileID: - tvOSManualSigningProvisioningProfileID: - iOSManualSigningProvisioningProfileType: 0 - tvOSManualSigningProvisioningProfileType: 0 - appleEnableAutomaticSigning: 0 - iOSRequireARKit: 0 - iOSAutomaticallyDetectAndAddCapabilities: 1 - appleEnableProMotion: 0 - shaderPrecisionModel: 0 - clonedFromGUID: 10ad67313f4034357812315f3c407484 - templatePackageId: com.unity.template.2d@6.1.0 - templateDefaultScene: Assets/Scenes/SampleScene.unity - useCustomMainManifest: 0 - useCustomLauncherManifest: 0 - useCustomMainGradleTemplate: 1 - useCustomLauncherGradleManifest: 1 - useCustomBaseGradleTemplate: 1 - useCustomGradlePropertiesTemplate: 1 - useCustomProguardFile: 0 - AndroidTargetArchitectures: 1 - AndroidTargetDevices: 0 - AndroidSplashScreenScale: 0 - androidSplashScreen: {fileID: 0} - AndroidKeystoreName: - AndroidKeyaliasName: - AndroidBuildApkPerCpuArchitecture: 0 - AndroidTVCompatibility: 0 - AndroidIsGame: 1 - AndroidEnableTango: 0 - androidEnableBanner: 1 - androidUseLowAccuracyLocation: 0 - androidUseCustomKeystore: 0 - m_AndroidBanners: - - width: 320 - height: 180 - banner: {fileID: 0} - androidGamepadSupportLevel: 0 - chromeosInputEmulation: 1 - AndroidMinifyWithR8: 0 - AndroidMinifyRelease: 0 - AndroidMinifyDebug: 0 - AndroidValidateAppBundleSize: 1 - AndroidAppBundleSizeToValidate: 150 - m_BuildTargetIcons: [] - m_BuildTargetPlatformIcons: - - m_BuildTarget: tvOS - m_Icons: - - m_Textures: [] - m_Width: 1280 - m_Height: 768 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 800 - m_Height: 480 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 400 - m_Height: 240 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 4640 - m_Height: 1440 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 2320 - m_Height: 720 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 3840 - m_Height: 1440 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 1920 - m_Height: 720 - m_Kind: 1 - m_SubKind: - - m_BuildTarget: iPhone - m_Icons: - - m_Textures: [] - m_Width: 180 - m_Height: 180 - m_Kind: 0 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 120 - m_Height: 120 - m_Kind: 0 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 167 - m_Height: 167 - m_Kind: 0 - m_SubKind: iPad - - m_Textures: [] - m_Width: 152 - m_Height: 152 - m_Kind: 0 - m_SubKind: iPad - - m_Textures: [] - m_Width: 76 - m_Height: 76 - m_Kind: 0 - m_SubKind: iPad - - m_Textures: [] - m_Width: 120 - m_Height: 120 - m_Kind: 3 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 80 - m_Height: 80 - m_Kind: 3 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 80 - m_Height: 80 - m_Kind: 3 - m_SubKind: iPad - - m_Textures: [] - m_Width: 40 - m_Height: 40 - m_Kind: 3 - m_SubKind: iPad - - m_Textures: [] - m_Width: 87 - m_Height: 87 - m_Kind: 1 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 58 - m_Height: 58 - m_Kind: 1 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 29 - m_Height: 29 - m_Kind: 1 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 58 - m_Height: 58 - m_Kind: 1 - m_SubKind: iPad - - m_Textures: [] - m_Width: 29 - m_Height: 29 - m_Kind: 1 - m_SubKind: iPad - - m_Textures: [] - m_Width: 60 - m_Height: 60 - m_Kind: 2 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 40 - m_Height: 40 - m_Kind: 2 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 40 - m_Height: 40 - m_Kind: 2 - m_SubKind: iPad - - m_Textures: [] - m_Width: 20 - m_Height: 20 - m_Kind: 2 - m_SubKind: iPad - - m_Textures: [] - m_Width: 1024 - m_Height: 1024 - m_Kind: 4 - m_SubKind: App Store - - m_BuildTarget: Android - m_Icons: - - m_Textures: [] - m_Width: 432 - m_Height: 432 - m_Kind: 2 - m_SubKind: - - m_Textures: [] - m_Width: 324 - m_Height: 324 - m_Kind: 2 - m_SubKind: - - m_Textures: [] - m_Width: 216 - m_Height: 216 - m_Kind: 2 - m_SubKind: - - m_Textures: [] - m_Width: 162 - m_Height: 162 - m_Kind: 2 - m_SubKind: - - m_Textures: [] - m_Width: 108 - m_Height: 108 - m_Kind: 2 - m_SubKind: - - m_Textures: [] - m_Width: 81 - m_Height: 81 - m_Kind: 2 - m_SubKind: - - m_Textures: [] - m_Width: 192 - m_Height: 192 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 144 - m_Height: 144 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 96 - m_Height: 96 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 72 - m_Height: 72 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 48 - m_Height: 48 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 36 - m_Height: 36 - m_Kind: 1 - m_SubKind: - - m_Textures: [] - m_Width: 192 - m_Height: 192 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 144 - m_Height: 144 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 96 - m_Height: 96 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 72 - m_Height: 72 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 48 - m_Height: 48 - m_Kind: 0 - m_SubKind: - - m_Textures: [] - m_Width: 36 - m_Height: 36 - m_Kind: 0 - m_SubKind: - m_BuildTargetBatching: [] - m_BuildTargetShaderSettings: [] - m_BuildTargetGraphicsJobs: - - m_BuildTarget: MacStandaloneSupport - m_GraphicsJobs: 0 - - m_BuildTarget: Switch - m_GraphicsJobs: 0 - - m_BuildTarget: MetroSupport - m_GraphicsJobs: 0 - - m_BuildTarget: AppleTVSupport - m_GraphicsJobs: 0 - - m_BuildTarget: BJMSupport - m_GraphicsJobs: 0 - - m_BuildTarget: LinuxStandaloneSupport - m_GraphicsJobs: 0 - - m_BuildTarget: PS4Player - m_GraphicsJobs: 0 - - m_BuildTarget: iOSSupport - m_GraphicsJobs: 0 - - m_BuildTarget: WindowsStandaloneSupport - m_GraphicsJobs: 0 - - m_BuildTarget: XboxOnePlayer - m_GraphicsJobs: 0 - - m_BuildTarget: LuminSupport - m_GraphicsJobs: 0 - - m_BuildTarget: AndroidPlayer - m_GraphicsJobs: 0 - - m_BuildTarget: WebGLSupport - m_GraphicsJobs: 0 - m_BuildTargetGraphicsJobMode: [] - m_BuildTargetGraphicsAPIs: - - m_BuildTarget: AndroidPlayer - m_APIs: 0b00000008000000 - m_Automatic: 0 - - m_BuildTarget: iOSSupport - m_APIs: 10000000 - m_Automatic: 1 - m_BuildTargetVRSettings: [] - m_DefaultShaderChunkSizeInMB: 16 - m_DefaultShaderChunkCount: 0 - openGLRequireES31: 0 - openGLRequireES31AEP: 0 - openGLRequireES32: 0 - m_TemplateCustomTags: {} - mobileMTRendering: - Android: 0 - iPhone: 1 - tvOS: 1 - m_BuildTargetGroupLightmapEncodingQuality: [] - m_BuildTargetGroupLightmapSettings: [] - m_BuildTargetNormalMapEncoding: [] - m_BuildTargetDefaultTextureCompressionFormat: - - m_BuildTarget: Android - m_Format: 3 - playModeTestRunnerEnabled: 0 - runPlayModeTestAsEditModeTest: 0 - actionOnDotNetUnhandledException: 1 - enableInternalProfiler: 0 - logObjCUncaughtExceptions: 1 - enableCrashReportAPI: 0 - cameraUsageDescription: - locationUsageDescription: - microphoneUsageDescription: - bluetoothUsageDescription: - switchNMETAOverride: - switchNetLibKey: - switchSocketMemoryPoolSize: 6144 - switchSocketAllocatorPoolSize: 128 - switchSocketConcurrencyLimit: 14 - switchScreenResolutionBehavior: 2 - switchUseCPUProfiler: 0 - switchUseGOLDLinker: 0 - switchLTOSetting: 0 - switchApplicationID: 0x01004b9000490000 - switchNSODependencies: - switchTitleNames_0: - switchTitleNames_1: - switchTitleNames_2: - switchTitleNames_3: - switchTitleNames_4: - switchTitleNames_5: - switchTitleNames_6: - switchTitleNames_7: - switchTitleNames_8: - switchTitleNames_9: - switchTitleNames_10: - switchTitleNames_11: - switchTitleNames_12: - switchTitleNames_13: - switchTitleNames_14: - switchTitleNames_15: - switchPublisherNames_0: - switchPublisherNames_1: - switchPublisherNames_2: - switchPublisherNames_3: - switchPublisherNames_4: - switchPublisherNames_5: - switchPublisherNames_6: - switchPublisherNames_7: - switchPublisherNames_8: - switchPublisherNames_9: - switchPublisherNames_10: - switchPublisherNames_11: - switchPublisherNames_12: - switchPublisherNames_13: - switchPublisherNames_14: - switchPublisherNames_15: - switchIcons_0: {fileID: 0} - switchIcons_1: {fileID: 0} - switchIcons_2: {fileID: 0} - switchIcons_3: {fileID: 0} - switchIcons_4: {fileID: 0} - switchIcons_5: {fileID: 0} - switchIcons_6: {fileID: 0} - switchIcons_7: {fileID: 0} - switchIcons_8: {fileID: 0} - switchIcons_9: {fileID: 0} - switchIcons_10: {fileID: 0} - switchIcons_11: {fileID: 0} - switchIcons_12: {fileID: 0} - switchIcons_13: {fileID: 0} - switchIcons_14: {fileID: 0} - switchIcons_15: {fileID: 0} - switchSmallIcons_0: {fileID: 0} - switchSmallIcons_1: {fileID: 0} - switchSmallIcons_2: {fileID: 0} - switchSmallIcons_3: {fileID: 0} - switchSmallIcons_4: {fileID: 0} - switchSmallIcons_5: {fileID: 0} - switchSmallIcons_6: {fileID: 0} - switchSmallIcons_7: {fileID: 0} - switchSmallIcons_8: {fileID: 0} - switchSmallIcons_9: {fileID: 0} - switchSmallIcons_10: {fileID: 0} - switchSmallIcons_11: {fileID: 0} - switchSmallIcons_12: {fileID: 0} - switchSmallIcons_13: {fileID: 0} - switchSmallIcons_14: {fileID: 0} - switchSmallIcons_15: {fileID: 0} - switchManualHTML: - switchAccessibleURLs: - switchLegalInformation: - switchMainThreadStackSize: 1048576 - switchPresenceGroupId: - switchLogoHandling: 0 - switchReleaseVersion: 0 - switchDisplayVersion: 1.0.0 - switchStartupUserAccount: 0 - switchTouchScreenUsage: 0 - switchSupportedLanguagesMask: 0 - switchLogoType: 0 - switchApplicationErrorCodeCategory: - switchUserAccountSaveDataSize: 0 - switchUserAccountSaveDataJournalSize: 0 - switchApplicationAttribute: 0 - switchCardSpecSize: -1 - switchCardSpecClock: -1 - switchRatingsMask: 0 - switchRatingsInt_0: 0 - switchRatingsInt_1: 0 - switchRatingsInt_2: 0 - switchRatingsInt_3: 0 - switchRatingsInt_4: 0 - switchRatingsInt_5: 0 - switchRatingsInt_6: 0 - switchRatingsInt_7: 0 - switchRatingsInt_8: 0 - switchRatingsInt_9: 0 - switchRatingsInt_10: 0 - switchRatingsInt_11: 0 - switchRatingsInt_12: 0 - switchLocalCommunicationIds_0: - switchLocalCommunicationIds_1: - switchLocalCommunicationIds_2: - switchLocalCommunicationIds_3: - switchLocalCommunicationIds_4: - switchLocalCommunicationIds_5: - switchLocalCommunicationIds_6: - switchLocalCommunicationIds_7: - switchParentalControl: 0 - switchAllowsScreenshot: 1 - switchAllowsVideoCapturing: 1 - switchAllowsRuntimeAddOnContentInstall: 0 - switchDataLossConfirmation: 0 - switchUserAccountLockEnabled: 0 - switchSystemResourceMemory: 16777216 - switchSupportedNpadStyles: 22 - switchNativeFsCacheSize: 32 - switchIsHoldTypeHorizontal: 0 - switchSupportedNpadCount: 8 - switchSocketConfigEnabled: 0 - switchTcpInitialSendBufferSize: 32 - switchTcpInitialReceiveBufferSize: 64 - switchTcpAutoSendBufferSizeMax: 256 - switchTcpAutoReceiveBufferSizeMax: 256 - switchUdpSendBufferSize: 9 - switchUdpReceiveBufferSize: 42 - switchSocketBufferEfficiency: 4 - switchSocketInitializeEnabled: 1 - switchNetworkInterfaceManagerInitializeEnabled: 1 - switchPlayerConnectionEnabled: 1 - switchUseNewStyleFilepaths: 0 - switchUseLegacyFmodPriorities: 1 - switchUseMicroSleepForYield: 1 - switchEnableRamDiskSupport: 0 - switchMicroSleepForYieldTime: 25 - switchRamDiskSpaceSize: 12 - ps4NPAgeRating: 12 - ps4NPTitleSecret: - ps4NPTrophyPackPath: - ps4ParentalLevel: 11 - ps4ContentID: ED1633-NPXX51362_00-0000000000000000 - ps4Category: 0 - ps4MasterVersion: 01.00 - ps4AppVersion: 01.00 - ps4AppType: 0 - ps4ParamSfxPath: - ps4VideoOutPixelFormat: 0 - ps4VideoOutInitialWidth: 1920 - ps4VideoOutBaseModeInitialWidth: 1920 - ps4VideoOutReprojectionRate: 60 - ps4PronunciationXMLPath: - ps4PronunciationSIGPath: - ps4BackgroundImagePath: - ps4StartupImagePath: - ps4StartupImagesFolder: - ps4IconImagesFolder: - ps4SaveDataImagePath: - ps4SdkOverride: - ps4BGMPath: - ps4ShareFilePath: - ps4ShareOverlayImagePath: - ps4PrivacyGuardImagePath: - ps4ExtraSceSysFile: - ps4NPtitleDatPath: - ps4RemotePlayKeyAssignment: -1 - ps4RemotePlayKeyMappingDir: - ps4PlayTogetherPlayerCount: 0 - ps4EnterButtonAssignment: 2 - ps4ApplicationParam1: 0 - ps4ApplicationParam2: 0 - ps4ApplicationParam3: 0 - ps4ApplicationParam4: 0 - ps4DownloadDataSize: 0 - ps4GarlicHeapSize: 2048 - ps4ProGarlicHeapSize: 2560 - playerPrefsMaxSize: 32768 - ps4Passcode: bi9UOuSpM2Tlh01vOzwvSikHFswuzleh - ps4pnSessions: 1 - ps4pnPresence: 1 - ps4pnFriends: 1 - ps4pnGameCustomData: 1 - playerPrefsSupport: 0 - enableApplicationExit: 0 - resetTempFolder: 1 - restrictedAudioUsageRights: 0 - ps4UseResolutionFallback: 0 - ps4ReprojectionSupport: 0 - ps4UseAudio3dBackend: 0 - ps4UseLowGarlicFragmentationMode: 1 - ps4SocialScreenEnabled: 0 - ps4ScriptOptimizationLevel: 2 - ps4Audio3dVirtualSpeakerCount: 14 - ps4attribCpuUsage: 0 - ps4PatchPkgPath: - ps4PatchLatestPkgPath: - ps4PatchChangeinfoPath: - ps4PatchDayOne: 0 - ps4attribUserManagement: 0 - ps4attribMoveSupport: 0 - ps4attrib3DSupport: 0 - ps4attribShareSupport: 0 - ps4attribExclusiveVR: 0 - ps4disableAutoHideSplash: 0 - ps4videoRecordingFeaturesUsed: 0 - ps4contentSearchFeaturesUsed: 0 - ps4CompatibilityPS5: 0 - ps4AllowPS5Detection: 0 - ps4GPU800MHz: 1 - ps4attribEyeToEyeDistanceSettingVR: 0 - ps4IncludedModules: [] - ps4attribVROutputEnabled: 0 - monoEnv: - splashScreenBackgroundSourceLandscape: {fileID: 0} - splashScreenBackgroundSourcePortrait: {fileID: 0} - blurSplashScreenBackground: 1 - spritePackerPolicy: - webGLMemorySize: 32 - webGLExceptionSupport: 1 - webGLNameFilesAsHashes: 0 - webGLDataCaching: 1 - webGLDebugSymbols: 0 - webGLEmscriptenArgs: - webGLModulesDirectory: - webGLTemplate: PROJECT:Airgap - webGLAnalyzeBuildSize: 0 - webGLUseEmbeddedResources: 0 - webGLCompressionFormat: 2 - webGLWasmArithmeticExceptions: 0 - webGLLinkerTarget: 1 - webGLThreadsSupport: 0 - webGLDecompressionFallback: 0 - webGLPowerPreference: 2 - scriptingDefineSymbols: {} - additionalCompilerArguments: {} - platformArchitecture: {} - scriptingBackend: - Standalone: 0 - il2cppCompilerConfiguration: {} - managedStrippingLevel: {} - incrementalIl2cppBuild: {} - suppressCommonWarnings: 1 - allowUnsafeCode: 1 - useDeterministicCompilation: 1 - enableRoslynAnalyzers: 1 - selectedPlatform: 2 - additionalIl2CppArgs: - scriptingRuntimeVersion: 1 - gcIncremental: 1 - assemblyVersionValidation: 0 - gcWBarrierValidation: 0 - apiCompatibilityLevelPerPlatform: - Standalone: 6 - WebGL: 3 - m_RenderingPath: 1 - m_MobileRenderingPath: 1 - metroPackageName: 2D_BuiltInRenderer - metroPackageVersion: - metroCertificatePath: - metroCertificatePassword: - metroCertificateSubject: - metroCertificateIssuer: - metroCertificateNotAfter: 0000000000000000 - metroApplicationDescription: 2D_BuiltInRenderer - wsaImages: {} - metroTileShortName: - metroTileShowName: 0 - metroMediumTileShowName: 0 - metroLargeTileShowName: 0 - metroWideTileShowName: 0 - metroSupportStreamingInstall: 0 - metroLastRequiredScene: 0 - metroDefaultTileSize: 1 - metroTileForegroundText: 2 - metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} - metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} - metroSplashScreenUseBackgroundColor: 0 - platformCapabilities: {} - metroTargetDeviceFamilies: {} - metroFTAName: - metroFTAFileTypes: [] - metroProtocolName: - vcxProjDefaultLanguage: - XboxOneProductId: - XboxOneUpdateKey: - XboxOneSandboxId: - XboxOneContentId: - XboxOneTitleId: - XboxOneSCId: - XboxOneGameOsOverridePath: - XboxOnePackagingOverridePath: - XboxOneAppManifestOverridePath: - XboxOneVersion: 1.0.0.0 - XboxOnePackageEncryption: 0 - XboxOnePackageUpdateGranularity: 2 - XboxOneDescription: - XboxOneLanguage: - - enus - XboxOneCapability: [] - XboxOneGameRating: {} - XboxOneIsContentPackage: 0 - XboxOneEnhancedXboxCompatibilityMode: 0 - XboxOneEnableGPUVariability: 1 - XboxOneSockets: {} - XboxOneSplashScreen: {fileID: 0} - XboxOneAllowedProductIds: [] - XboxOnePersistentLocalStorageSize: 0 - XboxOneXTitleMemory: 8 - XboxOneOverrideIdentityName: - XboxOneOverrideIdentityPublisher: - vrEditorSettings: {} - cloudServicesEnabled: {} - luminIcon: - m_Name: - m_ModelFolderPath: - m_PortalFolderPath: - luminCert: - m_CertPath: - m_SignPackage: 1 - luminIsChannelApp: 0 - luminVersion: - m_VersionCode: 1 - m_VersionName: - apiCompatibilityLevel: 6 - activeInputHandler: 0 - windowsGamepadBackendHint: 0 - cloudProjectId: - framebufferDepthMemorylessMode: 0 - qualitySettingsNames: [] - projectName: - organizationId: - cloudEnabled: 0 - legacyClampBlendShapeWeights: 0 - playerDataPath: - forceSRGBBlit: 1 - virtualTexturingSupportEnabled: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt deleted file mode 100644 index e83d161a..00000000 --- a/ProjectSettings/ProjectVersion.txt +++ /dev/null @@ -1,2 +0,0 @@ -m_EditorVersion: 2021.3.13f1 -m_EditorVersionWithRevision: 2021.3.13f1 (9e7d58001ecf) diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset deleted file mode 100644 index d24eb10c..00000000 --- a/ProjectSettings/QualitySettings.asset +++ /dev/null @@ -1,236 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!47 &1 -QualitySettings: - m_ObjectHideFlags: 0 - serializedVersion: 5 - m_CurrentQuality: 5 - m_QualitySettings: - - serializedVersion: 2 - name: Very Low - pixelLightCount: 0 - shadows: 0 - shadowResolution: 0 - shadowProjection: 1 - shadowCascades: 1 - shadowDistance: 15 - shadowNearPlaneOffset: 3 - shadowCascade2Split: 0.33333334 - shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} - shadowmaskMode: 0 - skinWeights: 1 - textureQuality: 1 - anisotropicTextures: 0 - antiAliasing: 0 - softParticles: 0 - softVegetation: 0 - realtimeReflectionProbes: 0 - billboardsFaceCameraPosition: 0 - vSyncCount: 0 - lodBias: 0.3 - maximumLODLevel: 0 - streamingMipmapsActive: 0 - streamingMipmapsAddAllCameras: 1 - streamingMipmapsMemoryBudget: 512 - streamingMipmapsRenderersPerFrame: 512 - streamingMipmapsMaxLevelReduction: 2 - streamingMipmapsMaxFileIORequests: 1024 - particleRaycastBudget: 4 - asyncUploadTimeSlice: 2 - asyncUploadBufferSize: 16 - asyncUploadPersistentBuffer: 1 - resolutionScalingFixedDPIFactor: 1 - customRenderPipeline: {fileID: 0} - excludedTargetPlatforms: [] - - serializedVersion: 2 - name: Low - pixelLightCount: 0 - shadows: 0 - shadowResolution: 0 - shadowProjection: 1 - shadowCascades: 1 - shadowDistance: 20 - shadowNearPlaneOffset: 3 - shadowCascade2Split: 0.33333334 - shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} - shadowmaskMode: 0 - skinWeights: 2 - textureQuality: 0 - anisotropicTextures: 0 - antiAliasing: 0 - softParticles: 0 - softVegetation: 0 - realtimeReflectionProbes: 0 - billboardsFaceCameraPosition: 0 - vSyncCount: 0 - lodBias: 0.4 - maximumLODLevel: 0 - streamingMipmapsActive: 0 - streamingMipmapsAddAllCameras: 1 - streamingMipmapsMemoryBudget: 512 - streamingMipmapsRenderersPerFrame: 512 - streamingMipmapsMaxLevelReduction: 2 - streamingMipmapsMaxFileIORequests: 1024 - particleRaycastBudget: 16 - asyncUploadTimeSlice: 2 - asyncUploadBufferSize: 16 - asyncUploadPersistentBuffer: 1 - resolutionScalingFixedDPIFactor: 1 - customRenderPipeline: {fileID: 0} - excludedTargetPlatforms: [] - - serializedVersion: 2 - name: Medium - pixelLightCount: 1 - shadows: 1 - shadowResolution: 0 - shadowProjection: 1 - shadowCascades: 1 - shadowDistance: 20 - shadowNearPlaneOffset: 3 - shadowCascade2Split: 0.33333334 - shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} - shadowmaskMode: 0 - skinWeights: 2 - textureQuality: 0 - anisotropicTextures: 1 - antiAliasing: 0 - softParticles: 0 - softVegetation: 0 - realtimeReflectionProbes: 0 - billboardsFaceCameraPosition: 0 - vSyncCount: 1 - lodBias: 0.7 - maximumLODLevel: 0 - streamingMipmapsActive: 0 - streamingMipmapsAddAllCameras: 1 - streamingMipmapsMemoryBudget: 512 - streamingMipmapsRenderersPerFrame: 512 - streamingMipmapsMaxLevelReduction: 2 - streamingMipmapsMaxFileIORequests: 1024 - particleRaycastBudget: 64 - asyncUploadTimeSlice: 2 - asyncUploadBufferSize: 16 - asyncUploadPersistentBuffer: 1 - resolutionScalingFixedDPIFactor: 1 - customRenderPipeline: {fileID: 0} - excludedTargetPlatforms: [] - - serializedVersion: 2 - name: High - pixelLightCount: 2 - shadows: 2 - shadowResolution: 1 - shadowProjection: 1 - shadowCascades: 2 - shadowDistance: 40 - shadowNearPlaneOffset: 3 - shadowCascade2Split: 0.33333334 - shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} - shadowmaskMode: 1 - skinWeights: 2 - textureQuality: 0 - anisotropicTextures: 1 - antiAliasing: 0 - softParticles: 0 - softVegetation: 1 - realtimeReflectionProbes: 1 - billboardsFaceCameraPosition: 1 - vSyncCount: 1 - lodBias: 1 - maximumLODLevel: 0 - streamingMipmapsActive: 0 - streamingMipmapsAddAllCameras: 1 - streamingMipmapsMemoryBudget: 512 - streamingMipmapsRenderersPerFrame: 512 - streamingMipmapsMaxLevelReduction: 2 - streamingMipmapsMaxFileIORequests: 1024 - particleRaycastBudget: 256 - asyncUploadTimeSlice: 2 - asyncUploadBufferSize: 16 - asyncUploadPersistentBuffer: 1 - resolutionScalingFixedDPIFactor: 1 - customRenderPipeline: {fileID: 0} - excludedTargetPlatforms: [] - - serializedVersion: 2 - name: Very High - pixelLightCount: 3 - shadows: 2 - shadowResolution: 2 - shadowProjection: 1 - shadowCascades: 2 - shadowDistance: 70 - shadowNearPlaneOffset: 3 - shadowCascade2Split: 0.33333334 - shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} - shadowmaskMode: 1 - skinWeights: 4 - textureQuality: 0 - anisotropicTextures: 2 - antiAliasing: 2 - softParticles: 1 - softVegetation: 1 - realtimeReflectionProbes: 1 - billboardsFaceCameraPosition: 1 - vSyncCount: 1 - lodBias: 1.5 - maximumLODLevel: 0 - streamingMipmapsActive: 0 - streamingMipmapsAddAllCameras: 1 - streamingMipmapsMemoryBudget: 512 - streamingMipmapsRenderersPerFrame: 512 - streamingMipmapsMaxLevelReduction: 2 - streamingMipmapsMaxFileIORequests: 1024 - particleRaycastBudget: 1024 - asyncUploadTimeSlice: 2 - asyncUploadBufferSize: 16 - asyncUploadPersistentBuffer: 1 - resolutionScalingFixedDPIFactor: 1 - customRenderPipeline: {fileID: 0} - excludedTargetPlatforms: [] - - serializedVersion: 2 - name: Ultra - pixelLightCount: 4 - shadows: 2 - shadowResolution: 2 - shadowProjection: 1 - shadowCascades: 4 - shadowDistance: 150 - shadowNearPlaneOffset: 3 - shadowCascade2Split: 0.33333334 - shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} - shadowmaskMode: 1 - skinWeights: 255 - textureQuality: 0 - anisotropicTextures: 2 - antiAliasing: 2 - softParticles: 1 - softVegetation: 1 - realtimeReflectionProbes: 1 - billboardsFaceCameraPosition: 1 - vSyncCount: 1 - lodBias: 2 - maximumLODLevel: 0 - streamingMipmapsActive: 0 - streamingMipmapsAddAllCameras: 1 - streamingMipmapsMemoryBudget: 512 - streamingMipmapsRenderersPerFrame: 512 - streamingMipmapsMaxLevelReduction: 2 - streamingMipmapsMaxFileIORequests: 1024 - particleRaycastBudget: 4096 - asyncUploadTimeSlice: 2 - asyncUploadBufferSize: 16 - asyncUploadPersistentBuffer: 1 - resolutionScalingFixedDPIFactor: 1 - customRenderPipeline: {fileID: 0} - excludedTargetPlatforms: [] - m_PerPlatformDefaultQuality: - Android: 2 - Lumin: 5 - Nintendo Switch: 5 - PS4: 5 - Stadia: 5 - Standalone: 5 - WebGL: 3 - Windows Store Apps: 5 - XboxOne: 5 - iPhone: 2 - tvOS: 2 diff --git a/ProjectSettings/SceneTemplateSettings.json b/ProjectSettings/SceneTemplateSettings.json deleted file mode 100644 index 6f3e60fd..00000000 --- a/ProjectSettings/SceneTemplateSettings.json +++ /dev/null @@ -1,167 +0,0 @@ -{ - "templatePinStates": [], - "dependencyTypeInfos": [ - { - "userAdded": false, - "type": "UnityEngine.AnimationClip", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEditor.Animations.AnimatorController", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.AnimatorOverrideController", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEditor.Audio.AudioMixerController", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.ComputeShader", - "ignore": true, - "defaultInstantiationMode": 1, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Cubemap", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.GameObject", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEditor.LightingDataAsset", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": false - }, - { - "userAdded": false, - "type": "UnityEngine.LightingSettings", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Material", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEditor.MonoScript", - "ignore": true, - "defaultInstantiationMode": 1, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.PhysicMaterial", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.PhysicsMaterial2D", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Rendering.VolumeProfile", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEditor.SceneAsset", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": false - }, - { - "userAdded": false, - "type": "UnityEngine.Shader", - "ignore": true, - "defaultInstantiationMode": 1, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.ShaderVariantCollection", - "ignore": true, - "defaultInstantiationMode": 1, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Texture", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Texture2D", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - }, - { - "userAdded": false, - "type": "UnityEngine.Timeline.TimelineAsset", - "ignore": false, - "defaultInstantiationMode": 0, - "supportsModification": true - } - ], - "defaultDependencyTypeInfo": { - "userAdded": false, - "type": "", - "ignore": false, - "defaultInstantiationMode": 1, - "supportsModification": true - }, - "newSceneOverride": 0 -} \ No newline at end of file diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset deleted file mode 100644 index 1c92a784..00000000 --- a/ProjectSettings/TagManager.asset +++ /dev/null @@ -1,43 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!78 &1 -TagManager: - serializedVersion: 2 - tags: [] - layers: - - Default - - TransparentFX - - Ignore Raycast - - - - Water - - UI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - m_SortingLayers: - - name: Default - uniqueID: 0 - locked: 0 diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset deleted file mode 100644 index 558a017e..00000000 --- a/ProjectSettings/TimeManager.asset +++ /dev/null @@ -1,9 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!5 &1 -TimeManager: - m_ObjectHideFlags: 0 - Fixed Timestep: 0.02 - Maximum Allowed Timestep: 0.33333334 - m_TimeScale: 1 - Maximum Particle Timestep: 0.03 diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset deleted file mode 100644 index 6125b308..00000000 --- a/ProjectSettings/UnityConnectSettings.asset +++ /dev/null @@ -1,35 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!310 &1 -UnityConnectSettings: - m_ObjectHideFlags: 0 - serializedVersion: 1 - m_Enabled: 0 - m_TestMode: 0 - m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events - m_EventUrl: https://cdp.cloud.unity3d.com/v1/events - m_ConfigUrl: https://config.uca.cloud.unity3d.com - m_DashboardUrl: https://dashboard.unity3d.com - m_TestInitMode: 0 - CrashReportingSettings: - m_EventUrl: https://perf-events.cloud.unity3d.com - m_Enabled: 0 - m_LogBufferSize: 10 - m_CaptureEditorExceptions: 1 - UnityPurchasingSettings: - m_Enabled: 0 - m_TestMode: 0 - UnityAnalyticsSettings: - m_Enabled: 0 - m_TestMode: 0 - m_InitializeOnStartup: 1 - UnityAdsSettings: - m_Enabled: 0 - m_InitializeOnStartup: 1 - m_TestMode: 0 - m_IosGameId: - m_AndroidGameId: - m_GameIds: {} - m_GameId: - PerformanceReportingSettings: - m_Enabled: 0 diff --git a/ProjectSettings/VFXManager.asset b/ProjectSettings/VFXManager.asset deleted file mode 100644 index 46f38e16..00000000 --- a/ProjectSettings/VFXManager.asset +++ /dev/null @@ -1,14 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!937362698 &1 -VFXManager: - m_ObjectHideFlags: 0 - m_IndirectShader: {fileID: 0} - m_CopyBufferShader: {fileID: 0} - m_SortShader: {fileID: 0} - m_StripUpdateShader: {fileID: 0} - m_RenderPipeSettingsPath: - m_FixedTimeStep: 0.016666668 - m_MaxDeltaTime: 0.05 - m_CompiledVersion: 0 - m_RuntimeVersion: 0 diff --git a/ProjectSettings/VersionControlSettings.asset b/ProjectSettings/VersionControlSettings.asset deleted file mode 100644 index dca28814..00000000 --- a/ProjectSettings/VersionControlSettings.asset +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!890905787 &1 -VersionControlSettings: - m_ObjectHideFlags: 0 - m_Mode: Visible Meta Files - m_CollabEditorSettings: - inProgressEnabled: 1 diff --git a/ProjectSettings/XRSettings.asset b/ProjectSettings/XRSettings.asset deleted file mode 100644 index 482590c1..00000000 --- a/ProjectSettings/XRSettings.asset +++ /dev/null @@ -1,10 +0,0 @@ -{ - "m_SettingKeys": [ - "VR Device Disabled", - "VR Device User Alert" - ], - "m_SettingValues": [ - "False", - "False" - ] -} \ No newline at end of file diff --git a/ProjectSettings/boot.config b/ProjectSettings/boot.config deleted file mode 100644 index e69de29b..00000000 diff --git a/README.md b/README.md index abb04c04..a9d7bb03 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,19 @@ -# Tezos Unity SDK +
+ + + +

Tezos Unity SDK

+ +

+ Tezos SDK for Unity +

+ +

+ Intro + Issues + License +

+
The Tezos Unity SDK invites developers to discover the future of Web3 gaming with a complete kit that empowers game developers with the ability to: - Connect to a Tezos wallet @@ -8,4 +23,47 @@ The Tezos Unity SDK invites developers to discover the future of Web3 gaming wit The Tezos SDK supports Desktop, Android, iOS and browsers. Beyond allowing game developers to interact with the Tezos blockchain, this SDK is a helpful resource for developing any Tezos decentralized application (dApp). -Read the documentation at https://opentezos.com/gaming/unity-sdk/ +### Install from a Git URL +Yoy can install the UPM package via directly Git URL. To load a package from a Git URL: + +* Open [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui.html) window. +* Click the add **+** button in the status bar. +* The options for adding packages appear. +* Select Add package from git URL from the add menu. A text box and an Add button appear. +* Enter the `https://github.com/trilitech/tezos-unity-sdk.git` Git URL in the text box and click Add. +* You may also install a specific package version by using the URL with the specified version. + * `https://github.com/trilitech/tezos-unity-sdk.git#X.Y.Z` + * Please note that the version `X.Y.Z` stated here is to be replaced with the version you would like to get. + * You can find all the available releases [here](https://github.com/trilitech/tezos-unity-sdk/releases). + * The latest available release version is [![Last Release](https://img.shields.io/github/v/release/trilitech/tezos-unity-sdk)](https://github.com/trilitech/tezos-unity-sdk/releases/latest) + +For more information about what protocols Unity supports, see [Git URLs](https://docs.unity3d.com/Manual/upm-git.html). + +### Install from NPM +* Navigate to the `Packages` directory of your project. +* Adjust the [project manifest file](https://docs.unity3d.com/Manual/upm-manifestPrj.html) `manifest.json` in a text editor. +* Ensure `https://registry.npmjs.org/` is part of `scopedRegistries`. + * Ensure `com.trilitech` is part of `scopes`. + * Add `com.trilitech.tezos-unity-sdk` to the `dependencies`, stating the latest version. + +A minimal example ends up looking like this. Please note that the version `X.Y.Z` stated here is to be replaced with [the latest released version](https://www.npmjs.com/package/com.trilitech.tezos-unity-sdk) which is currently [![NPM Package](https://img.shields.io/npm/v/com.trilitech.tezos-unity-sdk?color=blue)](https://www.npmjs.com/package/com.trilitech.tezos-unity-sdk). + ```json + { + "scopedRegistries": [ + { + "name": "npmjs", + "url": "https://registry.npmjs.org/", + "scopes": [ + "com.trilitech" + ] + } + ], + "dependencies": { + "com.trilitech.tezos-unity-sdk": "X.Y.Z", + ... + } + } + ``` +* Switch back to the Unity Editor and wait for it to finish importing the added package. + +### 📝 Read the [documentation.](https://opentezos.com/gaming/unity-sdk/) \ No newline at end of file diff --git a/Assets/Scripts/Netezos/obj/project.assets.json.meta b/README.md.meta similarity index 75% rename from Assets/Scripts/Netezos/obj/project.assets.json.meta rename to README.md.meta index f4875767..fdf5ce53 100644 --- a/Assets/Scripts/Netezos/obj/project.assets.json.meta +++ b/README.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ef7c3978cf5054552a4071490aa6c9e2 +guid: 28032f48865d54609bdf339abf9f3351 TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/Data.meta b/Runtime.meta similarity index 77% rename from Assets/Data.meta rename to Runtime.meta index edc8267d..14903f40 100644 --- a/Assets/Data.meta +++ b/Runtime.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2b9028d17b1a1400e8dce6056d177692 +guid: 8ce78082641a1409484bb0680ad68f25 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Data/Wallets.meta b/Runtime/Plugins.meta similarity index 77% rename from Assets/Data/Wallets.meta rename to Runtime/Plugins.meta index cd505c1e..b9e96da7 100644 --- a/Assets/Data/Wallets.meta +++ b/Runtime/Plugins.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 198fa486f5ab84cef94f71e2dd53e0c4 +guid: e3002f7616a3b48f2bd8d76258df1873 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/Plugins/Beacon.Sdk.dll b/Runtime/Plugins/Beacon.Sdk.dll new file mode 100644 index 00000000..6f45aec8 Binary files /dev/null and b/Runtime/Plugins/Beacon.Sdk.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Beacon.Sdk.dll.meta b/Runtime/Plugins/Beacon.Sdk.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Beacon.Sdk.dll.meta rename to Runtime/Plugins/Beacon.Sdk.dll.meta index 187be2a1..ce19d285 100644 --- a/Assets/Plugins/BeaconDotNet/Beacon.Sdk.dll.meta +++ b/Runtime/Plugins/Beacon.Sdk.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c47c15acaeda04c518e438bd1ce284e6 +guid: 085bcabe77aedb34ab3f96d7b3d7505b PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Assets/Plugins/Netezos/BouncyCastle.Crypto.dll b/Runtime/Plugins/BouncyCastle.Crypto.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/BouncyCastle.Crypto.dll rename to Runtime/Plugins/BouncyCastle.Crypto.dll diff --git a/Assets/Plugins/Netezos/BouncyCastle.Crypto.dll.meta b/Runtime/Plugins/BouncyCastle.Crypto.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/BouncyCastle.Crypto.dll.meta rename to Runtime/Plugins/BouncyCastle.Crypto.dll.meta diff --git a/Assets/Plugins/Netezos/Dynamic.Json.dll b/Runtime/Plugins/Dynamic.Json.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/Dynamic.Json.dll rename to Runtime/Plugins/Dynamic.Json.dll diff --git a/Assets/Plugins/Netezos/Dynamic.Json.dll.meta b/Runtime/Plugins/Dynamic.Json.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/Dynamic.Json.dll.meta rename to Runtime/Plugins/Dynamic.Json.dll.meta diff --git a/Assets/Plugins/BeaconDotNet/LiteDB.dll b/Runtime/Plugins/LiteDB.dll similarity index 100% rename from Assets/Plugins/BeaconDotNet/LiteDB.dll rename to Runtime/Plugins/LiteDB.dll diff --git a/Assets/Plugins/BeaconDotNet/LiteDB.dll.meta b/Runtime/Plugins/LiteDB.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/LiteDB.dll.meta rename to Runtime/Plugins/LiteDB.dll.meta index e68d8a07..2642dc28 100644 --- a/Assets/Plugins/BeaconDotNet/LiteDB.dll.meta +++ b/Runtime/Plugins/LiteDB.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a3c328bfc14774f74bf61289ea4d1383 +guid: f222523e128266146b38aa32fecfde7e PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Assets/Plugins/BeaconDotNet/Matrix.Sdk.dll b/Runtime/Plugins/Matrix.Sdk.dll similarity index 98% rename from Assets/Plugins/BeaconDotNet/Matrix.Sdk.dll rename to Runtime/Plugins/Matrix.Sdk.dll index cdbcfdc7..2a43522c 100644 Binary files a/Assets/Plugins/BeaconDotNet/Matrix.Sdk.dll and b/Runtime/Plugins/Matrix.Sdk.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Matrix.Sdk.dll.meta b/Runtime/Plugins/Matrix.Sdk.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Matrix.Sdk.dll.meta rename to Runtime/Plugins/Matrix.Sdk.dll.meta index 0ffa8038..41b2394d 100644 --- a/Assets/Plugins/BeaconDotNet/Matrix.Sdk.dll.meta +++ b/Runtime/Plugins/Matrix.Sdk.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 39821b68bf9ad4cfc879b3204fd5edb9 +guid: fe0544e51330c194190f3d508261e649 PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Assets/Plugins/Netezos/Microsoft.Bcl.AsyncInterfaces.dll b/Runtime/Plugins/Microsoft.Bcl.AsyncInterfaces.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/Microsoft.Bcl.AsyncInterfaces.dll rename to Runtime/Plugins/Microsoft.Bcl.AsyncInterfaces.dll diff --git a/Assets/Plugins/Netezos/Microsoft.Bcl.AsyncInterfaces.dll.meta b/Runtime/Plugins/Microsoft.Bcl.AsyncInterfaces.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/Microsoft.Bcl.AsyncInterfaces.dll.meta rename to Runtime/Plugins/Microsoft.Bcl.AsyncInterfaces.dll.meta diff --git a/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 00000000..88459331 Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta index ebcc205d..96a5dd1c 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 02cef04550a85477fb41913eb6386c3b +guid: e8e61bbce56668f44910e0a87f3cf439 PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.dll b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.dll new file mode 100644 index 00000000..b65e7d1e Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.dll.meta b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.DependencyInjection.dll.meta index a34c4c9f..90f37679 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.DependencyInjection.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.DependencyInjection.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2c36b6928731541a1a7ca3a1caab119a +guid: f9fb36d916208c0418bd9481dd574c8e PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Microsoft.Extensions.Http.dll b/Runtime/Plugins/Microsoft.Extensions.Http.dll new file mode 100644 index 00000000..72ec59d0 Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.Http.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Http.dll.meta b/Runtime/Plugins/Microsoft.Extensions.Http.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Http.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.Http.dll.meta index 56425602..3330b97e 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Http.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.Http.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b7849b442993b47f78e08343d59255b1 +guid: 212af0ef47dea2c4280231d5619985ed PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Microsoft.Extensions.Logging.Abstractions.dll b/Runtime/Plugins/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 00000000..255f793b Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.Logging.Abstractions.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.Abstractions.dll.meta b/Runtime/Plugins/Microsoft.Extensions.Logging.Abstractions.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.Abstractions.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.Logging.Abstractions.dll.meta index 5cd9ce28..96de2aee 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.Abstractions.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.Logging.Abstractions.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8871359d92c424376a290f8263770b97 +guid: 5a4ff98ed77551840a15f13f283f8cc3 PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Microsoft.Extensions.Logging.dll b/Runtime/Plugins/Microsoft.Extensions.Logging.dll new file mode 100644 index 00000000..2fb7f0de Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.Logging.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.dll.meta b/Runtime/Plugins/Microsoft.Extensions.Logging.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.Logging.dll.meta index eeaf95dd..0d19de8d 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Logging.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.Logging.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2f8afdb943d9a4197ba98c93180f32d0 +guid: ff3eac8b8eff78e4ab39957af4e412ce PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Microsoft.Extensions.Options.dll b/Runtime/Plugins/Microsoft.Extensions.Options.dll new file mode 100644 index 00000000..1df78de5 Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.Options.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Options.dll.meta b/Runtime/Plugins/Microsoft.Extensions.Options.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Options.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.Options.dll.meta index c0fea24f..63766cfc 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Options.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.Options.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b3021671beee04a26947b316e118079d +guid: c51953170da360844bc53b605d45997e PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Microsoft.Extensions.Primitives.dll b/Runtime/Plugins/Microsoft.Extensions.Primitives.dll new file mode 100644 index 00000000..dfbf207d Binary files /dev/null and b/Runtime/Plugins/Microsoft.Extensions.Primitives.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Primitives.dll.meta b/Runtime/Plugins/Microsoft.Extensions.Primitives.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Primitives.dll.meta rename to Runtime/Plugins/Microsoft.Extensions.Primitives.dll.meta index ab1ea962..4366354d 100644 --- a/Assets/Plugins/BeaconDotNet/Microsoft.Extensions.Primitives.dll.meta +++ b/Runtime/Plugins/Microsoft.Extensions.Primitives.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0f83de923cb904aeb839bbc5094cf73a +guid: 4091a129c70ee2d4e84a8bd04df60df6 PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Assets/Plugins/BeaconDotNet/NaCl.dll b/Runtime/Plugins/NaCl.dll similarity index 100% rename from Assets/Plugins/BeaconDotNet/NaCl.dll rename to Runtime/Plugins/NaCl.dll diff --git a/Assets/Plugins/BeaconDotNet/NaCl.dll.meta b/Runtime/Plugins/NaCl.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/NaCl.dll.meta rename to Runtime/Plugins/NaCl.dll.meta index 13f2a07b..ad16f3dc 100644 --- a/Assets/Plugins/BeaconDotNet/NaCl.dll.meta +++ b/Runtime/Plugins/NaCl.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 79d8d6735c88bbc47a4c026cca0c9f3d +guid: 0621e6b35ef8dba4691b392bc55011db PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Runtime/Plugins/Netezos.dll b/Runtime/Plugins/Netezos.dll new file mode 100644 index 00000000..98189808 Binary files /dev/null and b/Runtime/Plugins/Netezos.dll differ diff --git a/Assets/Plugins/BeaconDotNet/Netezos.dll.meta b/Runtime/Plugins/Netezos.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/Netezos.dll.meta rename to Runtime/Plugins/Netezos.dll.meta index aa441a79..1027fb28 100644 --- a/Assets/Plugins/BeaconDotNet/Netezos.dll.meta +++ b/Runtime/Plugins/Netezos.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e84f9826fc0cc446ea3772f22e4c7c46 +guid: c190dc79ea613554a8b027828581b92d PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Assets/Plugins/Netezos/System.Buffers.dll b/Runtime/Plugins/System.Buffers.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Buffers.dll rename to Runtime/Plugins/System.Buffers.dll diff --git a/Assets/Plugins/Netezos/System.Buffers.dll.meta b/Runtime/Plugins/System.Buffers.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Buffers.dll.meta rename to Runtime/Plugins/System.Buffers.dll.meta diff --git a/Runtime/Plugins/System.Diagnostics.DiagnosticSource.dll b/Runtime/Plugins/System.Diagnostics.DiagnosticSource.dll new file mode 100644 index 00000000..f5e03b28 Binary files /dev/null and b/Runtime/Plugins/System.Diagnostics.DiagnosticSource.dll differ diff --git a/Assets/Plugins/BeaconDotNet/System.Diagnostics.DiagnosticSource.dll.meta b/Runtime/Plugins/System.Diagnostics.DiagnosticSource.dll.meta similarity index 91% rename from Assets/Plugins/BeaconDotNet/System.Diagnostics.DiagnosticSource.dll.meta rename to Runtime/Plugins/System.Diagnostics.DiagnosticSource.dll.meta index 37b4c7ee..1898b0f2 100644 --- a/Assets/Plugins/BeaconDotNet/System.Diagnostics.DiagnosticSource.dll.meta +++ b/Runtime/Plugins/System.Diagnostics.DiagnosticSource.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0f70960af8e294dccbff86c1656ea7fa +guid: b18883cdc51b8064c8352cb805b8e2d4 PluginImporter: externalObjects: {} serializedVersion: 2 @@ -7,7 +7,7 @@ PluginImporter: executionOrder: {} defineConstraints: [] isPreloaded: 0 - isOverridable: 0 + isOverridable: 1 isExplicitlyReferenced: 0 validateReferences: 1 platformData: diff --git a/Assets/Plugins/Netezos/System.Memory.dll b/Runtime/Plugins/System.Memory.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Memory.dll rename to Runtime/Plugins/System.Memory.dll diff --git a/Assets/Plugins/Netezos/System.Memory.dll.meta b/Runtime/Plugins/System.Memory.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Memory.dll.meta rename to Runtime/Plugins/System.Memory.dll.meta diff --git a/Assets/Plugins/Netezos/System.Numerics.Vectors.dll b/Runtime/Plugins/System.Numerics.Vectors.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Numerics.Vectors.dll rename to Runtime/Plugins/System.Numerics.Vectors.dll diff --git a/Assets/Plugins/Netezos/System.Numerics.Vectors.dll.meta b/Runtime/Plugins/System.Numerics.Vectors.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Numerics.Vectors.dll.meta rename to Runtime/Plugins/System.Numerics.Vectors.dll.meta diff --git a/Assets/Plugins/BeaconDotNet/System.Reflection.TypeExtensions.dll b/Runtime/Plugins/System.Reflection.TypeExtensions.dll similarity index 100% rename from Assets/Plugins/BeaconDotNet/System.Reflection.TypeExtensions.dll rename to Runtime/Plugins/System.Reflection.TypeExtensions.dll diff --git a/Assets/Plugins/BeaconDotNet/System.Reflection.TypeExtensions.dll.meta b/Runtime/Plugins/System.Reflection.TypeExtensions.dll.meta similarity index 100% rename from Assets/Plugins/BeaconDotNet/System.Reflection.TypeExtensions.dll.meta rename to Runtime/Plugins/System.Reflection.TypeExtensions.dll.meta diff --git a/Assets/Plugins/Netezos/System.Runtime.CompilerServices.Unsafe.dll b/Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Runtime.CompilerServices.Unsafe.dll rename to Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll diff --git a/Assets/Plugins/Netezos/System.Runtime.CompilerServices.Unsafe.dll.meta b/Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Runtime.CompilerServices.Unsafe.dll.meta rename to Runtime/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta diff --git a/Assets/Plugins/Netezos/System.Text.Encodings.Web.dll b/Runtime/Plugins/System.Text.Encodings.Web.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Text.Encodings.Web.dll rename to Runtime/Plugins/System.Text.Encodings.Web.dll diff --git a/Assets/Plugins/Netezos/System.Text.Encodings.Web.dll.meta b/Runtime/Plugins/System.Text.Encodings.Web.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Text.Encodings.Web.dll.meta rename to Runtime/Plugins/System.Text.Encodings.Web.dll.meta diff --git a/Assets/Plugins/Netezos/System.Text.Json.dll b/Runtime/Plugins/System.Text.Json.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Text.Json.dll rename to Runtime/Plugins/System.Text.Json.dll diff --git a/Assets/Plugins/Netezos/System.Text.Json.dll.meta b/Runtime/Plugins/System.Text.Json.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Text.Json.dll.meta rename to Runtime/Plugins/System.Text.Json.dll.meta diff --git a/Assets/Plugins/Netezos/System.Threading.Tasks.Extensions.dll b/Runtime/Plugins/System.Threading.Tasks.Extensions.dll old mode 100755 new mode 100644 similarity index 100% rename from Assets/Plugins/Netezos/System.Threading.Tasks.Extensions.dll rename to Runtime/Plugins/System.Threading.Tasks.Extensions.dll diff --git a/Assets/Plugins/Netezos/System.Threading.Tasks.Extensions.dll.meta b/Runtime/Plugins/System.Threading.Tasks.Extensions.dll.meta similarity index 100% rename from Assets/Plugins/Netezos/System.Threading.Tasks.Extensions.dll.meta rename to Runtime/Plugins/System.Threading.Tasks.Extensions.dll.meta diff --git a/Assets/Plugins/Android.meta b/Runtime/Scripts.meta similarity index 77% rename from Assets/Plugins/Android.meta rename to Runtime/Scripts.meta index 128e6b19..30cd2129 100644 --- a/Assets/Plugins/Android.meta +++ b/Runtime/Scripts.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a1539625ccf016c4ca9e4e08861e56f2 +guid: ad6e63baafaefd94ea423508a839a691 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Scripts/BeaconSDK.meta b/Runtime/Scripts/BeaconSDK.meta similarity index 77% rename from Assets/Scripts/BeaconSDK.meta rename to Runtime/Scripts/BeaconSDK.meta index a8afc722..050a9c56 100644 --- a/Assets/Scripts/BeaconSDK.meta +++ b/Runtime/Scripts/BeaconSDK.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ca528ac6a5d9f824881b2088baf42066 +guid: 70bd658543b8c471ebda59d692eb6247 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorDotNet.cs b/Runtime/Scripts/BeaconSDK/BeaconConnectorDotNet.cs similarity index 61% rename from Assets/Scripts/BeaconSDK/BeaconConnectorDotNet.cs rename to Runtime/Scripts/BeaconSDK/BeaconConnectorDotNet.cs index c5a3f311..849240c9 100644 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorDotNet.cs +++ b/Runtime/Scripts/BeaconSDK/BeaconConnectorDotNet.cs @@ -1,9 +1,7 @@ using System; -//using UnityEngine; -using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; -using System.Runtime.InteropServices; using Beacon.Sdk; using Beacon.Sdk.Beacon; using Beacon.Sdk.Beacon.Operation; @@ -17,19 +15,14 @@ using Newtonsoft.Json.Linq; using UnityEngine; using ILogger = Microsoft.Extensions.Logging.ILogger; +using LogLevel = Microsoft.Extensions.Logging.LogLevel; namespace BeaconSDK { public class BeaconConnectorDotNet : IBeaconConnector { private static BeaconMessageReceiver _messageReceiver; - private DappBeaconClient BeaconDappClient { get; set; } - - private PermissionResponse _permission; - private string _address; - - const string DbPath = "dapp-sample.db"; - + private DappBeaconClient _beaconDappClient { get; set; } private string _network; private string _rpc; @@ -37,56 +30,54 @@ public class BeaconConnectorDotNet : IBeaconConnector public async void ConnectAccount() { + var pathToDb = Path.Combine(Application.persistentDataPath, "beacon.db"); + Debug.Log($"DB file stored in {pathToDb}"); + var options = new BeaconOptions { AppName = "Tezos Unity SDK", AppUrl = "https://tezos.com/unity", IconUrl = "https://unity.com/sites/default/files/2022-09/unity-tab-small.png", KnownRelayServers = Constants.KnownRelayServers, - - DatabaseConnectionString = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? $"Filename={DbPath}; Connection=Shared;" - : $"Filename={DbPath}; Mode=Exclusive;" + DatabaseConnectionString = $"Filename={pathToDb};Connection=direct;Upgrade=true" }; - BeaconDappClient = - (DappBeaconClient)BeaconClientFactory.Create(options, new MyLoggerProvider()); - BeaconDappClient.OnBeaconMessageReceived += OnBeaconDappClientMessageReceived; - + _beaconDappClient = (DappBeaconClient)BeaconClientFactory + .Create(options, new MyLoggerProvider()); + _beaconDappClient.OnBeaconMessageReceived += OnBeaconDappClientMessageReceived; - await BeaconDappClient.InitAsync(); - Debug.Log("Dapp initialized"); - BeaconDappClient.Connect(); - Debug.Log("Dapp connected"); + await _beaconDappClient.InitAsync(); + Debug.Log($"Dapp initialized: {_beaconDappClient.LoggedIn}"); + _beaconDappClient.Connect(); + Debug.Log($"Dapp connected: {_beaconDappClient.Connected}"); - - string pairingRequestQrData = BeaconDappClient.GetPairingRequestInfo(); - _messageReceiver.OnHandshakeReceived(pairingRequestQrData); - - - // Sign-on feature. Disabled for feature parity and making the user to log in every time - /* - var activePeer = BeaconDappClient.GetActivePeer().Result; - - if (activePeer != null) + var activeAccountPermissions = _beaconDappClient.GetActiveAccount(); + if (activeAccountPermissions != null) { - var permissions = BeaconDappClient - .PermissionInfoRepository - .TryReadBySenderIdAsync(activePeer.SenderId) - .Result; - - var permissionsString = permissions?.Scopes.Aggregate(string.Empty, + var permissionsString = activeAccountPermissions.Scopes.Aggregate(string.Empty, (res, scope) => res + $"{scope}, ") ?? string.Empty; - - Debug.Log($"We have active peer {activePeer.Name} with permissions {permissionsString}"); + Debug.Log( + $"We have active peer {activeAccountPermissions.AppMetadata.Name} with permissions {permissionsString}"); + + UnityMainThreadDispatcher.Enqueue( + _messageReceiver.OnAccountConnected, + new JObject + { + ["account"] = new JObject + { + ["address"] = activeAccountPermissions.Address, + ["publicKey"] = activeAccountPermissions.PublicKey + } + }.ToString()); + } + else + { + var pairingRequestQrData = _beaconDappClient.GetPairingRequestInfo(); + _messageReceiver.OnHandshakeReceived(pairingRequestQrData); } - */ } - public string GetActiveAccountAddress() - { - return _address; - } + public string GetActiveAccountAddress() => _beaconDappClient?.GetActiveAccount()?.Address ?? string.Empty; public void RequestHandshake() { @@ -94,6 +85,10 @@ public void RequestHandshake() public void DisconnectAccount() { + _beaconDappClient.RemoveActiveAccounts(); + var pairingRequestQrData = _beaconDappClient.GetPairingRequestInfo(); + _messageReceiver.OnHandshakeReceived(pairingRequestQrData); + UnityMainThreadDispatcher.Enqueue(_messageReceiver.OnAccountDisconnected, string.Empty); } public void SetNetwork(string network, string rpc) @@ -111,7 +106,7 @@ public async void RequestTezosPermission(string networkName = "", string network { if (!Enum.TryParse(networkName, out Beacon.Sdk.Beacon.Permission.NetworkType networkType)) networkType = Beacon.Sdk.Beacon.Permission.NetworkType.ghostnet; - + var network = new Beacon.Sdk.Beacon.Permission.Network { Type = networkType, @@ -129,18 +124,16 @@ public async void RequestTezosPermission(string networkName = "", string network type: BeaconMessageType.permission_request, version: Constants.BeaconVersion, id: KeyPairService.CreateGuid(), - senderId: BeaconDappClient.SenderId, - appMetadata: BeaconDappClient.Metadata, + senderId: _beaconDappClient.SenderId, + appMetadata: _beaconDappClient.Metadata, network: network, scopes: permissionScopes ); - // this could also be just cached from Pairing Complete - var peer = BeaconDappClient.GetActivePeer(); - - if (peer != null) + var activePeer = _beaconDappClient.GetActivePeer(); + if (activePeer != null) { - await BeaconDappClient.SendResponseAsync(peer.SenderId, permissionRequest); + await _beaconDappClient.SendResponseAsync(activePeer.SenderId, permissionRequest); Debug.Log("Permission request sent"); } else @@ -166,62 +159,48 @@ public async void RequestTezosOperation(string destination, string entryPoint = operationDetails.Add(partialTezosTransactionOperation); - var peer = BeaconDappClient.GetActivePeer(); - if (peer == null) - { - Debug.LogError("No active peer"); - return; - } - - if (_permission == null) + var activeAccountPermissions = _beaconDappClient.GetActiveAccount(); + if (activeAccountPermissions == null) { Debug.LogError("No active permissions"); return; } - var pubKey = PubKey.FromBase58(_permission.PublicKey); + var pubKey = PubKey.FromBase58(activeAccountPermissions.PublicKey); var operationRequest = new OperationRequest( type: BeaconMessageType.operation_request, version: Constants.BeaconVersion, id: KeyPairService.CreateGuid(), - senderId: BeaconDappClient.SenderId, - network: _permission.Network, + senderId: _beaconDappClient.SenderId, + network: activeAccountPermissions.Network, operationDetails: operationDetails, sourceAddress: pubKey.Address); Debug.Log("requesting operation: " + operationRequest); - await BeaconDappClient.SendResponseAsync(peer.SenderId, operationRequest); + await _beaconDappClient.SendResponseAsync(activeAccountPermissions.SenderId, operationRequest); } public async void RequestTezosSignPayload(int signingType, string payload) { - var peer = BeaconDappClient.GetActivePeer(); - if (peer == null) + var activeAccountPermissions = _beaconDappClient.GetActiveAccount(); + if (activeAccountPermissions == null) { - Debug.LogError("No active peer"); - return; - } - - - if (_permission == null) - { - Debug.LogError("No active permissions"); - // _permission = await BeaconDappClient.PermissionInfoRepository.TryReadBySenderIdAsync(peer.SenderId); + Debug.LogError("No active account permissions"); return; } - var pubKey = PubKey.FromBase58(_permission.PublicKey); + var pubKey = PubKey.FromBase58(activeAccountPermissions.PublicKey); var signPayloadRequest = new SignPayloadRequest( id: KeyPairService.CreateGuid(), version: Constants.BeaconVersion, - senderId: BeaconDappClient.SenderId, + senderId: _beaconDappClient.SenderId, signingType: SignPayloadType.raw, payload: payload, sourceAddress: pubKey.Address); - await BeaconDappClient.SendResponseAsync(peer.SenderId, signPayloadRequest); + await _beaconDappClient.SendResponseAsync(activeAccountPermissions.SenderId, signPayloadRequest); } public void RequestTezosBroadcast(string signedTransaction, string networkName = "", string networkRPC = "") @@ -232,23 +211,11 @@ public void RequestTezosBroadcast(string signedTransaction, string networkName = #region BeaconSDK - private IEnumerator OnAccountConnectedMainThread(Action function, string parameter) - { - yield return null; - function.Invoke(parameter); - } - - private async void OnBeaconDappClientMessageReceived(object? sender, BeaconMessageEventArgs e) + private async void OnBeaconDappClientMessageReceived(object sender, BeaconMessageEventArgs e) { if (e.PairingDone) { - var peer = BeaconDappClient.GetActivePeer(); - if (peer == null) return; - - Debug.Log("Paired. Active peer: " + peer.Name); _messageReceiver.OnPairingCompleted("paired"); - //_messageReceiver.SendMessage("OnPairingCompleted", "paired"); - return; } @@ -262,25 +229,20 @@ private async void OnBeaconDappClientMessageReceived(object? sender, BeaconMessa var permissionsString = permissionResponse.Scopes.Aggregate(string.Empty, (res, scope) => res + $"{scope}, "); - Debug.Log( - $"{BeaconDappClient.AppName} received permissions {permissionsString} from {permissionResponse.AppMetadata.Name} with public key {permissionResponse.PublicKey}" - ); + $"{_beaconDappClient.AppName} received permissions {permissionsString} from {permissionResponse.AppMetadata.Name} with public key {permissionResponse.PublicKey}"); - _permission = permissionResponse; - _address = PubKey.FromBase58(_permission.PublicKey).Address; - - UnityMainThreadDispatcher.Instance().Enqueue(OnAccountConnectedMainThread( + UnityMainThreadDispatcher.Enqueue( _messageReceiver.OnAccountConnected, //permissionResponse.PublicKey); new JObject { ["account"] = new JObject { - ["address"] = _address, + ["address"] = PubKey.FromBase58(permissionResponse.PublicKey).Address, ["publicKey"] = permissionResponse.PublicKey } - }.ToString()) - ); + }.ToString()); + break; } @@ -289,13 +251,13 @@ private async void OnBeaconDappClientMessageReceived(object? sender, BeaconMessa if (message is not OperationResponse operationResponse) return; - UnityMainThreadDispatcher.Instance().Enqueue(OnAccountConnectedMainThread( - _messageReceiver.OnContractCallCompleted, //operationResponse.TransactionHash); + UnityMainThreadDispatcher.Enqueue( + _messageReceiver.OnContractCallInjected, //operationResponse.TransactionHash); new JObject { - ["transactionHash"] = operationResponse.TransactionHash - }.ToString()) - ); + ["transactionHash"] = operationResponse.TransactionHash, + ["success"] = "true" + }.ToString()); Debug.Log($"Operation completed with transaction hash {operationResponse.TransactionHash}"); break; @@ -306,7 +268,7 @@ private async void OnBeaconDappClientMessageReceived(object? sender, BeaconMessa if (message is not SignPayloadResponse signPayloadResponse) return; - var senderPermissions = await BeaconDappClient + var senderPermissions = await _beaconDappClient .PermissionInfoRepository .TryReadBySenderIdAsync(signPayloadResponse.SenderId); if (senderPermissions == null) return; @@ -316,15 +278,7 @@ private async void OnBeaconDappClientMessageReceived(object? sender, BeaconMessa { ["signature"] = signPayloadResponse.Signature }.ToString()); -/* - var pubKey = PubKey.FromBase58(senderPermissions.PublicKey); - var payloadBytes = Hex.Parse(PayloadToSign); - var verified = pubKey.Verify(payloadBytes, signPayloadResponse.Signature); - var stringVerifyResult = verified ? "Successfully" : "Unsuccessfully"; - - Debug.Log( - $"{stringVerifyResult} signed payload by {senderPermissions.AppMetadata.Name}, signature is {signPayloadResponse.Signature}"); -*/ + break; } } diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorDotNet.cs.meta b/Runtime/Scripts/BeaconSDK/BeaconConnectorDotNet.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/BeaconConnectorDotNet.cs.meta rename to Runtime/Scripts/BeaconSDK/BeaconConnectorDotNet.cs.meta index 0a38ed5e..f659b56c 100644 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorDotNet.cs.meta +++ b/Runtime/Scripts/BeaconSDK/BeaconConnectorDotNet.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a8aa2cbe169654e1489997d97a12f36c +guid: 622c110bf536d4650878682095f685a8 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorNull.cs b/Runtime/Scripts/BeaconSDK/BeaconConnectorNull.cs similarity index 94% rename from Assets/Scripts/BeaconSDK/BeaconConnectorNull.cs rename to Runtime/Scripts/BeaconSDK/BeaconConnectorNull.cs index d6ada7f9..8ffa09f6 100644 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorNull.cs +++ b/Runtime/Scripts/BeaconSDK/BeaconConnectorNull.cs @@ -1,3 +1,4 @@ +using BeaconSDK; using UnityEngine; namespace BeaconSDK @@ -14,10 +15,10 @@ public void ConnectAccount() Debug.LogError("Platform not supported"); } - public void SetQRCodeView(QRCodeView qRCodeView) - { - Debug.LogError("Platform not supported"); - } + // public void SetQRCodeView(QRCodeView qRCodeView) + // { + // Debug.LogError("Platform not supported"); + // } public void SetBeaconMessageReceiver(BeaconMessageReceiver messageReceiver) { diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorNull.cs.meta b/Runtime/Scripts/BeaconSDK/BeaconConnectorNull.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/BeaconConnectorNull.cs.meta rename to Runtime/Scripts/BeaconSDK/BeaconConnectorNull.cs.meta index 7779bd1d..300231aa 100644 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorNull.cs.meta +++ b/Runtime/Scripts/BeaconSDK/BeaconConnectorNull.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 11922280baf0a4647bd9f8b621e4ad01 +guid: e900d35aa0b7e4e2baa007e415dcd626 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorWebGl.cs b/Runtime/Scripts/BeaconSDK/BeaconConnectorWebGl.cs similarity index 100% rename from Assets/Scripts/BeaconSDK/BeaconConnectorWebGl.cs rename to Runtime/Scripts/BeaconSDK/BeaconConnectorWebGl.cs diff --git a/Assets/Scripts/BeaconSDK/BeaconConnectorWebGl.cs.meta b/Runtime/Scripts/BeaconSDK/BeaconConnectorWebGl.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/BeaconConnectorWebGl.cs.meta rename to Runtime/Scripts/BeaconSDK/BeaconConnectorWebGl.cs.meta index 33682dfa..261657c5 100644 --- a/Assets/Scripts/BeaconSDK/BeaconConnectorWebGl.cs.meta +++ b/Runtime/Scripts/BeaconSDK/BeaconConnectorWebGl.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d5973ccbcdb9b48a6a28c09daedd23b4 +guid: 2dbc3e7084e3847868de63dc8009d06d MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BeaconSDK/BeaconEnums.cs b/Runtime/Scripts/BeaconSDK/BeaconEnums.cs similarity index 100% rename from Assets/Scripts/BeaconSDK/BeaconEnums.cs rename to Runtime/Scripts/BeaconSDK/BeaconEnums.cs diff --git a/Assets/Scripts/BeaconSDK/BeaconEnums.cs.meta b/Runtime/Scripts/BeaconSDK/BeaconEnums.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/BeaconEnums.cs.meta rename to Runtime/Scripts/BeaconSDK/BeaconEnums.cs.meta index 9d9d030c..1e7f0213 100644 --- a/Assets/Scripts/BeaconSDK/BeaconEnums.cs.meta +++ b/Runtime/Scripts/BeaconSDK/BeaconEnums.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 94e0ee5147b1c43788f15981199124da +guid: 862e3be1e067146b9a5dd0d760892495 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/Scripts/BeaconSDK/BeaconMessageReceiver.cs b/Runtime/Scripts/BeaconSDK/BeaconMessageReceiver.cs new file mode 100644 index 00000000..094c136d --- /dev/null +++ b/Runtime/Scripts/BeaconSDK/BeaconMessageReceiver.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections; +using System.Text.Json; +using UnityEngine; +using UnityEngine.Networking; + +namespace BeaconSDK +{ + /// + /// Receives external messages + /// + + public class BeaconMessageReceiver : MonoBehaviour + { + public event Action ClientCreated; + public event Action AccountConnected; + public event Action AccountConnectionFailed; + public event Action AccountDisconnected; + public event Action ContractCallCompleted; + public event Action ContractCallInjected; + public event Action ContractCallFailed; + public event Action PayloadSigned; + public event Action HandshakeReceived; + public event Action PairingCompleted; + public event Action AccountReceived; + + public void OnClientCreated(string result) + { + Debug.LogWarning("From unity, OnClientCreated: " + result); + ClientCreated?.Invoke(result); + } + + public void OnAccountConnected(string address) + { + // result is the json permission response + Debug.Log("From unity, OnAccountConnected: " + address); + AccountConnected?.Invoke(address); + } + + public void OnAccountFailedToConnect(string result) + { + // result is the json error + Debug.Log("From unity, OnAccountFailedToConnect: " + result); + AccountConnectionFailed?.Invoke(result); + } + + public void OnAccountDisconnected(string result) + { + Debug.Log("From unity, OnAccountDisconnect: " + result); + AccountDisconnected?.Invoke(result); + } + + public void OnContractCallCompleted(string result) + { + // result is the json of transaction response + Debug.Log("From unity, OnContractCallCompleted: " + result); + ContractCallCompleted?.Invoke(result); + } + + public void OnContractCallInjected(string result) + { + // result is the json of transaction response + Debug.Log("From unity, OnContractCallInjected: " + result); + ContractCallInjected?.Invoke(result); + } + + [Serializable] + struct ContractCallInjectionResult + { + public bool success; + public string transactionHash; + } + + public IEnumerator ContractCallInjection(string uri, string transactionHash) + { + var success = false; + var timeout = 30f; // seconds + var timestamp = Time.time; + Debug.Log("Operation injected into blockchain"); + + // keep making requests until time out or success + while (!success && Time.time - timestamp < timeout) + { + uri = string.Format(uri, transactionHash); + Debug.Log("WebRequest into " + uri); + using var webRequest = UnityWebRequest.Get(uri); + yield return webRequest.SendWebRequest(); + var resultText = webRequest.downloadHandler.text; + + if (!string.IsNullOrEmpty(webRequest.error)) + { + Debug.LogError(webRequest.error); + break; + } + + if (!string.IsNullOrEmpty(resultText)) + { + success = JsonSerializer.Deserialize(resultText); + } + + yield return new WaitForSecondsRealtime(3); + } + + ContractCallInjectionResult result; + result.success = success; + result.transactionHash = transactionHash; + Debug.Log($"Operation completed with success: {success}"); + ContractCallCompleted?.Invoke(JsonUtility.ToJson(result)); + } + + public void OnContractCallFailed(string result) + { + // result is error or empty + Debug.Log("From unity, OnContractCallFailed: " + result); + ContractCallFailed?.Invoke(result); + } + + public void OnPayloadSigned(string signature) + { + // result is the json string of payload signing result + Debug.Log("From unity, OnPayloadSigned: " + signature); + PayloadSigned?.Invoke(signature); + } + + public void OnHandshakeReceived(string handshake) + { + // result is serialized p2p pairing request + Debug.Log("From unity, OnHandshakeReceived: " + handshake); + HandshakeReceived?.Invoke(handshake); + } + + public void OnPairingCompleted(string message) + { + Debug.Log("From unity, OnPairingCompleted: " + message); + PairingCompleted?.Invoke(message); + } + + public void OnAccountReceived(string message) + { + Debug.Log("From unity, OnAccountReceived: " + message); + AccountReceived?.Invoke(message); + } + } +} diff --git a/Assets/Scripts/BeaconSDK/BeaconMessageReceiver.cs.meta b/Runtime/Scripts/BeaconSDK/BeaconMessageReceiver.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/BeaconMessageReceiver.cs.meta rename to Runtime/Scripts/BeaconSDK/BeaconMessageReceiver.cs.meta index 0b643a0f..374c30ef 100644 --- a/Assets/Scripts/BeaconSDK/BeaconMessageReceiver.cs.meta +++ b/Runtime/Scripts/BeaconSDK/BeaconMessageReceiver.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 38c5ead774b0d4a3caf5c62a8edf7c03 +guid: 33c9bb56e8c5b4bc5912aa677707c0be MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BeaconSDK/BeaconWebGLReceiver.cs b/Runtime/Scripts/BeaconSDK/BeaconWebGLReceiver.cs similarity index 100% rename from Assets/Scripts/BeaconSDK/BeaconWebGLReceiver.cs rename to Runtime/Scripts/BeaconSDK/BeaconWebGLReceiver.cs diff --git a/Assets/Scripts/BeaconSDK/BeaconWebGLReceiver.cs.meta b/Runtime/Scripts/BeaconSDK/BeaconWebGLReceiver.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/BeaconWebGLReceiver.cs.meta rename to Runtime/Scripts/BeaconSDK/BeaconWebGLReceiver.cs.meta index 7abbd7a6..d60830ae 100644 --- a/Assets/Scripts/BeaconSDK/BeaconWebGLReceiver.cs.meta +++ b/Runtime/Scripts/BeaconSDK/BeaconWebGLReceiver.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 49178ab61a9a2ea40849095fea9857e2 +guid: 2cfa3df2234974641a4420edfccb5831 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BeaconSDK/IBeaconConnector.cs b/Runtime/Scripts/BeaconSDK/IBeaconConnector.cs similarity index 100% rename from Assets/Scripts/BeaconSDK/IBeaconConnector.cs rename to Runtime/Scripts/BeaconSDK/IBeaconConnector.cs diff --git a/Assets/Scripts/BeaconSDK/IBeaconConnector.cs.meta b/Runtime/Scripts/BeaconSDK/IBeaconConnector.cs.meta similarity index 83% rename from Assets/Scripts/BeaconSDK/IBeaconConnector.cs.meta rename to Runtime/Scripts/BeaconSDK/IBeaconConnector.cs.meta index bda5c34c..c4ec849d 100644 --- a/Assets/Scripts/BeaconSDK/IBeaconConnector.cs.meta +++ b/Runtime/Scripts/BeaconSDK/IBeaconConnector.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f23f7d6e99dfb45f89fc9a9ddb32f869 +guid: 2fc7a8115a3ba45a691d71a19b4bede7 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Helpers.meta b/Runtime/Scripts/Helpers.meta similarity index 77% rename from Assets/Scripts/Helpers.meta rename to Runtime/Scripts/Helpers.meta index ef8d1c0e..3d8ba651 100644 --- a/Assets/Scripts/Helpers.meta +++ b/Runtime/Scripts/Helpers.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 26c817c5804414eb2afde5fcae059540 +guid: 3d6af1e9b8fd983459fcfd86cc42a253 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/Scripts/Helpers/CoroutineWrapper.cs b/Runtime/Scripts/Helpers/CoroutineWrapper.cs new file mode 100644 index 00000000..5a053885 --- /dev/null +++ b/Runtime/Scripts/Helpers/CoroutineWrapper.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections; +using UnityEngine; + +/// +/// Wraps a coroutine allowing to extract the result when it's completed +/// +/// Type of result expected +public class CoroutineWrapper : IEnumerator +{ + /// + /// Event raised when the coroutine is complete + /// + public readonly Action Completed; + + private readonly IEnumerator _targetCoroutine; + + /// + /// Exception triggered during the execution of the coroutine. + /// + public Exception Exception { get; private set; } + + /// + public object Current { get; private set; } + + /// + /// Result extracted from the coroutine when it's complete + /// + public T Result { get; private set; } + + /// + /// Create an instance of the wrapper + /// + /// Coroutine that will be executed + /// Callback that will be called when the coroutine is complete + public CoroutineWrapper(IEnumerator coroutine, Action callback = null) + { + _targetCoroutine = coroutine; + if (callback != null) + { + Completed += callback; + } + } + + /// + public bool MoveNext() + { + try + { + if (_targetCoroutine.MoveNext()) + { + Current = _targetCoroutine.Current; + return true; + } + + Result = (T)_targetCoroutine.Current; + Current = _targetCoroutine.Current; + Completed?.Invoke(Result); + return false; + } + catch (Exception e) + { + Debug.LogError("Exception " + e.Message); + Exception = e; + Completed?.Invoke(default); + return false; + } + } + + /// + public void Reset() + { + _targetCoroutine.Reset(); + } +} + +/// +/// Helper class that will allow to run a coroutine +/// +public class CoroutineRunner : MonoBehaviour +{ + private static CoroutineRunner _instance; + + public static CoroutineRunner Instance + { + get + { + if (_instance == null) + _instance = (new GameObject("CoroutineRunner")).AddComponent(); + + return _instance; + } + } + + private void Awake() + { + DontDestroyOnLoad(gameObject); + } +} \ No newline at end of file diff --git a/Assets/Plugins/iOS/Editor/SwiftPostProcess.cs.meta b/Runtime/Scripts/Helpers/CoroutineWrapper.cs.meta similarity index 83% rename from Assets/Plugins/iOS/Editor/SwiftPostProcess.cs.meta rename to Runtime/Scripts/Helpers/CoroutineWrapper.cs.meta index 2c63cbd1..e602a490 100644 --- a/Assets/Plugins/iOS/Editor/SwiftPostProcess.cs.meta +++ b/Runtime/Scripts/Helpers/CoroutineWrapper.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4bcf616ec53b34c02ac3feb77bb66de1 +guid: 39830bc66b1aa4e8ca77da851c0a25ff MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Netezos/Utils/Json/SnakeCaseNamingPolicy.cs b/Runtime/Scripts/Helpers/Json.cs similarity index 63% rename from Assets/Scripts/Netezos/Utils/Json/SnakeCaseNamingPolicy.cs rename to Runtime/Scripts/Helpers/Json.cs index 7bb0772a..6f89d2ad 100644 --- a/Assets/Scripts/Netezos/Utils/Json/SnakeCaseNamingPolicy.cs +++ b/Runtime/Scripts/Helpers/Json.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text.Json; -namespace Netezos +namespace Helpers { class SnakeCaseNamingPolicy : JsonNamingPolicy { @@ -33,4 +33,16 @@ public override string ConvertName(string name) return new string(buf.ToArray()); } } -} + + public static class JsonOptions + { + public static readonly JsonSerializerOptions DefaultOptions = new() + { + AllowTrailingCommas = true, + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + MaxDepth = 100_000, + NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString, + PropertyNamingPolicy = new SnakeCaseNamingPolicy() + }; + } +} \ No newline at end of file diff --git a/Runtime/Scripts/Helpers/Json.cs.meta b/Runtime/Scripts/Helpers/Json.cs.meta new file mode 100644 index 00000000..11eff1ad --- /dev/null +++ b/Runtime/Scripts/Helpers/Json.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b338693682de4db0924bda92e4d298b1 +timeCreated: 1679571311 \ No newline at end of file diff --git a/Runtime/Scripts/Helpers/NetezosExtensions.cs b/Runtime/Scripts/Helpers/NetezosExtensions.cs new file mode 100644 index 00000000..a5f429d7 --- /dev/null +++ b/Runtime/Scripts/Helpers/NetezosExtensions.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Netezos.Contracts; +using Netezos.Encoding; +using Netezos.Rpc; +using UnityEngine; +using Netezos.Keys; +using TezosAPI; + + +namespace BeaconSDK +{ + public static class NetezosExtensions + { + private static readonly Dictionary _contracts = new(); + + public static IEnumerator ReadTZBalance(string rpcUri, string sender, Action callback) + { + var rpc = new Rpc(rpcUri); + var getBalanceRequest = rpc.GetTzBalance(sender); + return RpcRequest(getBalanceRequest, callback); + } + + public static IEnumerator ReadView(string rpcUri, string destination, string entrypoint, + object input, Action onComplete = null) + { + var rpc = new Rpc(rpcUri); + var runViewOp = rpc.RunView(destination, entrypoint, input); + + return RpcRequest(runViewOp, (JsonElement result) => + { + if (result.ValueKind != JsonValueKind.Null && result.ValueKind != JsonValueKind.Undefined && + result.TryGetProperty("data", out var val)) + onComplete(val); + else + Debug.LogError("Invalid data"); + }); + } + + public static IEnumerator HumanizeValue(JsonElement val, string rpcUri, string destination, + string humanizeEntrypoint, Action onComplete) + { + yield return FetchContractCode(rpcUri, destination); + var cs = _contracts[destination]; + // getting parameters section as readable json: + var json = cs.HumanizeParameter(humanizeEntrypoint, Micheline.FromJson(val)); + var readResult = JsonSerializer.Deserialize(json); + onComplete?.Invoke(readResult); + } + + private static IEnumerator FetchContractCode(string rpcUri, string contract) + { + if (_contracts.ContainsKey(contract)) yield break; + var rpc = new Rpc(rpcUri); + var scriptOp = rpc.GetContractCode(contract); + yield return RpcRequest(scriptOp, (JsonElement script) => + { + var codeElement = script.GetProperty("code").GetRawText(); + var code = Micheline.FromJson(codeElement); + _contracts[contract] = new ContractScript(code); + }); + } + + private static IEnumerator RpcRequest(IEnumerator op, Action callback) + { + var counterRoutine = new CoroutineWrapper(op); + yield return counterRoutine; + var counter = counterRoutine.Result; + callback?.Invoke(counter); + } + + public static IEnumerator CompileToJSONMichelson(string rpcUri, string destination, + string entry, object objArg, Action onComplete) + { + yield return FetchContractCode(rpcUri, destination); + var cs = _contracts[destination]; + + var asMichelson = cs.BuildParameter(entry, objArg); + onComplete?.Invoke(asMichelson.ToJson()); + } + + public static bool VerifySignature(string pubKey, string payload, string signature) + { + var pubkey = PubKey.FromBase58(pubKey); + var payloadBytes = Hex.Parse(payload); + return pubkey.Verify(payloadBytes, signature); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Helpers/NetezosExtensions.cs.meta b/Runtime/Scripts/Helpers/NetezosExtensions.cs.meta similarity index 83% rename from Assets/Scripts/Helpers/NetezosExtensions.cs.meta rename to Runtime/Scripts/Helpers/NetezosExtensions.cs.meta index b5a7cd14..791131bc 100644 --- a/Assets/Scripts/Helpers/NetezosExtensions.cs.meta +++ b/Runtime/Scripts/Helpers/NetezosExtensions.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4dfc12f96e42943f7ba566880841bcb7 +guid: d38e1e4693f0f43daa2f10968d2d7a53 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/Scripts/Helpers/UnityMainThreadDispatcher.cs b/Runtime/Scripts/Helpers/UnityMainThreadDispatcher.cs new file mode 100644 index 00000000..deaff111 --- /dev/null +++ b/Runtime/Scripts/Helpers/UnityMainThreadDispatcher.cs @@ -0,0 +1,142 @@ +/* +Copyright 2015 Pim de Witte All Rights Reserved. +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. +*/ + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; +using System.Threading.Tasks; + +/// Author: Pim de Witte (pimdewitte.com) and contributors, https://github.com/PimDeWitte/UnityMainThreadDispatcher +/// +/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for +/// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling +/// +public class UnityMainThreadDispatcher : MonoBehaviour +{ + private static readonly Queue _executionQueue = new(); + + public void Update() + { + lock (_executionQueue) + { + while (_executionQueue.Count > 0) + { + _executionQueue.Dequeue().Invoke(); + } + } + } + + /// + /// Locks the queue and adds the IEnumerator to the queue + /// + /// IEnumerator function that will be executed from the main thread. + public void Enqueue(IEnumerator action) + { + lock (_executionQueue) + { + _executionQueue.Enqueue(() => { StartCoroutine(action); }); + } + } + + /// + /// Locks the queue and adds the Action to the queue + /// + /// function that will be executed from the main thread. + public static void Enqueue(Action action) + { + Instance().Enqueue(ActionWrapper(action)); + } + + /// + /// Locks the queue and adds the Action to the queue + /// + /// function that will be executed from the main thread. + /// function parameter. + public static void Enqueue(Action action, T parameter) + { + Instance().Enqueue(ActionWrapper(action, parameter)); + } + + /// + /// Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes + /// + /// function that will be executed from the main thread. + /// A Task that can be awaited until the action completes + public Task EnqueueAsync(Action action) + { + var tcs = new TaskCompletionSource(); + + void WrappedAction() + { + try + { + action(); + tcs.TrySetResult(true); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + } + + Enqueue(ActionWrapper(WrappedAction)); + return tcs.Task; + } + + + private static IEnumerator ActionWrapper(Action a) + { + a(); + yield return null; + } + + private static IEnumerator ActionWrapper(Action function, T parameter) + { + yield return null; + function.Invoke(parameter); + } + + private static UnityMainThreadDispatcher _instance; + + private static bool Exists() + { + return _instance != null; + } + + public static UnityMainThreadDispatcher Instance() + { + if (!Exists()) + { + throw new Exception( + "UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); + } + + return _instance; + } + + + void Awake() + { + if (_instance == null) + { + _instance = this; + DontDestroyOnLoad(this.gameObject); + } + } + + void OnDestroy() + { + _instance = null; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Helpers/UnityMainThreadDispatcher.cs.meta b/Runtime/Scripts/Helpers/UnityMainThreadDispatcher.cs.meta similarity index 100% rename from Assets/Scripts/Helpers/UnityMainThreadDispatcher.cs.meta rename to Runtime/Scripts/Helpers/UnityMainThreadDispatcher.cs.meta diff --git a/Assets/Scripts/TezosAPI.meta b/Runtime/Scripts/TezosAPI.meta similarity index 77% rename from Assets/Scripts/TezosAPI.meta rename to Runtime/Scripts/TezosAPI.meta index 27249568..07769d65 100644 --- a/Assets/Scripts/TezosAPI.meta +++ b/Runtime/Scripts/TezosAPI.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0b800ae838c3d834782a88e27de14d4d +guid: 7ca6d9dc859824a24b4c0bcdd6acaf85 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/Scripts/TezosAPI/HttpClient.cs b/Runtime/Scripts/TezosAPI/HttpClient.cs new file mode 100644 index 00000000..02adc6dd --- /dev/null +++ b/Runtime/Scripts/TezosAPI/HttpClient.cs @@ -0,0 +1,71 @@ +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Dynamic.Json; +using Helpers; +using UnityEngine; +using UnityEngine.Networking; + + +namespace TezosAPI +{ + public class HttpClient + { + private string BaseAddress { get; } + private int RequestTimeout { get; } + + protected HttpClient(string baseAddress, int timeoutSec = 30) + { + BaseAddress = baseAddress.EndsWith("/") ? baseAddress : $"{baseAddress}/"; + RequestTimeout = timeoutSec; + } + + protected IEnumerator GetJson(string path) + { + var request = GetUnityWebRequest(UnityWebRequest.kHttpVerbGET, path); + request.SendWebRequest(); + yield return new WaitUntil(() => request.isDone); + yield return DJson.Parse(request.downloadHandler.text, JsonOptions.DefaultOptions); + request.Dispose(); + } + + protected IEnumerator GetJson(string path) + { + var request = GetUnityWebRequest(UnityWebRequest.kHttpVerbGET, path); + request.SendWebRequest(); + yield return new WaitUntil(() => request.isDone); + yield return JsonSerializer.Deserialize(request.downloadHandler.text, JsonOptions.DefaultOptions); + request.Dispose(); + } + + protected IEnumerator PostJson(string path, object data) + { + var serializedData = JsonSerializer.Serialize(data, JsonOptions.DefaultOptions); + var request = GetUnityWebRequest(UnityWebRequest.kHttpVerbPOST, path); + request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(serializedData)); + request.SetRequestHeader(HttpHeaders.ContentType.Key, HttpHeaders.ContentType.Value); + request.SendWebRequest(); + yield return new WaitUntil(() => request.isDone); + yield return JsonSerializer.Deserialize(request.downloadHandler.text, JsonOptions.DefaultOptions); + request.Dispose(); + } + + private UnityWebRequest GetUnityWebRequest(string method, string path) + { + var request = new UnityWebRequest($"{BaseAddress}{path}", method); + request.downloadHandler = new DownloadHandlerBuffer(); + request.SetRequestHeader(HttpHeaders.Accept.Key, HttpHeaders.Accept.Value); + request.SetRequestHeader(HttpHeaders.UserAgent.Key, HttpHeaders.UserAgent.Value); + request.timeout = RequestTimeout; + return request; + } + } + + internal static class HttpHeaders + { + public static KeyValuePair ContentType => new("Content-Type", "application/json"); + public static KeyValuePair Accept => new("Accept", "application/json"); + public static KeyValuePair UserAgent => new("User-Agent", "tezos-unity-sdk"); + } +} \ No newline at end of file diff --git a/Runtime/Scripts/TezosAPI/HttpClient.cs.meta b/Runtime/Scripts/TezosAPI/HttpClient.cs.meta new file mode 100644 index 00000000..ed7059ff --- /dev/null +++ b/Runtime/Scripts/TezosAPI/HttpClient.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 87a96e8272d449738de5ceb2e9cedd5d +timeCreated: 1679651318 \ No newline at end of file diff --git a/Assets/Scripts/TezosAPI/ITezosAPI.cs b/Runtime/Scripts/TezosAPI/ITezosAPI.cs similarity index 99% rename from Assets/Scripts/TezosAPI/ITezosAPI.cs rename to Runtime/Scripts/TezosAPI/ITezosAPI.cs index a7a72a51..9caad3c2 100644 --- a/Assets/Scripts/TezosAPI/ITezosAPI.cs +++ b/Runtime/Scripts/TezosAPI/ITezosAPI.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Text.Json; +using BeaconSDK; namespace TezosAPI { diff --git a/Assets/Scripts/TezosAPI/ITezosAPI.cs.meta b/Runtime/Scripts/TezosAPI/ITezosAPI.cs.meta similarity index 83% rename from Assets/Scripts/TezosAPI/ITezosAPI.cs.meta rename to Runtime/Scripts/TezosAPI/ITezosAPI.cs.meta index 24967c4e..621e9439 100644 --- a/Assets/Scripts/TezosAPI/ITezosAPI.cs.meta +++ b/Runtime/Scripts/TezosAPI/ITezosAPI.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 44dbec44a40255c48a2226b391ebf0f1 +guid: 6ca9a7f235fbd4772a96d592baf80053 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/Scripts/TezosAPI/Rpc.cs b/Runtime/Scripts/TezosAPI/Rpc.cs new file mode 100644 index 00000000..ed2cf377 --- /dev/null +++ b/Runtime/Scripts/TezosAPI/Rpc.cs @@ -0,0 +1,44 @@ +using System.Collections; +using System.Text.Json; +using Netezos.Rpc.Queries.Post; + + +namespace TezosAPI +{ + public class Rpc : HttpClient + { + private const string chainId = "NetXdQprcVkpaWU"; + + public Rpc(string baseAddress) : base(baseAddress) + { + } + + public IEnumerator GetTzBalance(string address) + => GetJson($"chains/main/blocks/head/context/contracts/{address}/balance/"); + + public IEnumerator GetContractCode(string contract) + => GetJson($"chains/main/blocks/head/context/contracts/{contract}/script/"); + + public IEnumerator RunView(string contract, string view, object input, string chainId = chainId, + string source = null, string payer = null, long? gas = null, + NormalizedQuery.UnparsingMode mode = NormalizedQuery.UnparsingMode.Readable, int? now = null, + int? level = null) + { + var data = new + { + contract, + view, + input, + chain_id = chainId, + unlimited_gas = gas == null, + unparsing_mode = mode.ToString(), + source, + payer, + gas = gas?.ToString(), + now = now?.ToString(), + level = level?.ToString() + }; + return PostJson("chains/main/blocks/head/helpers/scripts/run_script_view/", data); + } + } +} \ No newline at end of file diff --git a/Runtime/Scripts/TezosAPI/Rpc.cs.meta b/Runtime/Scripts/TezosAPI/Rpc.cs.meta new file mode 100644 index 00000000..2f592fec --- /dev/null +++ b/Runtime/Scripts/TezosAPI/Rpc.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cd8e4b7b0d034d50acfed696879397a7 +timeCreated: 1679570371 \ No newline at end of file diff --git a/Runtime/Scripts/TezosAPI/Tezos.cs b/Runtime/Scripts/TezosAPI/Tezos.cs new file mode 100644 index 00000000..83001262 --- /dev/null +++ b/Runtime/Scripts/TezosAPI/Tezos.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections; +using System.Text.Json; +using BeaconSDK; +using UnityEngine; + +namespace TezosAPI +{ + /// + /// Implementation of the ITezosAPI. + /// Exposes the main functions of the Tezos API in Unity + /// + public class Tezos : ITezosAPI + { + private string _networkName; + private string _networkNode; + private string _indexerNode; + private IBeaconConnector _beaconConnector; + + private string _handshake; + private string _pubKey; + private string _signature; + private string _transactionHash; + + public BeaconMessageReceiver MessageReceiver { get; private set; } + + public Tezos(string networkName = "", string customNode = "", string indexerNode = "") + { + _networkName = networkName; + _networkNode = customNode; + _indexerNode = indexerNode; + + InitBeaconConnector(); + } + + private void InitBeaconConnector() + { + // Create a BeaconMessageReceiver Game object to receive callback messages + MessageReceiver = new GameObject("UnityBeacon").AddComponent(); + + // Assign the BeaconConnector depending on the platform. +#if UNITY_WEBGL && !UNITY_EDITOR + _beaconConnector = new BeaconConnectorWebGl(); + _beaconConnector.SetNetwork(_networkName, _networkNode);; +#elif (UNITY_ANDROID && !UNITY_EDITOR) || (UNITY_IOS && !UNITY_EDITOR) || UNITY_STANDALONE || UNITY_EDITOR + _beaconConnector = new BeaconConnectorDotNet(); + _beaconConnector.SetNetwork(_networkName, _networkNode); + (_beaconConnector as BeaconConnectorDotNet)?.SetBeaconMessageReceiver(MessageReceiver); + _beaconConnector.ConnectAccount(); + MessageReceiver.PairingCompleted += _ => RequestPermission(); +#else + _beaconConnector = new BeaconConnectorNull(); +#endif + + MessageReceiver.ClientCreated += _ => { _beaconConnector.RequestHandshake(); }; + MessageReceiver.HandshakeReceived += handshake => { _handshake = handshake; }; + + MessageReceiver.AccountConnected += account => + { + var json = JsonSerializer.Deserialize(account); + if (json.TryGetProperty("account", out json)) + { + _pubKey = json.GetProperty("publicKey").GetString(); + + Debug.Log("my pubkey: " + _pubKey); + } + }; + MessageReceiver.PayloadSigned += (payload) => + { + var json = JsonSerializer.Deserialize(payload); + var signature = json.GetProperty("signature").GetString(); + _signature = signature; + }; + MessageReceiver.ContractCallInjected += transaction => + { + var json = JsonSerializer.Deserialize(transaction); + var transactionHash = json.GetProperty("transactionHash").GetString(); + MessageReceiver.StartCoroutine(MessageReceiver.ContractCallInjection(_indexerNode, transactionHash)); + }; + } + + public void ConnectWallet() + { +#if UNITY_WEBGL + _beaconConnector.ConnectAccount(); +#elif UNITY_ANDROID || UNITY_IOS + RequestPermission(); + Application.OpenURL($"tezos://?type=tzip10&data={_handshake}"); +#endif + } + + public void DisconnectWallet() + { + _beaconConnector.DisconnectAccount(); + } + + public string GetActiveWalletAddress() + { + return _beaconConnector.GetActiveAccountAddress(); + } + + public IEnumerator ReadBalance(Action callback) + { + var address = _beaconConnector.GetActiveAccountAddress(); + return NetezosExtensions.ReadTZBalance(_networkNode, address, callback); + } + + public IEnumerator ReadView(string contractAddress, string entryPoint, object input, + Action callback) + { + return NetezosExtensions.ReadView(_networkNode, contractAddress, entryPoint, input, callback); + } + + public void CallContract(string contractAddress, string entryPoint, string input, ulong amount = 0) + { + _beaconConnector.RequestTezosOperation(contractAddress, entryPoint, input, + amount, _networkName, _networkNode); + } + + public void RequestPermission() + { + _beaconConnector.RequestTezosPermission(_networkName, _networkNode); + } + + public void RequestSignPayload(int signingType, string payload) + { + _beaconConnector.RequestTezosSignPayload(signingType, payload); + } + + public bool VerifySignedPayload(string payload) + { + var key = _pubKey; + var signature = _signature; + return NetezosExtensions.VerifySignature(key, payload, signature); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/TezosAPI/Tezos.cs.meta b/Runtime/Scripts/TezosAPI/Tezos.cs.meta similarity index 83% rename from Assets/Scripts/TezosAPI/Tezos.cs.meta rename to Runtime/Scripts/TezosAPI/Tezos.cs.meta index f3f5d1d6..671218b9 100644 --- a/Assets/Scripts/TezosAPI/Tezos.cs.meta +++ b/Runtime/Scripts/TezosAPI/Tezos.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3400f15b379f0a549a2f829376db751a +guid: fba6e58ffb125425191c35620d824c27 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/com.trilitech.tezos-unity-sdk.asmdef b/Runtime/com.trilitech.tezos-unity-sdk.asmdef new file mode 100644 index 00000000..aca79be7 --- /dev/null +++ b/Runtime/com.trilitech.tezos-unity-sdk.asmdef @@ -0,0 +1,14 @@ +{ + "name": "com.trilitech.tezos-unity-sdk", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/Android/baseProjectTemplate.gradle.meta b/Runtime/com.trilitech.tezos-unity-sdk.asmdef.meta similarity index 59% rename from Assets/Plugins/Android/baseProjectTemplate.gradle.meta rename to Runtime/com.trilitech.tezos-unity-sdk.asmdef.meta index 384e4ac0..681b05e7 100644 --- a/Assets/Plugins/Android/baseProjectTemplate.gradle.meta +++ b/Runtime/com.trilitech.tezos-unity-sdk.asmdef.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 9c4ee749031fccb478a23aa7d34bb264 -DefaultImporter: +guid: 0c0f402fc1cb344ef87d37f5a81f2739 +AssemblyDefinitionImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Art.meta b/Samples~/Art.meta similarity index 100% rename from Assets/Art.meta rename to Samples~/Art.meta diff --git a/Assets/Art/UI.meta b/Samples~/Art/UI.meta similarity index 100% rename from Assets/Art/UI.meta rename to Samples~/Art/UI.meta diff --git a/Assets/Art/UI/Gui_parts.meta b/Samples~/Art/UI/Gui_parts.meta similarity index 100% rename from Assets/Art/UI/Gui_parts.meta rename to Samples~/Art/UI/Gui_parts.meta diff --git a/Assets/Art/UI/Gui_parts/Frame_big.png b/Samples~/Art/UI/Gui_parts/Frame_big.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Frame_big.png rename to Samples~/Art/UI/Gui_parts/Frame_big.png diff --git a/Assets/Art/UI/Gui_parts/Frame_big.png.meta b/Samples~/Art/UI/Gui_parts/Frame_big.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Frame_big.png.meta rename to Samples~/Art/UI/Gui_parts/Frame_big.png.meta diff --git a/Assets/Art/UI/Gui_parts/Frame_mid.png b/Samples~/Art/UI/Gui_parts/Frame_mid.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Frame_mid.png rename to Samples~/Art/UI/Gui_parts/Frame_mid.png diff --git a/Assets/Art/UI/Gui_parts/Frame_mid.png.meta b/Samples~/Art/UI/Gui_parts/Frame_mid.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Frame_mid.png.meta rename to Samples~/Art/UI/Gui_parts/Frame_mid.png.meta diff --git a/Assets/Art/UI/Gui_parts/Frame_mid_2.png b/Samples~/Art/UI/Gui_parts/Frame_mid_2.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Frame_mid_2.png rename to Samples~/Art/UI/Gui_parts/Frame_mid_2.png diff --git a/Assets/Art/UI/Gui_parts/Frame_mid_2.png.meta b/Samples~/Art/UI/Gui_parts/Frame_mid_2.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Frame_mid_2.png.meta rename to Samples~/Art/UI/Gui_parts/Frame_mid_2.png.meta diff --git a/Assets/Art/UI/Gui_parts/Hp_frame.png b/Samples~/Art/UI/Gui_parts/Hp_frame.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Hp_frame.png rename to Samples~/Art/UI/Gui_parts/Hp_frame.png diff --git a/Assets/Art/UI/Gui_parts/Hp_frame.png.meta b/Samples~/Art/UI/Gui_parts/Hp_frame.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Hp_frame.png.meta rename to Samples~/Art/UI/Gui_parts/Hp_frame.png.meta diff --git a/Assets/Art/UI/Gui_parts/Hp_line.png b/Samples~/Art/UI/Gui_parts/Hp_line.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Hp_line.png rename to Samples~/Art/UI/Gui_parts/Hp_line.png diff --git a/Assets/Art/UI/Gui_parts/Hp_line.png.meta b/Samples~/Art/UI/Gui_parts/Hp_line.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Hp_line.png.meta rename to Samples~/Art/UI/Gui_parts/Hp_line.png.meta diff --git a/Assets/Art/UI/Gui_parts/Mini_background.png b/Samples~/Art/UI/Gui_parts/Mini_background.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_background.png rename to Samples~/Art/UI/Gui_parts/Mini_background.png diff --git a/Assets/Art/UI/Gui_parts/Mini_background.png.meta b/Samples~/Art/UI/Gui_parts/Mini_background.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_background.png.meta rename to Samples~/Art/UI/Gui_parts/Mini_background.png.meta diff --git a/Assets/Art/UI/Gui_parts/Mini_frame0.png b/Samples~/Art/UI/Gui_parts/Mini_frame0.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_frame0.png rename to Samples~/Art/UI/Gui_parts/Mini_frame0.png diff --git a/Assets/Art/UI/Gui_parts/Mini_frame0.png.meta b/Samples~/Art/UI/Gui_parts/Mini_frame0.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_frame0.png.meta rename to Samples~/Art/UI/Gui_parts/Mini_frame0.png.meta diff --git a/Assets/Art/UI/Gui_parts/Mini_frame1.png b/Samples~/Art/UI/Gui_parts/Mini_frame1.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_frame1.png rename to Samples~/Art/UI/Gui_parts/Mini_frame1.png diff --git a/Assets/Art/UI/Gui_parts/Mini_frame1.png.meta b/Samples~/Art/UI/Gui_parts/Mini_frame1.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_frame1.png.meta rename to Samples~/Art/UI/Gui_parts/Mini_frame1.png.meta diff --git a/Assets/Art/UI/Gui_parts/Mini_frame2.png b/Samples~/Art/UI/Gui_parts/Mini_frame2.png similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_frame2.png rename to Samples~/Art/UI/Gui_parts/Mini_frame2.png diff --git a/Assets/Art/UI/Gui_parts/Mini_frame2.png.meta b/Samples~/Art/UI/Gui_parts/Mini_frame2.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/Mini_frame2.png.meta rename to Samples~/Art/UI/Gui_parts/Mini_frame2.png.meta diff --git a/Assets/Art/UI/Gui_parts/bar_ready.png b/Samples~/Art/UI/Gui_parts/bar_ready.png similarity index 100% rename from Assets/Art/UI/Gui_parts/bar_ready.png rename to Samples~/Art/UI/Gui_parts/bar_ready.png diff --git a/Assets/Art/UI/Gui_parts/bar_ready.png.meta b/Samples~/Art/UI/Gui_parts/bar_ready.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/bar_ready.png.meta rename to Samples~/Art/UI/Gui_parts/bar_ready.png.meta diff --git a/Assets/Art/UI/Gui_parts/barmid_ready.png b/Samples~/Art/UI/Gui_parts/barmid_ready.png similarity index 100% rename from Assets/Art/UI/Gui_parts/barmid_ready.png rename to Samples~/Art/UI/Gui_parts/barmid_ready.png diff --git a/Assets/Art/UI/Gui_parts/barmid_ready.png.meta b/Samples~/Art/UI/Gui_parts/barmid_ready.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/barmid_ready.png.meta rename to Samples~/Art/UI/Gui_parts/barmid_ready.png.meta diff --git a/Assets/Art/UI/Gui_parts/big_background.png b/Samples~/Art/UI/Gui_parts/big_background.png similarity index 100% rename from Assets/Art/UI/Gui_parts/big_background.png rename to Samples~/Art/UI/Gui_parts/big_background.png diff --git a/Assets/Art/UI/Gui_parts/big_background.png.meta b/Samples~/Art/UI/Gui_parts/big_background.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/big_background.png.meta rename to Samples~/Art/UI/Gui_parts/big_background.png.meta diff --git a/Assets/Art/UI/Gui_parts/big_roundframe.png b/Samples~/Art/UI/Gui_parts/big_roundframe.png similarity index 100% rename from Assets/Art/UI/Gui_parts/big_roundframe.png rename to Samples~/Art/UI/Gui_parts/big_roundframe.png diff --git a/Assets/Art/UI/Gui_parts/big_roundframe.png.meta b/Samples~/Art/UI/Gui_parts/big_roundframe.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/big_roundframe.png.meta rename to Samples~/Art/UI/Gui_parts/big_roundframe.png.meta diff --git a/Assets/Art/UI/Gui_parts/button.png b/Samples~/Art/UI/Gui_parts/button.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button.png rename to Samples~/Art/UI/Gui_parts/button.png diff --git a/Assets/Art/UI/Gui_parts/button.png.meta b/Samples~/Art/UI/Gui_parts/button.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button.png.meta rename to Samples~/Art/UI/Gui_parts/button.png.meta diff --git a/Assets/Art/UI/Gui_parts/button2.png b/Samples~/Art/UI/Gui_parts/button2.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button2.png rename to Samples~/Art/UI/Gui_parts/button2.png diff --git a/Assets/Art/UI/Gui_parts/button2.png.meta b/Samples~/Art/UI/Gui_parts/button2.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button2.png.meta rename to Samples~/Art/UI/Gui_parts/button2.png.meta diff --git a/Assets/Art/UI/Gui_parts/button2_ready_off.png b/Samples~/Art/UI/Gui_parts/button2_ready_off.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button2_ready_off.png rename to Samples~/Art/UI/Gui_parts/button2_ready_off.png diff --git a/Assets/Art/UI/Gui_parts/button2_ready_off.png.meta b/Samples~/Art/UI/Gui_parts/button2_ready_off.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button2_ready_off.png.meta rename to Samples~/Art/UI/Gui_parts/button2_ready_off.png.meta diff --git a/Assets/Art/UI/Gui_parts/button2_ready_on.png b/Samples~/Art/UI/Gui_parts/button2_ready_on.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button2_ready_on.png rename to Samples~/Art/UI/Gui_parts/button2_ready_on.png diff --git a/Assets/Art/UI/Gui_parts/button2_ready_on.png.meta b/Samples~/Art/UI/Gui_parts/button2_ready_on.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button2_ready_on.png.meta rename to Samples~/Art/UI/Gui_parts/button2_ready_on.png.meta diff --git a/Assets/Art/UI/Gui_parts/button3_ready.png b/Samples~/Art/UI/Gui_parts/button3_ready.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button3_ready.png rename to Samples~/Art/UI/Gui_parts/button3_ready.png diff --git a/Assets/Art/UI/Gui_parts/button3_ready.png.meta b/Samples~/Art/UI/Gui_parts/button3_ready.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button3_ready.png.meta rename to Samples~/Art/UI/Gui_parts/button3_ready.png.meta diff --git a/Assets/Art/UI/Gui_parts/button_agree.png b/Samples~/Art/UI/Gui_parts/button_agree.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button_agree.png rename to Samples~/Art/UI/Gui_parts/button_agree.png diff --git a/Assets/Art/UI/Gui_parts/button_agree.png.meta b/Samples~/Art/UI/Gui_parts/button_agree.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button_agree.png.meta rename to Samples~/Art/UI/Gui_parts/button_agree.png.meta diff --git a/Assets/Art/UI/Gui_parts/button_cancel.png b/Samples~/Art/UI/Gui_parts/button_cancel.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button_cancel.png rename to Samples~/Art/UI/Gui_parts/button_cancel.png diff --git a/Assets/Art/UI/Gui_parts/button_cancel.png.meta b/Samples~/Art/UI/Gui_parts/button_cancel.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button_cancel.png.meta rename to Samples~/Art/UI/Gui_parts/button_cancel.png.meta diff --git a/Assets/Art/UI/Gui_parts/button_frame.png b/Samples~/Art/UI/Gui_parts/button_frame.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button_frame.png rename to Samples~/Art/UI/Gui_parts/button_frame.png diff --git a/Assets/Art/UI/Gui_parts/button_frame.png.meta b/Samples~/Art/UI/Gui_parts/button_frame.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button_frame.png.meta rename to Samples~/Art/UI/Gui_parts/button_frame.png.meta diff --git a/Assets/Art/UI/Gui_parts/button_ready_off.png b/Samples~/Art/UI/Gui_parts/button_ready_off.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button_ready_off.png rename to Samples~/Art/UI/Gui_parts/button_ready_off.png diff --git a/Assets/Art/UI/Gui_parts/button_ready_off.png.meta b/Samples~/Art/UI/Gui_parts/button_ready_off.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button_ready_off.png.meta rename to Samples~/Art/UI/Gui_parts/button_ready_off.png.meta diff --git a/Assets/Art/UI/Gui_parts/button_ready_on.png b/Samples~/Art/UI/Gui_parts/button_ready_on.png similarity index 100% rename from Assets/Art/UI/Gui_parts/button_ready_on.png rename to Samples~/Art/UI/Gui_parts/button_ready_on.png diff --git a/Assets/Art/UI/Gui_parts/button_ready_on.png.meta b/Samples~/Art/UI/Gui_parts/button_ready_on.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/button_ready_on.png.meta rename to Samples~/Art/UI/Gui_parts/button_ready_on.png.meta diff --git a/Assets/Art/UI/Gui_parts/lil_roundbackground.png b/Samples~/Art/UI/Gui_parts/lil_roundbackground.png similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundbackground.png rename to Samples~/Art/UI/Gui_parts/lil_roundbackground.png diff --git a/Assets/Art/UI/Gui_parts/lil_roundbackground.png.meta b/Samples~/Art/UI/Gui_parts/lil_roundbackground.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundbackground.png.meta rename to Samples~/Art/UI/Gui_parts/lil_roundbackground.png.meta diff --git a/Assets/Art/UI/Gui_parts/lil_roundframe.png b/Samples~/Art/UI/Gui_parts/lil_roundframe.png similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundframe.png rename to Samples~/Art/UI/Gui_parts/lil_roundframe.png diff --git a/Assets/Art/UI/Gui_parts/lil_roundframe.png.meta b/Samples~/Art/UI/Gui_parts/lil_roundframe.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundframe.png.meta rename to Samples~/Art/UI/Gui_parts/lil_roundframe.png.meta diff --git a/Assets/Art/UI/Gui_parts/lil_roundframe_ready.png b/Samples~/Art/UI/Gui_parts/lil_roundframe_ready.png similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundframe_ready.png rename to Samples~/Art/UI/Gui_parts/lil_roundframe_ready.png diff --git a/Assets/Art/UI/Gui_parts/lil_roundframe_ready.png.meta b/Samples~/Art/UI/Gui_parts/lil_roundframe_ready.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundframe_ready.png.meta rename to Samples~/Art/UI/Gui_parts/lil_roundframe_ready.png.meta diff --git a/Assets/Art/UI/Gui_parts/lil_roundframe_ready2.png b/Samples~/Art/UI/Gui_parts/lil_roundframe_ready2.png similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundframe_ready2.png rename to Samples~/Art/UI/Gui_parts/lil_roundframe_ready2.png diff --git a/Assets/Art/UI/Gui_parts/lil_roundframe_ready2.png.meta b/Samples~/Art/UI/Gui_parts/lil_roundframe_ready2.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/lil_roundframe_ready2.png.meta rename to Samples~/Art/UI/Gui_parts/lil_roundframe_ready2.png.meta diff --git a/Assets/Art/UI/Gui_parts/mid_background.png b/Samples~/Art/UI/Gui_parts/mid_background.png similarity index 100% rename from Assets/Art/UI/Gui_parts/mid_background.png rename to Samples~/Art/UI/Gui_parts/mid_background.png diff --git a/Assets/Art/UI/Gui_parts/mid_background.png.meta b/Samples~/Art/UI/Gui_parts/mid_background.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/mid_background.png.meta rename to Samples~/Art/UI/Gui_parts/mid_background.png.meta diff --git a/Assets/Art/UI/Gui_parts/name_bar.png b/Samples~/Art/UI/Gui_parts/name_bar.png similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar.png rename to Samples~/Art/UI/Gui_parts/name_bar.png diff --git a/Assets/Art/UI/Gui_parts/name_bar.png.meta b/Samples~/Art/UI/Gui_parts/name_bar.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar.png.meta rename to Samples~/Art/UI/Gui_parts/name_bar.png.meta diff --git a/Assets/Art/UI/Gui_parts/name_bar2.png b/Samples~/Art/UI/Gui_parts/name_bar2.png similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar2.png rename to Samples~/Art/UI/Gui_parts/name_bar2.png diff --git a/Assets/Art/UI/Gui_parts/name_bar2.png.meta b/Samples~/Art/UI/Gui_parts/name_bar2.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar2.png.meta rename to Samples~/Art/UI/Gui_parts/name_bar2.png.meta diff --git a/Assets/Art/UI/Gui_parts/name_bar3.png b/Samples~/Art/UI/Gui_parts/name_bar3.png similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar3.png rename to Samples~/Art/UI/Gui_parts/name_bar3.png diff --git a/Assets/Art/UI/Gui_parts/name_bar3.png.meta b/Samples~/Art/UI/Gui_parts/name_bar3.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar3.png.meta rename to Samples~/Art/UI/Gui_parts/name_bar3.png.meta diff --git a/Assets/Art/UI/Gui_parts/name_bar_Arrow.png b/Samples~/Art/UI/Gui_parts/name_bar_Arrow.png similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar_Arrow.png rename to Samples~/Art/UI/Gui_parts/name_bar_Arrow.png diff --git a/Assets/Art/UI/Gui_parts/name_bar_Arrow.png.meta b/Samples~/Art/UI/Gui_parts/name_bar_Arrow.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/name_bar_Arrow.png.meta rename to Samples~/Art/UI/Gui_parts/name_bar_Arrow.png.meta diff --git a/Assets/Art/UI/Gui_parts/warrior_silhouette_man.png b/Samples~/Art/UI/Gui_parts/warrior_silhouette_man.png similarity index 100% rename from Assets/Art/UI/Gui_parts/warrior_silhouette_man.png rename to Samples~/Art/UI/Gui_parts/warrior_silhouette_man.png diff --git a/Assets/Art/UI/Gui_parts/warrior_silhouette_man.png.meta b/Samples~/Art/UI/Gui_parts/warrior_silhouette_man.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/warrior_silhouette_man.png.meta rename to Samples~/Art/UI/Gui_parts/warrior_silhouette_man.png.meta diff --git a/Assets/Art/UI/Gui_parts/warrior_silhouette_woman.png b/Samples~/Art/UI/Gui_parts/warrior_silhouette_woman.png similarity index 100% rename from Assets/Art/UI/Gui_parts/warrior_silhouette_woman.png rename to Samples~/Art/UI/Gui_parts/warrior_silhouette_woman.png diff --git a/Assets/Art/UI/Gui_parts/warrior_silhouette_woman.png.meta b/Samples~/Art/UI/Gui_parts/warrior_silhouette_woman.png.meta similarity index 100% rename from Assets/Art/UI/Gui_parts/warrior_silhouette_woman.png.meta rename to Samples~/Art/UI/Gui_parts/warrior_silhouette_woman.png.meta diff --git a/Assets/Art/UI/Icons.meta b/Samples~/Art/UI/Icons.meta similarity index 100% rename from Assets/Art/UI/Icons.meta rename to Samples~/Art/UI/Icons.meta diff --git a/Assets/Art/UI/Icons/Equipment_Boots.png b/Samples~/Art/UI/Icons/Equipment_Boots.png similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Boots.png rename to Samples~/Art/UI/Icons/Equipment_Boots.png diff --git a/Assets/Art/UI/Icons/Equipment_Boots.png.meta b/Samples~/Art/UI/Icons/Equipment_Boots.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Boots.png.meta rename to Samples~/Art/UI/Icons/Equipment_Boots.png.meta diff --git a/Assets/Art/UI/Icons/Equipment_Gloves.png b/Samples~/Art/UI/Icons/Equipment_Gloves.png similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Gloves.png rename to Samples~/Art/UI/Icons/Equipment_Gloves.png diff --git a/Assets/Art/UI/Icons/Equipment_Gloves.png.meta b/Samples~/Art/UI/Icons/Equipment_Gloves.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Gloves.png.meta rename to Samples~/Art/UI/Icons/Equipment_Gloves.png.meta diff --git a/Assets/Art/UI/Icons/Equipment_Helmet.png b/Samples~/Art/UI/Icons/Equipment_Helmet.png similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Helmet.png rename to Samples~/Art/UI/Icons/Equipment_Helmet.png diff --git a/Assets/Art/UI/Icons/Equipment_Helmet.png.meta b/Samples~/Art/UI/Icons/Equipment_Helmet.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Helmet.png.meta rename to Samples~/Art/UI/Icons/Equipment_Helmet.png.meta diff --git a/Assets/Art/UI/Icons/Equipment_Pants.png b/Samples~/Art/UI/Icons/Equipment_Pants.png similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Pants.png rename to Samples~/Art/UI/Icons/Equipment_Pants.png diff --git a/Assets/Art/UI/Icons/Equipment_Pants.png.meta b/Samples~/Art/UI/Icons/Equipment_Pants.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Pants.png.meta rename to Samples~/Art/UI/Icons/Equipment_Pants.png.meta diff --git a/Assets/Art/UI/Icons/Equipment_Shield.png b/Samples~/Art/UI/Icons/Equipment_Shield.png similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Shield.png rename to Samples~/Art/UI/Icons/Equipment_Shield.png diff --git a/Assets/Art/UI/Icons/Equipment_Shield.png.meta b/Samples~/Art/UI/Icons/Equipment_Shield.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Shield.png.meta rename to Samples~/Art/UI/Icons/Equipment_Shield.png.meta diff --git a/Assets/Art/UI/Icons/Equipment_Vest.png b/Samples~/Art/UI/Icons/Equipment_Vest.png similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Vest.png rename to Samples~/Art/UI/Icons/Equipment_Vest.png diff --git a/Assets/Art/UI/Icons/Equipment_Vest.png.meta b/Samples~/Art/UI/Icons/Equipment_Vest.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Equipment_Vest.png.meta rename to Samples~/Art/UI/Icons/Equipment_Vest.png.meta diff --git a/Assets/Art/UI/Icons/Sprite_Coin.png b/Samples~/Art/UI/Icons/Sprite_Coin.png similarity index 100% rename from Assets/Art/UI/Icons/Sprite_Coin.png rename to Samples~/Art/UI/Icons/Sprite_Coin.png diff --git a/Assets/Art/UI/Icons/Sprite_Coin.png.meta b/Samples~/Art/UI/Icons/Sprite_Coin.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Sprite_Coin.png.meta rename to Samples~/Art/UI/Icons/Sprite_Coin.png.meta diff --git a/Assets/Art/UI/Icons/Weapons_Sword.png b/Samples~/Art/UI/Icons/Weapons_Sword.png similarity index 100% rename from Assets/Art/UI/Icons/Weapons_Sword.png rename to Samples~/Art/UI/Icons/Weapons_Sword.png diff --git a/Assets/Art/UI/Icons/Weapons_Sword.png.meta b/Samples~/Art/UI/Icons/Weapons_Sword.png.meta similarity index 100% rename from Assets/Art/UI/Icons/Weapons_Sword.png.meta rename to Samples~/Art/UI/Icons/Weapons_Sword.png.meta diff --git a/Assets/Art/UI/Icons/armor_icon.png b/Samples~/Art/UI/Icons/armor_icon.png similarity index 100% rename from Assets/Art/UI/Icons/armor_icon.png rename to Samples~/Art/UI/Icons/armor_icon.png diff --git a/Assets/Art/UI/Icons/armor_icon.png.meta b/Samples~/Art/UI/Icons/armor_icon.png.meta similarity index 100% rename from Assets/Art/UI/Icons/armor_icon.png.meta rename to Samples~/Art/UI/Icons/armor_icon.png.meta diff --git a/Assets/Art/UI/Icons/coin-icon.png b/Samples~/Art/UI/Icons/coin-icon.png similarity index 100% rename from Assets/Art/UI/Icons/coin-icon.png rename to Samples~/Art/UI/Icons/coin-icon.png diff --git a/Assets/Art/UI/Icons/coin-icon.png.meta b/Samples~/Art/UI/Icons/coin-icon.png.meta similarity index 100% rename from Assets/Art/UI/Icons/coin-icon.png.meta rename to Samples~/Art/UI/Icons/coin-icon.png.meta diff --git a/Assets/Art/UI/Icons/paper-planes-1081560_1280.png b/Samples~/Art/UI/Icons/paper-planes-1081560_1280.png similarity index 100% rename from Assets/Art/UI/Icons/paper-planes-1081560_1280.png rename to Samples~/Art/UI/Icons/paper-planes-1081560_1280.png diff --git a/Assets/Art/UI/Icons/paper-planes-1081560_1280.png.meta b/Samples~/Art/UI/Icons/paper-planes-1081560_1280.png.meta similarity index 100% rename from Assets/Art/UI/Icons/paper-planes-1081560_1280.png.meta rename to Samples~/Art/UI/Icons/paper-planes-1081560_1280.png.meta diff --git a/Assets/Art/UI/Icons/sell-128.png b/Samples~/Art/UI/Icons/sell-128.png similarity index 100% rename from Assets/Art/UI/Icons/sell-128.png rename to Samples~/Art/UI/Icons/sell-128.png diff --git a/Assets/Art/UI/Icons/sell-128.png.meta b/Samples~/Art/UI/Icons/sell-128.png.meta similarity index 100% rename from Assets/Art/UI/Icons/sell-128.png.meta rename to Samples~/Art/UI/Icons/sell-128.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_01.png b/Samples~/Art/UI/Icons/skill_icon_01.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_01.png rename to Samples~/Art/UI/Icons/skill_icon_01.png diff --git a/Assets/Art/UI/Icons/skill_icon_01.png.meta b/Samples~/Art/UI/Icons/skill_icon_01.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_01.png.meta rename to Samples~/Art/UI/Icons/skill_icon_01.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_01_nobg.png b/Samples~/Art/UI/Icons/skill_icon_01_nobg.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_01_nobg.png rename to Samples~/Art/UI/Icons/skill_icon_01_nobg.png diff --git a/Assets/Art/UI/Icons/skill_icon_01_nobg.png.meta b/Samples~/Art/UI/Icons/skill_icon_01_nobg.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_01_nobg.png.meta rename to Samples~/Art/UI/Icons/skill_icon_01_nobg.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_02.png b/Samples~/Art/UI/Icons/skill_icon_02.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_02.png rename to Samples~/Art/UI/Icons/skill_icon_02.png diff --git a/Assets/Art/UI/Icons/skill_icon_02.png.meta b/Samples~/Art/UI/Icons/skill_icon_02.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_02.png.meta rename to Samples~/Art/UI/Icons/skill_icon_02.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_02_nobg.png b/Samples~/Art/UI/Icons/skill_icon_02_nobg.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_02_nobg.png rename to Samples~/Art/UI/Icons/skill_icon_02_nobg.png diff --git a/Assets/Art/UI/Icons/skill_icon_02_nobg.png.meta b/Samples~/Art/UI/Icons/skill_icon_02_nobg.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_02_nobg.png.meta rename to Samples~/Art/UI/Icons/skill_icon_02_nobg.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_03.png b/Samples~/Art/UI/Icons/skill_icon_03.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_03.png rename to Samples~/Art/UI/Icons/skill_icon_03.png diff --git a/Assets/Art/UI/Icons/skill_icon_03.png.meta b/Samples~/Art/UI/Icons/skill_icon_03.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_03.png.meta rename to Samples~/Art/UI/Icons/skill_icon_03.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_03_nobg.png b/Samples~/Art/UI/Icons/skill_icon_03_nobg.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_03_nobg.png rename to Samples~/Art/UI/Icons/skill_icon_03_nobg.png diff --git a/Assets/Art/UI/Icons/skill_icon_03_nobg.png.meta b/Samples~/Art/UI/Icons/skill_icon_03_nobg.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_03_nobg.png.meta rename to Samples~/Art/UI/Icons/skill_icon_03_nobg.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_04.png b/Samples~/Art/UI/Icons/skill_icon_04.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_04.png rename to Samples~/Art/UI/Icons/skill_icon_04.png diff --git a/Assets/Art/UI/Icons/skill_icon_04.png.meta b/Samples~/Art/UI/Icons/skill_icon_04.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_04.png.meta rename to Samples~/Art/UI/Icons/skill_icon_04.png.meta diff --git a/Assets/Art/UI/Icons/skill_icon_04_nobg.png b/Samples~/Art/UI/Icons/skill_icon_04_nobg.png similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_04_nobg.png rename to Samples~/Art/UI/Icons/skill_icon_04_nobg.png diff --git a/Assets/Art/UI/Icons/skill_icon_04_nobg.png.meta b/Samples~/Art/UI/Icons/skill_icon_04_nobg.png.meta similarity index 100% rename from Assets/Art/UI/Icons/skill_icon_04_nobg.png.meta rename to Samples~/Art/UI/Icons/skill_icon_04_nobg.png.meta diff --git a/Assets/Art/UI/Icons/stoune_icon.png b/Samples~/Art/UI/Icons/stoune_icon.png similarity index 100% rename from Assets/Art/UI/Icons/stoune_icon.png rename to Samples~/Art/UI/Icons/stoune_icon.png diff --git a/Assets/Art/UI/Icons/stoune_icon.png.meta b/Samples~/Art/UI/Icons/stoune_icon.png.meta similarity index 100% rename from Assets/Art/UI/Icons/stoune_icon.png.meta rename to Samples~/Art/UI/Icons/stoune_icon.png.meta diff --git a/Assets/Art/UI/Icons/weapon_icon.png b/Samples~/Art/UI/Icons/weapon_icon.png similarity index 100% rename from Assets/Art/UI/Icons/weapon_icon.png rename to Samples~/Art/UI/Icons/weapon_icon.png diff --git a/Assets/Art/UI/Icons/weapon_icon.png.meta b/Samples~/Art/UI/Icons/weapon_icon.png.meta similarity index 100% rename from Assets/Art/UI/Icons/weapon_icon.png.meta rename to Samples~/Art/UI/Icons/weapon_icon.png.meta diff --git a/Assets/Art/UI/Tezos_Logos.meta b/Samples~/Art/UI/Tezos_Logos.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos.meta rename to Samples~/Art/UI/Tezos_Logos.meta diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal.meta b/Samples~/Art/UI/Tezos_Logos/Horizontal.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal.meta rename to Samples~/Art/UI/Tezos_Logos/Horizontal.meta diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG.meta b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG.meta rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG.meta diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png.meta b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png.meta rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Black.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png.meta b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png.meta rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_Blue.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png diff --git a/Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png.meta b/Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png.meta rename to Samples~/Art/UI/Tezos_Logos/Horizontal/PNG/TezosLogo_Horizontal_White.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Icon.meta b/Samples~/Art/UI/Tezos_Logos/Icon.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Icon.meta rename to Samples~/Art/UI/Tezos_Logos/Icon.meta diff --git a/Assets/Art/UI/Tezos_Logos/Stacked.meta b/Samples~/Art/UI/Tezos_Logos/Stacked.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked.meta rename to Samples~/Art/UI/Tezos_Logos/Stacked.meta diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG.meta b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG.meta rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG.meta diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png.meta b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png.meta rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Black.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png.meta b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png.meta rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_Blue.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png diff --git a/Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png.meta b/Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png.meta rename to Samples~/Art/UI/Tezos_Logos/Stacked/PNG/TezosLogo_Stacked_White.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon.meta b/Samples~/Art/UI/Tezos_Logos/Tez_Icon.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon.meta rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon.meta diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG.meta b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG.meta rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG.meta diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png.meta b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png.meta rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Black.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png.meta b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png.meta rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_Blue.png.meta diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png diff --git a/Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png.meta b/Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png.meta similarity index 100% rename from Assets/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png.meta rename to Samples~/Art/UI/Tezos_Logos/Tez_Icon/PNG/TezosLogo_Icon_White.png.meta diff --git a/Assets/Audio.meta b/Samples~/Audio.meta similarity index 100% rename from Assets/Audio.meta rename to Samples~/Audio.meta diff --git a/Assets/Audio/Ambient.meta b/Samples~/Audio/Ambient.meta similarity index 100% rename from Assets/Audio/Ambient.meta rename to Samples~/Audio/Ambient.meta diff --git a/Assets/Audio/Ambient/AudioClip_Background-Ambient.wav b/Samples~/Audio/Ambient/AudioClip_Background-Ambient.wav similarity index 100% rename from Assets/Audio/Ambient/AudioClip_Background-Ambient.wav rename to Samples~/Audio/Ambient/AudioClip_Background-Ambient.wav diff --git a/Assets/Audio/Ambient/AudioClip_Background-Ambient.wav.meta b/Samples~/Audio/Ambient/AudioClip_Background-Ambient.wav.meta similarity index 100% rename from Assets/Audio/Ambient/AudioClip_Background-Ambient.wav.meta rename to Samples~/Audio/Ambient/AudioClip_Background-Ambient.wav.meta diff --git a/Assets/Audio/SFX.meta b/Samples~/Audio/SFX.meta similarity index 100% rename from Assets/Audio/SFX.meta rename to Samples~/Audio/SFX.meta diff --git a/Assets/Audio/SFX/AudioClip_Click-Medium.wav b/Samples~/Audio/SFX/AudioClip_Click-Medium.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Medium.wav rename to Samples~/Audio/SFX/AudioClip_Click-Medium.wav diff --git a/Assets/Audio/SFX/AudioClip_Click-Medium.wav.meta b/Samples~/Audio/SFX/AudioClip_Click-Medium.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Medium.wav.meta rename to Samples~/Audio/SFX/AudioClip_Click-Medium.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Click-Noisy.wav b/Samples~/Audio/SFX/AudioClip_Click-Noisy.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Noisy.wav rename to Samples~/Audio/SFX/AudioClip_Click-Noisy.wav diff --git a/Assets/Audio/SFX/AudioClip_Click-Noisy.wav.meta b/Samples~/Audio/SFX/AudioClip_Click-Noisy.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Noisy.wav.meta rename to Samples~/Audio/SFX/AudioClip_Click-Noisy.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Click-Soft.wav b/Samples~/Audio/SFX/AudioClip_Click-Soft.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Soft.wav rename to Samples~/Audio/SFX/AudioClip_Click-Soft.wav diff --git a/Assets/Audio/SFX/AudioClip_Click-Soft.wav.meta b/Samples~/Audio/SFX/AudioClip_Click-Soft.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Soft.wav.meta rename to Samples~/Audio/SFX/AudioClip_Click-Soft.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Click-Springy.wav b/Samples~/Audio/SFX/AudioClip_Click-Springy.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Springy.wav rename to Samples~/Audio/SFX/AudioClip_Click-Springy.wav diff --git a/Assets/Audio/SFX/AudioClip_Click-Springy.wav.meta b/Samples~/Audio/SFX/AudioClip_Click-Springy.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Springy.wav.meta rename to Samples~/Audio/SFX/AudioClip_Click-Springy.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Click-Switch.wav b/Samples~/Audio/SFX/AudioClip_Click-Switch.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Switch.wav rename to Samples~/Audio/SFX/AudioClip_Click-Switch.wav diff --git a/Assets/Audio/SFX/AudioClip_Click-Switch.wav.meta b/Samples~/Audio/SFX/AudioClip_Click-Switch.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Switch.wav.meta rename to Samples~/Audio/SFX/AudioClip_Click-Switch.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Click-Tap.wav b/Samples~/Audio/SFX/AudioClip_Click-Tap.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Tap.wav rename to Samples~/Audio/SFX/AudioClip_Click-Tap.wav diff --git a/Assets/Audio/SFX/AudioClip_Click-Tap.wav.meta b/Samples~/Audio/SFX/AudioClip_Click-Tap.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Click-Tap.wav.meta rename to Samples~/Audio/SFX/AudioClip_Click-Tap.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Error.wav b/Samples~/Audio/SFX/AudioClip_Error.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Error.wav rename to Samples~/Audio/SFX/AudioClip_Error.wav diff --git a/Assets/Audio/SFX/AudioClip_Error.wav.meta b/Samples~/Audio/SFX/AudioClip_Error.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Error.wav.meta rename to Samples~/Audio/SFX/AudioClip_Error.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_PotionDrop.wav b/Samples~/Audio/SFX/AudioClip_PotionDrop.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_PotionDrop.wav rename to Samples~/Audio/SFX/AudioClip_PotionDrop.wav diff --git a/Assets/Audio/SFX/AudioClip_PotionDrop.wav.meta b/Samples~/Audio/SFX/AudioClip_PotionDrop.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_PotionDrop.wav.meta rename to Samples~/Audio/SFX/AudioClip_PotionDrop.wav.meta diff --git a/Assets/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav b/Samples~/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav similarity index 100% rename from Assets/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav rename to Samples~/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav diff --git a/Assets/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav.meta b/Samples~/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav.meta similarity index 100% rename from Assets/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav.meta rename to Samples~/Audio/SFX/AudioClip_Purchase-Cha-Ching.wav.meta diff --git a/Assets/Contracts.meta b/Samples~/Contracts.meta similarity index 100% rename from Assets/Contracts.meta rename to Samples~/Contracts.meta diff --git a/Assets/Contracts/FA2.meta b/Samples~/Contracts/FA2.meta similarity index 100% rename from Assets/Contracts/FA2.meta rename to Samples~/Contracts/FA2.meta diff --git a/Assets/Contracts/FA2/balance_of.jsligo b/Samples~/Contracts/FA2/balance_of.jsligo similarity index 100% rename from Assets/Contracts/FA2/balance_of.jsligo rename to Samples~/Contracts/FA2/balance_of.jsligo diff --git a/Assets/Contracts/FA2/balance_of.jsligo.meta b/Samples~/Contracts/FA2/balance_of.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/balance_of.jsligo.meta rename to Samples~/Contracts/FA2/balance_of.jsligo.meta diff --git a/Assets/Contracts/FA2/errors.jsligo b/Samples~/Contracts/FA2/errors.jsligo similarity index 100% rename from Assets/Contracts/FA2/errors.jsligo rename to Samples~/Contracts/FA2/errors.jsligo diff --git a/Assets/Contracts/FA2/errors.jsligo.meta b/Samples~/Contracts/FA2/errors.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/errors.jsligo.meta rename to Samples~/Contracts/FA2/errors.jsligo.meta diff --git a/Assets/Contracts/FA2/ledger.jsligo b/Samples~/Contracts/FA2/ledger.jsligo similarity index 100% rename from Assets/Contracts/FA2/ledger.jsligo rename to Samples~/Contracts/FA2/ledger.jsligo diff --git a/Assets/Contracts/FA2/ledger.jsligo.meta b/Samples~/Contracts/FA2/ledger.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/ledger.jsligo.meta rename to Samples~/Contracts/FA2/ledger.jsligo.meta diff --git a/Assets/Contracts/FA2/marketplace.jsligo b/Samples~/Contracts/FA2/marketplace.jsligo similarity index 100% rename from Assets/Contracts/FA2/marketplace.jsligo rename to Samples~/Contracts/FA2/marketplace.jsligo diff --git a/Assets/Contracts/FA2/marketplace.jsligo.meta b/Samples~/Contracts/FA2/marketplace.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/marketplace.jsligo.meta rename to Samples~/Contracts/FA2/marketplace.jsligo.meta diff --git a/Assets/Contracts/FA2/metadata.jsligo b/Samples~/Contracts/FA2/metadata.jsligo similarity index 100% rename from Assets/Contracts/FA2/metadata.jsligo rename to Samples~/Contracts/FA2/metadata.jsligo diff --git a/Assets/Contracts/FA2/metadata.jsligo.meta b/Samples~/Contracts/FA2/metadata.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/metadata.jsligo.meta rename to Samples~/Contracts/FA2/metadata.jsligo.meta diff --git a/Assets/Contracts/FA2/operators.jsligo b/Samples~/Contracts/FA2/operators.jsligo similarity index 100% rename from Assets/Contracts/FA2/operators.jsligo rename to Samples~/Contracts/FA2/operators.jsligo diff --git a/Assets/Contracts/FA2/operators.jsligo.meta b/Samples~/Contracts/FA2/operators.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/operators.jsligo.meta rename to Samples~/Contracts/FA2/operators.jsligo.meta diff --git a/Assets/Contracts/FA2/storage.jsligo b/Samples~/Contracts/FA2/storage.jsligo similarity index 100% rename from Assets/Contracts/FA2/storage.jsligo rename to Samples~/Contracts/FA2/storage.jsligo diff --git a/Assets/Contracts/FA2/storage.jsligo.meta b/Samples~/Contracts/FA2/storage.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/storage.jsligo.meta rename to Samples~/Contracts/FA2/storage.jsligo.meta diff --git a/Assets/Contracts/FA2/transfer.jsligo b/Samples~/Contracts/FA2/transfer.jsligo similarity index 100% rename from Assets/Contracts/FA2/transfer.jsligo rename to Samples~/Contracts/FA2/transfer.jsligo diff --git a/Assets/Contracts/FA2/transfer.jsligo.meta b/Samples~/Contracts/FA2/transfer.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/transfer.jsligo.meta rename to Samples~/Contracts/FA2/transfer.jsligo.meta diff --git a/Assets/Contracts/FA2/update_ops.jsligo b/Samples~/Contracts/FA2/update_ops.jsligo similarity index 100% rename from Assets/Contracts/FA2/update_ops.jsligo rename to Samples~/Contracts/FA2/update_ops.jsligo diff --git a/Assets/Contracts/FA2/update_ops.jsligo.meta b/Samples~/Contracts/FA2/update_ops.jsligo.meta similarity index 100% rename from Assets/Contracts/FA2/update_ops.jsligo.meta rename to Samples~/Contracts/FA2/update_ops.jsligo.meta diff --git a/Assets/Contracts/_Misc.meta b/Samples~/Contracts/_Misc.meta similarity index 100% rename from Assets/Contracts/_Misc.meta rename to Samples~/Contracts/_Misc.meta diff --git a/Assets/Contracts/_Misc/ValuesViewer.jsligo b/Samples~/Contracts/_Misc/ValuesViewer.jsligo similarity index 100% rename from Assets/Contracts/_Misc/ValuesViewer.jsligo rename to Samples~/Contracts/_Misc/ValuesViewer.jsligo diff --git a/Assets/Contracts/_Misc/ValuesViewer.jsligo.meta b/Samples~/Contracts/_Misc/ValuesViewer.jsligo.meta similarity index 100% rename from Assets/Contracts/_Misc/ValuesViewer.jsligo.meta rename to Samples~/Contracts/_Misc/ValuesViewer.jsligo.meta diff --git a/Assets/Contracts/_Misc/config.sh b/Samples~/Contracts/_Misc/config.sh similarity index 100% rename from Assets/Contracts/_Misc/config.sh rename to Samples~/Contracts/_Misc/config.sh diff --git a/Assets/Contracts/_Misc/config.sh.meta b/Samples~/Contracts/_Misc/config.sh.meta similarity index 100% rename from Assets/Contracts/_Misc/config.sh.meta rename to Samples~/Contracts/_Misc/config.sh.meta diff --git a/Assets/Contracts/_Misc/env b/Samples~/Contracts/_Misc/env similarity index 100% rename from Assets/Contracts/_Misc/env rename to Samples~/Contracts/_Misc/env diff --git a/Assets/Contracts/_Misc/env.meta b/Samples~/Contracts/_Misc/env.meta similarity index 100% rename from Assets/Contracts/_Misc/env.meta rename to Samples~/Contracts/_Misc/env.meta diff --git a/Assets/Contracts/_Misc/incrementer.jsligo b/Samples~/Contracts/_Misc/incrementer.jsligo similarity index 100% rename from Assets/Contracts/_Misc/incrementer.jsligo rename to Samples~/Contracts/_Misc/incrementer.jsligo diff --git a/Assets/Contracts/_Misc/incrementer.jsligo.meta b/Samples~/Contracts/_Misc/incrementer.jsligo.meta similarity index 100% rename from Assets/Contracts/_Misc/incrementer.jsligo.meta rename to Samples~/Contracts/_Misc/incrementer.jsligo.meta diff --git a/Assets/Contracts/_Misc/jakartanet.json b/Samples~/Contracts/_Misc/jakartanet.json similarity index 100% rename from Assets/Contracts/_Misc/jakartanet.json rename to Samples~/Contracts/_Misc/jakartanet.json diff --git a/Assets/Contracts/_Misc/jakartanet.json.meta b/Samples~/Contracts/_Misc/jakartanet.json.meta similarity index 100% rename from Assets/Contracts/_Misc/jakartanet.json.meta rename to Samples~/Contracts/_Misc/jakartanet.json.meta diff --git a/Assets/Contracts/_Misc/mint_original.jsligo b/Samples~/Contracts/_Misc/mint_original.jsligo similarity index 100% rename from Assets/Contracts/_Misc/mint_original.jsligo rename to Samples~/Contracts/_Misc/mint_original.jsligo diff --git a/Assets/Contracts/_Misc/mint_original.jsligo.meta b/Samples~/Contracts/_Misc/mint_original.jsligo.meta similarity index 100% rename from Assets/Contracts/_Misc/mint_original.jsligo.meta rename to Samples~/Contracts/_Misc/mint_original.jsligo.meta diff --git a/Assets/Contracts/_Misc/valuesViewer.tz b/Samples~/Contracts/_Misc/valuesViewer.tz similarity index 100% rename from Assets/Contracts/_Misc/valuesViewer.tz rename to Samples~/Contracts/_Misc/valuesViewer.tz diff --git a/Assets/Contracts/_Misc/valuesViewer.tz.meta b/Samples~/Contracts/_Misc/valuesViewer.tz.meta similarity index 100% rename from Assets/Contracts/_Misc/valuesViewer.tz.meta rename to Samples~/Contracts/_Misc/valuesViewer.tz.meta diff --git a/Assets/Contracts/item.jsligo b/Samples~/Contracts/item.jsligo similarity index 100% rename from Assets/Contracts/item.jsligo rename to Samples~/Contracts/item.jsligo diff --git a/Assets/Contracts/item.jsligo.meta b/Samples~/Contracts/item.jsligo.meta similarity index 100% rename from Assets/Contracts/item.jsligo.meta rename to Samples~/Contracts/item.jsligo.meta diff --git a/Assets/Contracts/login.jsligo b/Samples~/Contracts/login.jsligo similarity index 100% rename from Assets/Contracts/login.jsligo rename to Samples~/Contracts/login.jsligo diff --git a/Assets/Contracts/login.jsligo.meta b/Samples~/Contracts/login.jsligo.meta similarity index 100% rename from Assets/Contracts/login.jsligo.meta rename to Samples~/Contracts/login.jsligo.meta diff --git a/Assets/Contracts/main.jsligo b/Samples~/Contracts/main.jsligo similarity index 100% rename from Assets/Contracts/main.jsligo rename to Samples~/Contracts/main.jsligo diff --git a/Assets/Contracts/main.jsligo.meta b/Samples~/Contracts/main.jsligo.meta similarity index 100% rename from Assets/Contracts/main.jsligo.meta rename to Samples~/Contracts/main.jsligo.meta diff --git a/Assets/Contracts/mint.jsligo b/Samples~/Contracts/mint.jsligo similarity index 100% rename from Assets/Contracts/mint.jsligo rename to Samples~/Contracts/mint.jsligo diff --git a/Assets/Contracts/mint.jsligo.meta b/Samples~/Contracts/mint.jsligo.meta similarity index 100% rename from Assets/Contracts/mint.jsligo.meta rename to Samples~/Contracts/mint.jsligo.meta diff --git a/Assets/Plugins.meta b/Samples~/Plugins.meta similarity index 100% rename from Assets/Plugins.meta rename to Samples~/Plugins.meta diff --git a/Assets/Plugins/JS.meta b/Samples~/Plugins/JS.meta similarity index 100% rename from Assets/Plugins/JS.meta rename to Samples~/Plugins/JS.meta diff --git a/Assets/Plugins/JS/BeaconConnection.jslib b/Samples~/Plugins/JS/BeaconConnection.jslib similarity index 100% rename from Assets/Plugins/JS/BeaconConnection.jslib rename to Samples~/Plugins/JS/BeaconConnection.jslib diff --git a/Assets/Plugins/JS/BeaconConnection.jslib.meta b/Samples~/Plugins/JS/BeaconConnection.jslib.meta similarity index 100% rename from Assets/Plugins/JS/BeaconConnection.jslib.meta rename to Samples~/Plugins/JS/BeaconConnection.jslib.meta diff --git a/Assets/Plugins/ZXing.meta b/Samples~/Plugins/ZXing.meta similarity index 100% rename from Assets/Plugins/ZXing.meta rename to Samples~/Plugins/ZXing.meta diff --git a/Assets/Plugins/ZXing/zxing.unity.dll b/Samples~/Plugins/ZXing/zxing.unity.dll similarity index 100% rename from Assets/Plugins/ZXing/zxing.unity.dll rename to Samples~/Plugins/ZXing/zxing.unity.dll diff --git a/Assets/Plugins/ZXing/zxing.unity.dll.meta b/Samples~/Plugins/ZXing/zxing.unity.dll.meta similarity index 100% rename from Assets/Plugins/ZXing/zxing.unity.dll.meta rename to Samples~/Plugins/ZXing/zxing.unity.dll.meta diff --git a/Assets/Prefabs.meta b/Samples~/Prefabs.meta similarity index 100% rename from Assets/Prefabs.meta rename to Samples~/Prefabs.meta diff --git a/Assets/Prefabs/DemoExample.meta b/Samples~/Prefabs/DemoExample.meta similarity index 100% rename from Assets/Prefabs/DemoExample.meta rename to Samples~/Prefabs/DemoExample.meta diff --git a/Assets/Prefabs/DemoExample/InventoryItem_View.prefab b/Samples~/Prefabs/DemoExample/InventoryItem_View.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/InventoryItem_View.prefab rename to Samples~/Prefabs/DemoExample/InventoryItem_View.prefab diff --git a/Assets/Prefabs/DemoExample/InventoryItem_View.prefab.meta b/Samples~/Prefabs/DemoExample/InventoryItem_View.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/InventoryItem_View.prefab.meta rename to Samples~/Prefabs/DemoExample/InventoryItem_View.prefab.meta diff --git a/Assets/Prefabs/DemoExample/InventoryPanel.prefab b/Samples~/Prefabs/DemoExample/InventoryPanel.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/InventoryPanel.prefab rename to Samples~/Prefabs/DemoExample/InventoryPanel.prefab diff --git a/Assets/Prefabs/DemoExample/InventoryPanel.prefab.meta b/Samples~/Prefabs/DemoExample/InventoryPanel.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/InventoryPanel.prefab.meta rename to Samples~/Prefabs/DemoExample/InventoryPanel.prefab.meta diff --git a/Assets/Prefabs/DemoExample/MarketItem_View.prefab b/Samples~/Prefabs/DemoExample/MarketItem_View.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/MarketItem_View.prefab rename to Samples~/Prefabs/DemoExample/MarketItem_View.prefab diff --git a/Assets/Prefabs/DemoExample/MarketItem_View.prefab.meta b/Samples~/Prefabs/DemoExample/MarketItem_View.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/MarketItem_View.prefab.meta rename to Samples~/Prefabs/DemoExample/MarketItem_View.prefab.meta diff --git a/Assets/Prefabs/DemoExample/MarketPanel.prefab b/Samples~/Prefabs/DemoExample/MarketPanel.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/MarketPanel.prefab rename to Samples~/Prefabs/DemoExample/MarketPanel.prefab diff --git a/Assets/Prefabs/DemoExample/MarketPanel.prefab.meta b/Samples~/Prefabs/DemoExample/MarketPanel.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/MarketPanel.prefab.meta rename to Samples~/Prefabs/DemoExample/MarketPanel.prefab.meta diff --git a/Assets/Prefabs/DemoExample/RegisterPanel.prefab b/Samples~/Prefabs/DemoExample/RegisterPanel.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/RegisterPanel.prefab rename to Samples~/Prefabs/DemoExample/RegisterPanel.prefab diff --git a/Assets/Prefabs/DemoExample/RegisterPanel.prefab.meta b/Samples~/Prefabs/DemoExample/RegisterPanel.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/RegisterPanel.prefab.meta rename to Samples~/Prefabs/DemoExample/RegisterPanel.prefab.meta diff --git a/Assets/Prefabs/DemoExample/SideMenu.prefab b/Samples~/Prefabs/DemoExample/SideMenu.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/SideMenu.prefab rename to Samples~/Prefabs/DemoExample/SideMenu.prefab diff --git a/Assets/Prefabs/DemoExample/SideMenu.prefab.meta b/Samples~/Prefabs/DemoExample/SideMenu.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/SideMenu.prefab.meta rename to Samples~/Prefabs/DemoExample/SideMenu.prefab.meta diff --git a/Assets/Prefabs/DemoExample/Statblock_Stats.prefab b/Samples~/Prefabs/DemoExample/Statblock_Stats.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/Statblock_Stats.prefab rename to Samples~/Prefabs/DemoExample/Statblock_Stats.prefab diff --git a/Assets/Prefabs/DemoExample/Statblock_Stats.prefab.meta b/Samples~/Prefabs/DemoExample/Statblock_Stats.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/Statblock_Stats.prefab.meta rename to Samples~/Prefabs/DemoExample/Statblock_Stats.prefab.meta diff --git a/Assets/Prefabs/DemoExample/Stats_Text.prefab b/Samples~/Prefabs/DemoExample/Stats_Text.prefab similarity index 100% rename from Assets/Prefabs/DemoExample/Stats_Text.prefab rename to Samples~/Prefabs/DemoExample/Stats_Text.prefab diff --git a/Assets/Prefabs/DemoExample/Stats_Text.prefab.meta b/Samples~/Prefabs/DemoExample/Stats_Text.prefab.meta similarity index 100% rename from Assets/Prefabs/DemoExample/Stats_Text.prefab.meta rename to Samples~/Prefabs/DemoExample/Stats_Text.prefab.meta diff --git a/Assets/Resources.meta b/Samples~/Resources.meta similarity index 100% rename from Assets/Resources.meta rename to Samples~/Resources.meta diff --git a/Assets/Resources/Items.meta b/Samples~/Resources/Items.meta similarity index 100% rename from Assets/Resources/Items.meta rename to Samples~/Resources/Items.meta diff --git a/Assets/Resources/Items/TestItem 0.asset b/Samples~/Resources/Items/TestItem 0.asset similarity index 100% rename from Assets/Resources/Items/TestItem 0.asset rename to Samples~/Resources/Items/TestItem 0.asset diff --git a/Assets/Resources/Items/TestItem 0.asset.meta b/Samples~/Resources/Items/TestItem 0.asset.meta similarity index 100% rename from Assets/Resources/Items/TestItem 0.asset.meta rename to Samples~/Resources/Items/TestItem 0.asset.meta diff --git a/Assets/Resources/Items/TestItem 1.asset b/Samples~/Resources/Items/TestItem 1.asset similarity index 100% rename from Assets/Resources/Items/TestItem 1.asset rename to Samples~/Resources/Items/TestItem 1.asset diff --git a/Assets/Resources/Items/TestItem 1.asset.meta b/Samples~/Resources/Items/TestItem 1.asset.meta similarity index 100% rename from Assets/Resources/Items/TestItem 1.asset.meta rename to Samples~/Resources/Items/TestItem 1.asset.meta diff --git a/Assets/Resources/Items/TestItem 2.asset b/Samples~/Resources/Items/TestItem 2.asset similarity index 100% rename from Assets/Resources/Items/TestItem 2.asset rename to Samples~/Resources/Items/TestItem 2.asset diff --git a/Assets/Resources/Items/TestItem 2.asset.meta b/Samples~/Resources/Items/TestItem 2.asset.meta similarity index 100% rename from Assets/Resources/Items/TestItem 2.asset.meta rename to Samples~/Resources/Items/TestItem 2.asset.meta diff --git a/Assets/Resources/Items/TestItem 3.asset b/Samples~/Resources/Items/TestItem 3.asset similarity index 100% rename from Assets/Resources/Items/TestItem 3.asset rename to Samples~/Resources/Items/TestItem 3.asset diff --git a/Assets/Resources/Items/TestItem 3.asset.meta b/Samples~/Resources/Items/TestItem 3.asset.meta similarity index 100% rename from Assets/Resources/Items/TestItem 3.asset.meta rename to Samples~/Resources/Items/TestItem 3.asset.meta diff --git a/Assets/Resources/Items/TestItem 4.asset b/Samples~/Resources/Items/TestItem 4.asset similarity index 100% rename from Assets/Resources/Items/TestItem 4.asset rename to Samples~/Resources/Items/TestItem 4.asset diff --git a/Assets/Resources/Items/TestItem 4.asset.meta b/Samples~/Resources/Items/TestItem 4.asset.meta similarity index 100% rename from Assets/Resources/Items/TestItem 4.asset.meta rename to Samples~/Resources/Items/TestItem 4.asset.meta diff --git a/Assets/Scenes.meta b/Samples~/Scenes.meta similarity index 100% rename from Assets/Scenes.meta rename to Samples~/Scenes.meta diff --git a/Assets/Scenes/Demo Example.unity b/Samples~/Scenes/Demo Example.unity similarity index 100% rename from Assets/Scenes/Demo Example.unity rename to Samples~/Scenes/Demo Example.unity diff --git a/Assets/Scenes/Demo Example.unity.meta b/Samples~/Scenes/Demo Example.unity.meta similarity index 100% rename from Assets/Scenes/Demo Example.unity.meta rename to Samples~/Scenes/Demo Example.unity.meta diff --git a/Assets/Plugins/Android/Source.meta b/Samples~/Scripts.meta similarity index 77% rename from Assets/Plugins/Android/Source.meta rename to Samples~/Scripts.meta index 25c67c62..bf2a29f2 100644 --- a/Assets/Plugins/Android/Source.meta +++ b/Samples~/Scripts.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7f4888e4ddb24df4aa9723b50d07d0b7 +guid: 6eca3ac97179445708c8bbb1ea490689 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Scripts/DemoExample.meta b/Samples~/Scripts/DemoExample.meta similarity index 100% rename from Assets/Scripts/DemoExample.meta rename to Samples~/Scripts/DemoExample.meta diff --git a/Assets/Scripts/DemoExample/CopyToClipboard.cs b/Samples~/Scripts/DemoExample/CopyToClipboard.cs similarity index 100% rename from Assets/Scripts/DemoExample/CopyToClipboard.cs rename to Samples~/Scripts/DemoExample/CopyToClipboard.cs diff --git a/Assets/Scripts/DemoExample/CopyToClipboard.cs.meta b/Samples~/Scripts/DemoExample/CopyToClipboard.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/CopyToClipboard.cs.meta rename to Samples~/Scripts/DemoExample/CopyToClipboard.cs.meta diff --git a/Assets/Scripts/DemoExample/Core.meta b/Samples~/Scripts/DemoExample/Core.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core.meta rename to Samples~/Scripts/DemoExample/Core.meta diff --git a/Assets/Scripts/DemoExample/Core/ExampleManager.cs b/Samples~/Scripts/DemoExample/Core/ExampleManager.cs similarity index 98% rename from Assets/Scripts/DemoExample/Core/ExampleManager.cs rename to Samples~/Scripts/DemoExample/Core/ExampleManager.cs index 12ce45e0..a1e47fc0 100644 --- a/Assets/Scripts/DemoExample/Core/ExampleManager.cs +++ b/Samples~/Scripts/DemoExample/Core/ExampleManager.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Text.Json; +using BeaconSDK; using Netezos.Encoding; using UnityEngine; using TezosAPI; @@ -193,7 +194,7 @@ public void BuyItem(string owner, int itemID) _tezos.CallContract(contractAddress, entryPoint, parameter, 0); #if UNITY_IOS || UNITY_ANDROID - Application.OpenURL("temple://"); + Application.OpenURL("tezos://"); #endif } @@ -206,7 +207,7 @@ public void MintItem() _tezos.CallContract(contractAddress, entrypoint, input, 0); #if UNITY_IOS || UNITY_ANDROID - Application.OpenURL("temple://"); + Application.OpenURL("tezos://"); #endif } @@ -329,9 +330,7 @@ public void GetCoins() _tezos.CallContract(contractAddress, entryPoint, parameter, 0); -#if UNITY_IOS - Application.OpenURL("temple://"); -#elif UNITY_ANDROID +#if UNITY_IOS || UNITY_ANDROID Application.OpenURL("tezos://"); #endif } @@ -368,7 +367,10 @@ public void RequestTezosPermission() public void RequestSignPayload(int signingType, string payload) { _tezos.RequestSignPayload(signingType, payload); - _tezos.ConnectWallet(); + +#if UNITY_IOS || UNITY_ANDROID + Application.OpenURL("tezos://"); +#endif } public bool VerifyPayload(string payload) diff --git a/Assets/Scripts/DemoExample/Core/ExampleManager.cs.meta b/Samples~/Scripts/DemoExample/Core/ExampleManager.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core/ExampleManager.cs.meta rename to Samples~/Scripts/DemoExample/Core/ExampleManager.cs.meta diff --git a/Assets/Scripts/DemoExample/Core/IExampleManager.cs b/Samples~/Scripts/DemoExample/Core/IExampleManager.cs similarity index 100% rename from Assets/Scripts/DemoExample/Core/IExampleManager.cs rename to Samples~/Scripts/DemoExample/Core/IExampleManager.cs diff --git a/Assets/Scripts/DemoExample/Core/IExampleManager.cs.meta b/Samples~/Scripts/DemoExample/Core/IExampleManager.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core/IExampleManager.cs.meta rename to Samples~/Scripts/DemoExample/Core/IExampleManager.cs.meta diff --git a/Assets/Scripts/DemoExample/Core/IItemModel.cs b/Samples~/Scripts/DemoExample/Core/IItemModel.cs similarity index 100% rename from Assets/Scripts/DemoExample/Core/IItemModel.cs rename to Samples~/Scripts/DemoExample/Core/IItemModel.cs diff --git a/Assets/Scripts/DemoExample/Core/IItemModel.cs.meta b/Samples~/Scripts/DemoExample/Core/IItemModel.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core/IItemModel.cs.meta rename to Samples~/Scripts/DemoExample/Core/IItemModel.cs.meta diff --git a/Assets/Scripts/DemoExample/Core/IUserModel.cs b/Samples~/Scripts/DemoExample/Core/IUserModel.cs similarity index 100% rename from Assets/Scripts/DemoExample/Core/IUserModel.cs rename to Samples~/Scripts/DemoExample/Core/IUserModel.cs diff --git a/Assets/Scripts/DemoExample/Core/IUserModel.cs.meta b/Samples~/Scripts/DemoExample/Core/IUserModel.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core/IUserModel.cs.meta rename to Samples~/Scripts/DemoExample/Core/IUserModel.cs.meta diff --git a/Assets/Scripts/DemoExample/Core/Item.cs b/Samples~/Scripts/DemoExample/Core/Item.cs similarity index 100% rename from Assets/Scripts/DemoExample/Core/Item.cs rename to Samples~/Scripts/DemoExample/Core/Item.cs diff --git a/Assets/Scripts/DemoExample/Core/Item.cs.meta b/Samples~/Scripts/DemoExample/Core/Item.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core/Item.cs.meta rename to Samples~/Scripts/DemoExample/Core/Item.cs.meta diff --git a/Assets/Scripts/DemoExample/Core/User.cs b/Samples~/Scripts/DemoExample/Core/User.cs similarity index 100% rename from Assets/Scripts/DemoExample/Core/User.cs rename to Samples~/Scripts/DemoExample/Core/User.cs diff --git a/Assets/Scripts/DemoExample/Core/User.cs.meta b/Samples~/Scripts/DemoExample/Core/User.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/Core/User.cs.meta rename to Samples~/Scripts/DemoExample/Core/User.cs.meta diff --git a/Assets/Scripts/DemoExample/ExampleFactory.cs b/Samples~/Scripts/DemoExample/ExampleFactory.cs similarity index 100% rename from Assets/Scripts/DemoExample/ExampleFactory.cs rename to Samples~/Scripts/DemoExample/ExampleFactory.cs diff --git a/Assets/Scripts/DemoExample/ExampleFactory.cs.meta b/Samples~/Scripts/DemoExample/ExampleFactory.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/ExampleFactory.cs.meta rename to Samples~/Scripts/DemoExample/ExampleFactory.cs.meta diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs b/Samples~/Scripts/DemoExample/InventoryManager.cs similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs rename to Samples~/Scripts/DemoExample/InventoryManager.cs diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.BASE b/Samples~/Scripts/DemoExample/InventoryManager.cs.BASE similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.BASE rename to Samples~/Scripts/DemoExample/InventoryManager.cs.BASE diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.BASE.meta b/Samples~/Scripts/DemoExample/InventoryManager.cs.BASE.meta similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.BASE.meta rename to Samples~/Scripts/DemoExample/InventoryManager.cs.BASE.meta diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.LOCAL b/Samples~/Scripts/DemoExample/InventoryManager.cs.LOCAL similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.LOCAL rename to Samples~/Scripts/DemoExample/InventoryManager.cs.LOCAL diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.LOCAL.meta b/Samples~/Scripts/DemoExample/InventoryManager.cs.LOCAL.meta similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.LOCAL.meta rename to Samples~/Scripts/DemoExample/InventoryManager.cs.LOCAL.meta diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.REMOTE b/Samples~/Scripts/DemoExample/InventoryManager.cs.REMOTE similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.REMOTE rename to Samples~/Scripts/DemoExample/InventoryManager.cs.REMOTE diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.REMOTE.meta b/Samples~/Scripts/DemoExample/InventoryManager.cs.REMOTE.meta similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.REMOTE.meta rename to Samples~/Scripts/DemoExample/InventoryManager.cs.REMOTE.meta diff --git a/Assets/Scripts/DemoExample/InventoryManager.cs.meta b/Samples~/Scripts/DemoExample/InventoryManager.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/InventoryManager.cs.meta rename to Samples~/Scripts/DemoExample/InventoryManager.cs.meta diff --git a/Assets/Scripts/DemoExample/MarketManager.cs b/Samples~/Scripts/DemoExample/MarketManager.cs similarity index 100% rename from Assets/Scripts/DemoExample/MarketManager.cs rename to Samples~/Scripts/DemoExample/MarketManager.cs diff --git a/Assets/Scripts/DemoExample/MarketManager.cs.meta b/Samples~/Scripts/DemoExample/MarketManager.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/MarketManager.cs.meta rename to Samples~/Scripts/DemoExample/MarketManager.cs.meta diff --git a/Assets/Scripts/DemoExample/UI.meta b/Samples~/Scripts/DemoExample/UI.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI.meta rename to Samples~/Scripts/DemoExample/UI.meta diff --git a/Assets/Scripts/DemoExample/UI/Draggable.cs b/Samples~/Scripts/DemoExample/UI/Draggable.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/Draggable.cs rename to Samples~/Scripts/DemoExample/UI/Draggable.cs diff --git a/Assets/Scripts/DemoExample/UI/Draggable.cs.meta b/Samples~/Scripts/DemoExample/UI/Draggable.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/Draggable.cs.meta rename to Samples~/Scripts/DemoExample/UI/Draggable.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/DraggableItemVisual.cs b/Samples~/Scripts/DemoExample/UI/DraggableItemVisual.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/DraggableItemVisual.cs rename to Samples~/Scripts/DemoExample/UI/DraggableItemVisual.cs diff --git a/Assets/Scripts/DemoExample/UI/DraggableItemVisual.cs.meta b/Samples~/Scripts/DemoExample/UI/DraggableItemVisual.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/DraggableItemVisual.cs.meta rename to Samples~/Scripts/DemoExample/UI/DraggableItemVisual.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/FlexibleGridLayout.cs b/Samples~/Scripts/DemoExample/UI/FlexibleGridLayout.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/FlexibleGridLayout.cs rename to Samples~/Scripts/DemoExample/UI/FlexibleGridLayout.cs diff --git a/Assets/Scripts/DemoExample/UI/FlexibleGridLayout.cs.meta b/Samples~/Scripts/DemoExample/UI/FlexibleGridLayout.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/FlexibleGridLayout.cs.meta rename to Samples~/Scripts/DemoExample/UI/FlexibleGridLayout.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/ItemController.cs b/Samples~/Scripts/DemoExample/UI/ItemController.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemController.cs rename to Samples~/Scripts/DemoExample/UI/ItemController.cs diff --git a/Assets/Scripts/DemoExample/UI/ItemController.cs.meta b/Samples~/Scripts/DemoExample/UI/ItemController.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemController.cs.meta rename to Samples~/Scripts/DemoExample/UI/ItemController.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/ItemSlot.cs b/Samples~/Scripts/DemoExample/UI/ItemSlot.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemSlot.cs rename to Samples~/Scripts/DemoExample/UI/ItemSlot.cs diff --git a/Assets/Scripts/DemoExample/UI/ItemSlot.cs.meta b/Samples~/Scripts/DemoExample/UI/ItemSlot.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemSlot.cs.meta rename to Samples~/Scripts/DemoExample/UI/ItemSlot.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/ItemSnapPoint.cs b/Samples~/Scripts/DemoExample/UI/ItemSnapPoint.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemSnapPoint.cs rename to Samples~/Scripts/DemoExample/UI/ItemSnapPoint.cs diff --git a/Assets/Scripts/DemoExample/UI/ItemSnapPoint.cs.meta b/Samples~/Scripts/DemoExample/UI/ItemSnapPoint.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemSnapPoint.cs.meta rename to Samples~/Scripts/DemoExample/UI/ItemSnapPoint.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/ItemView.cs b/Samples~/Scripts/DemoExample/UI/ItemView.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemView.cs rename to Samples~/Scripts/DemoExample/UI/ItemView.cs diff --git a/Assets/Scripts/DemoExample/UI/ItemView.cs.meta b/Samples~/Scripts/DemoExample/UI/ItemView.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/ItemView.cs.meta rename to Samples~/Scripts/DemoExample/UI/ItemView.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/MarketItemController.cs b/Samples~/Scripts/DemoExample/UI/MarketItemController.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/MarketItemController.cs rename to Samples~/Scripts/DemoExample/UI/MarketItemController.cs diff --git a/Assets/Scripts/DemoExample/UI/MarketItemController.cs.meta b/Samples~/Scripts/DemoExample/UI/MarketItemController.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/MarketItemController.cs.meta rename to Samples~/Scripts/DemoExample/UI/MarketItemController.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/PanelController.cs b/Samples~/Scripts/DemoExample/UI/PanelController.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/PanelController.cs rename to Samples~/Scripts/DemoExample/UI/PanelController.cs diff --git a/Assets/Scripts/DemoExample/UI/PanelController.cs.meta b/Samples~/Scripts/DemoExample/UI/PanelController.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/PanelController.cs.meta rename to Samples~/Scripts/DemoExample/UI/PanelController.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/RegisterPanel.cs b/Samples~/Scripts/DemoExample/UI/RegisterPanel.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/RegisterPanel.cs rename to Samples~/Scripts/DemoExample/UI/RegisterPanel.cs diff --git a/Assets/Scripts/DemoExample/UI/RegisterPanel.cs.meta b/Samples~/Scripts/DemoExample/UI/RegisterPanel.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/RegisterPanel.cs.meta rename to Samples~/Scripts/DemoExample/UI/RegisterPanel.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/SnapController.cs b/Samples~/Scripts/DemoExample/UI/SnapController.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/SnapController.cs rename to Samples~/Scripts/DemoExample/UI/SnapController.cs diff --git a/Assets/Scripts/DemoExample/UI/SnapController.cs.meta b/Samples~/Scripts/DemoExample/UI/SnapController.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/SnapController.cs.meta rename to Samples~/Scripts/DemoExample/UI/SnapController.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/StatTextView.cs b/Samples~/Scripts/DemoExample/UI/StatTextView.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/StatTextView.cs rename to Samples~/Scripts/DemoExample/UI/StatTextView.cs diff --git a/Assets/Scripts/DemoExample/UI/StatTextView.cs.meta b/Samples~/Scripts/DemoExample/UI/StatTextView.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/StatTextView.cs.meta rename to Samples~/Scripts/DemoExample/UI/StatTextView.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/StatsView.cs b/Samples~/Scripts/DemoExample/UI/StatsView.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/StatsView.cs rename to Samples~/Scripts/DemoExample/UI/StatsView.cs diff --git a/Assets/Scripts/DemoExample/UI/StatsView.cs.meta b/Samples~/Scripts/DemoExample/UI/StatsView.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/StatsView.cs.meta rename to Samples~/Scripts/DemoExample/UI/StatsView.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/TabButton.cs b/Samples~/Scripts/DemoExample/UI/TabButton.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/TabButton.cs rename to Samples~/Scripts/DemoExample/UI/TabButton.cs diff --git a/Assets/Scripts/DemoExample/UI/TabButton.cs.meta b/Samples~/Scripts/DemoExample/UI/TabButton.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/TabButton.cs.meta rename to Samples~/Scripts/DemoExample/UI/TabButton.cs.meta diff --git a/Assets/Scripts/DemoExample/UI/TabGroup.cs b/Samples~/Scripts/DemoExample/UI/TabGroup.cs similarity index 100% rename from Assets/Scripts/DemoExample/UI/TabGroup.cs rename to Samples~/Scripts/DemoExample/UI/TabGroup.cs diff --git a/Assets/Scripts/DemoExample/UI/TabGroup.cs.meta b/Samples~/Scripts/DemoExample/UI/TabGroup.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UI/TabGroup.cs.meta rename to Samples~/Scripts/DemoExample/UI/TabGroup.cs.meta diff --git a/Assets/Scripts/DemoExample/UIManager.cs b/Samples~/Scripts/DemoExample/UIManager.cs similarity index 100% rename from Assets/Scripts/DemoExample/UIManager.cs rename to Samples~/Scripts/DemoExample/UIManager.cs diff --git a/Assets/Scripts/DemoExample/UIManager.cs.meta b/Samples~/Scripts/DemoExample/UIManager.cs.meta similarity index 100% rename from Assets/Scripts/DemoExample/UIManager.cs.meta rename to Samples~/Scripts/DemoExample/UIManager.cs.meta diff --git a/Assets/Scripts/ScriptableObjects.meta b/Samples~/Scripts/ScriptableObjects.meta similarity index 100% rename from Assets/Scripts/ScriptableObjects.meta rename to Samples~/Scripts/ScriptableObjects.meta diff --git a/Assets/Scripts/ScriptableObjects/ItemReseource.cs b/Samples~/Scripts/ScriptableObjects/ItemReseource.cs similarity index 100% rename from Assets/Scripts/ScriptableObjects/ItemReseource.cs rename to Samples~/Scripts/ScriptableObjects/ItemReseource.cs diff --git a/Assets/Scripts/ScriptableObjects/ItemReseource.cs.meta b/Samples~/Scripts/ScriptableObjects/ItemReseource.cs.meta similarity index 100% rename from Assets/Scripts/ScriptableObjects/ItemReseource.cs.meta rename to Samples~/Scripts/ScriptableObjects/ItemReseource.cs.meta diff --git a/Assets/Scripts/View.meta b/Samples~/Scripts/View.meta similarity index 100% rename from Assets/Scripts/View.meta rename to Samples~/Scripts/View.meta diff --git a/Assets/Scripts/View/QRCodeView.cs b/Samples~/Scripts/View/QRCodeView.cs similarity index 97% rename from Assets/Scripts/View/QRCodeView.cs rename to Samples~/Scripts/View/QRCodeView.cs index dc9aae24..3765a9a7 100644 --- a/Assets/Scripts/View/QRCodeView.cs +++ b/Samples~/Scripts/View/QRCodeView.cs @@ -7,7 +7,7 @@ using ZXing; using ZXing.QrCode; -#if UNITY_ANDROID +#if UNITY_ANDROID || UNITY_IOS using BeaconSDK; #endif diff --git a/Assets/Scripts/View/QRCodeView.cs.meta b/Samples~/Scripts/View/QRCodeView.cs.meta similarity index 100% rename from Assets/Scripts/View/QRCodeView.cs.meta rename to Samples~/Scripts/View/QRCodeView.cs.meta diff --git a/Assets/StreamingAssets.meta b/Samples~/StreamingAssets.meta similarity index 100% rename from Assets/StreamingAssets.meta rename to Samples~/StreamingAssets.meta diff --git a/Assets/StreamingAssets/walletbeacon.min.js b/Samples~/StreamingAssets/walletbeacon.min.js similarity index 100% rename from Assets/StreamingAssets/walletbeacon.min.js rename to Samples~/StreamingAssets/walletbeacon.min.js diff --git a/Assets/StreamingAssets/walletbeacon.min.js.meta b/Samples~/StreamingAssets/walletbeacon.min.js.meta similarity index 100% rename from Assets/StreamingAssets/walletbeacon.min.js.meta rename to Samples~/StreamingAssets/walletbeacon.min.js.meta diff --git a/Assets/TextMesh Pro.meta b/Samples~/TextMesh Pro.meta similarity index 100% rename from Assets/TextMesh Pro.meta rename to Samples~/TextMesh Pro.meta diff --git a/Assets/TextMesh Pro/Documentation.meta b/Samples~/TextMesh Pro/Documentation.meta similarity index 100% rename from Assets/TextMesh Pro/Documentation.meta rename to Samples~/TextMesh Pro/Documentation.meta diff --git a/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf b/Samples~/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf similarity index 100% rename from Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf rename to Samples~/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf diff --git a/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta b/Samples~/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta similarity index 100% rename from Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta rename to Samples~/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta diff --git a/Assets/TextMesh Pro/Fonts.meta b/Samples~/TextMesh Pro/Fonts.meta similarity index 100% rename from Assets/TextMesh Pro/Fonts.meta rename to Samples~/TextMesh Pro/Fonts.meta diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt b/Samples~/TextMesh Pro/Fonts/LiberationSans - OFL.txt similarity index 100% rename from Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt rename to Samples~/TextMesh Pro/Fonts/LiberationSans - OFL.txt diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta b/Samples~/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta similarity index 100% rename from Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta rename to Samples~/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans.ttf b/Samples~/TextMesh Pro/Fonts/LiberationSans.ttf similarity index 100% rename from Assets/TextMesh Pro/Fonts/LiberationSans.ttf rename to Samples~/TextMesh Pro/Fonts/LiberationSans.ttf diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta b/Samples~/TextMesh Pro/Fonts/LiberationSans.ttf.meta similarity index 100% rename from Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta rename to Samples~/TextMesh Pro/Fonts/LiberationSans.ttf.meta diff --git a/Assets/TextMesh Pro/Resources.meta b/Samples~/TextMesh Pro/Resources.meta similarity index 100% rename from Assets/TextMesh Pro/Resources.meta rename to Samples~/TextMesh Pro/Resources.meta diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials.meta b/Samples~/TextMesh Pro/Resources/Fonts & Materials.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials.meta rename to Samples~/TextMesh Pro/Resources/Fonts & Materials.meta diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta b/Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta rename to Samples~/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt b/Samples~/TextMesh Pro/Resources/LineBreaking Following Characters.txt similarity index 100% rename from Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt rename to Samples~/TextMesh Pro/Resources/LineBreaking Following Characters.txt diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta b/Samples~/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta rename to Samples~/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt b/Samples~/TextMesh Pro/Resources/LineBreaking Leading Characters.txt similarity index 100% rename from Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt rename to Samples~/TextMesh Pro/Resources/LineBreaking Leading Characters.txt diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta b/Samples~/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta rename to Samples~/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets.meta b/Samples~/TextMesh Pro/Resources/Sprite Assets.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Sprite Assets.meta rename to Samples~/TextMesh Pro/Resources/Sprite Assets.meta diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset b/Samples~/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset similarity index 100% rename from Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset rename to Samples~/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta b/Samples~/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta rename to Samples~/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta diff --git a/Assets/TextMesh Pro/Resources/Style Sheets.meta b/Samples~/TextMesh Pro/Resources/Style Sheets.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Style Sheets.meta rename to Samples~/TextMesh Pro/Resources/Style Sheets.meta diff --git a/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset b/Samples~/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset similarity index 100% rename from Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset rename to Samples~/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset diff --git a/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta b/Samples~/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta rename to Samples~/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta diff --git a/Assets/TextMesh Pro/Resources/TMP Settings.asset b/Samples~/TextMesh Pro/Resources/TMP Settings.asset similarity index 100% rename from Assets/TextMesh Pro/Resources/TMP Settings.asset rename to Samples~/TextMesh Pro/Resources/TMP Settings.asset diff --git a/Assets/TextMesh Pro/Resources/TMP Settings.asset.meta b/Samples~/TextMesh Pro/Resources/TMP Settings.asset.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/TMP Settings.asset.meta rename to Samples~/TextMesh Pro/Resources/TMP Settings.asset.meta diff --git a/Assets/TextMesh Pro/Shaders.meta b/Samples~/TextMesh Pro/Shaders.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders.meta rename to Samples~/TextMesh Pro/Shaders.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader b/Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader rename to Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader b/Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader rename to Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader b/Samples~/TextMesh Pro/Shaders/TMP_Bitmap.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader rename to Samples~/TextMesh Pro/Shaders/TMP_Bitmap.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_Bitmap.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_Bitmap.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF Overlay.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF Overlay.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF Overlay.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF Overlay.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF SSD.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF SSD.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF SSD.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF SSD.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF-Surface.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF.shader b/Samples~/TextMesh Pro/Shaders/TMP_SDF.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF.shader rename to Samples~/TextMesh Pro/Shaders/TMP_SDF.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_SDF.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_SDF.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_SDF.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_SDF.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMP_Sprite.shader b/Samples~/TextMesh Pro/Shaders/TMP_Sprite.shader similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Sprite.shader rename to Samples~/TextMesh Pro/Shaders/TMP_Sprite.shader diff --git a/Assets/TextMesh Pro/Shaders/TMP_Sprite.shader.meta b/Samples~/TextMesh Pro/Shaders/TMP_Sprite.shader.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMP_Sprite.shader.meta rename to Samples~/TextMesh Pro/Shaders/TMP_Sprite.shader.meta diff --git a/Assets/TextMesh Pro/Shaders/TMPro.cginc b/Samples~/TextMesh Pro/Shaders/TMPro.cginc similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro.cginc rename to Samples~/TextMesh Pro/Shaders/TMPro.cginc diff --git a/Assets/TextMesh Pro/Shaders/TMPro.cginc.meta b/Samples~/TextMesh Pro/Shaders/TMPro.cginc.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro.cginc.meta rename to Samples~/TextMesh Pro/Shaders/TMPro.cginc.meta diff --git a/Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc b/Samples~/TextMesh Pro/Shaders/TMPro_Mobile.cginc similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc rename to Samples~/TextMesh Pro/Shaders/TMPro_Mobile.cginc diff --git a/Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc.meta b/Samples~/TextMesh Pro/Shaders/TMPro_Mobile.cginc.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc.meta rename to Samples~/TextMesh Pro/Shaders/TMPro_Mobile.cginc.meta diff --git a/Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc b/Samples~/TextMesh Pro/Shaders/TMPro_Properties.cginc similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc rename to Samples~/TextMesh Pro/Shaders/TMPro_Properties.cginc diff --git a/Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc.meta b/Samples~/TextMesh Pro/Shaders/TMPro_Properties.cginc.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc.meta rename to Samples~/TextMesh Pro/Shaders/TMPro_Properties.cginc.meta diff --git a/Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc b/Samples~/TextMesh Pro/Shaders/TMPro_Surface.cginc similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc rename to Samples~/TextMesh Pro/Shaders/TMPro_Surface.cginc diff --git a/Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc.meta b/Samples~/TextMesh Pro/Shaders/TMPro_Surface.cginc.meta similarity index 100% rename from Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc.meta rename to Samples~/TextMesh Pro/Shaders/TMPro_Surface.cginc.meta diff --git a/Assets/TextMesh Pro/Sprites.meta b/Samples~/TextMesh Pro/Sprites.meta similarity index 100% rename from Assets/TextMesh Pro/Sprites.meta rename to Samples~/TextMesh Pro/Sprites.meta diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt b/Samples~/TextMesh Pro/Sprites/EmojiOne Attribution.txt similarity index 100% rename from Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt rename to Samples~/TextMesh Pro/Sprites/EmojiOne Attribution.txt diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta b/Samples~/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta similarity index 100% rename from Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta rename to Samples~/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.json b/Samples~/TextMesh Pro/Sprites/EmojiOne.json similarity index 100% rename from Assets/TextMesh Pro/Sprites/EmojiOne.json rename to Samples~/TextMesh Pro/Sprites/EmojiOne.json diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.json.meta b/Samples~/TextMesh Pro/Sprites/EmojiOne.json.meta similarity index 100% rename from Assets/TextMesh Pro/Sprites/EmojiOne.json.meta rename to Samples~/TextMesh Pro/Sprites/EmojiOne.json.meta diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.png b/Samples~/TextMesh Pro/Sprites/EmojiOne.png similarity index 100% rename from Assets/TextMesh Pro/Sprites/EmojiOne.png rename to Samples~/TextMesh Pro/Sprites/EmojiOne.png diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.png.meta b/Samples~/TextMesh Pro/Sprites/EmojiOne.png.meta similarity index 100% rename from Assets/TextMesh Pro/Sprites/EmojiOne.png.meta rename to Samples~/TextMesh Pro/Sprites/EmojiOne.png.meta diff --git a/Assets/WebGLCopyAndPaste.meta b/Samples~/WebGLCopyAndPaste.meta similarity index 100% rename from Assets/WebGLCopyAndPaste.meta rename to Samples~/WebGLCopyAndPaste.meta diff --git a/Assets/WebGLCopyAndPaste/Plugins.meta b/Samples~/WebGLCopyAndPaste/Plugins.meta similarity index 100% rename from Assets/WebGLCopyAndPaste/Plugins.meta rename to Samples~/WebGLCopyAndPaste/Plugins.meta diff --git a/Assets/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib b/Samples~/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib similarity index 100% rename from Assets/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib rename to Samples~/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib diff --git a/Assets/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib.meta b/Samples~/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib.meta similarity index 100% rename from Assets/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib.meta rename to Samples~/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib.meta diff --git a/Samples~/WebGLCopyAndPaste/Scripts.meta b/Samples~/WebGLCopyAndPaste/Scripts.meta new file mode 100644 index 00000000..62e0d482 --- /dev/null +++ b/Samples~/WebGLCopyAndPaste/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 778b2fd8714c2cb4eade5a16d45a54ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs b/Samples~/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs similarity index 100% rename from Assets/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs rename to Samples~/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs diff --git a/Assets/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs.meta b/Samples~/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs.meta similarity index 100% rename from Assets/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs.meta rename to Samples~/WebGLCopyAndPaste/Scripts/WebGLCopyAndPaste.cs.meta diff --git a/Assets/WebGLTemplates.meta b/Samples~/WebGLTemplates.meta similarity index 100% rename from Assets/WebGLTemplates.meta rename to Samples~/WebGLTemplates.meta diff --git a/Assets/WebGLTemplates/Airgap.meta b/Samples~/WebGLTemplates/Airgap.meta similarity index 100% rename from Assets/WebGLTemplates/Airgap.meta rename to Samples~/WebGLTemplates/Airgap.meta diff --git a/Assets/WebGLTemplates/Airgap/index.html b/Samples~/WebGLTemplates/Airgap/index.html similarity index 100% rename from Assets/WebGLTemplates/Airgap/index.html rename to Samples~/WebGLTemplates/Airgap/index.html diff --git a/Assets/WebGLTemplates/Airgap/index.html.meta b/Samples~/WebGLTemplates/Airgap/index.html.meta similarity index 100% rename from Assets/WebGLTemplates/Airgap/index.html.meta rename to Samples~/WebGLTemplates/Airgap/index.html.meta diff --git a/Assets/WebGLTemplates/Airgap/thumbnail.png b/Samples~/WebGLTemplates/Airgap/thumbnail.png similarity index 100% rename from Assets/WebGLTemplates/Airgap/thumbnail.png rename to Samples~/WebGLTemplates/Airgap/thumbnail.png diff --git a/Assets/WebGLTemplates/Airgap/thumbnail.png.meta b/Samples~/WebGLTemplates/Airgap/thumbnail.png.meta similarity index 100% rename from Assets/WebGLTemplates/Airgap/thumbnail.png.meta rename to Samples~/WebGLTemplates/Airgap/thumbnail.png.meta diff --git a/package.json b/package.json new file mode 100644 index 00000000..b4f36d74 --- /dev/null +++ b/package.json @@ -0,0 +1,41 @@ +{ + "name": "com.trilitech.tezos-unity-sdk", + "version": "1.1.0", + "unity": "2021.3", + "displayName": "Tezos Unity SDK", + "description": "Unity SDK for Tezos", + "samples": [ + { + "displayName": "Tezos game sample", + "description": "Simple game to interact with the Tezos blockchain", + "path": "Samples~" + } + ], + "dependencies": { + "com.unity.nuget.newtonsoft-json": "3.0.2", + "com.unity.textmeshpro": "3.0.6" + }, + "keywords": [ + "tezos", + "blockchain", + "game-dev", + "unity", + "sdk" + ], + "homepage": "https://tezos.com/unity/", + "bugs": { + "url": "https://github.com/trilitech/tezos-unity-sdk/issues" + }, + "repository": { + "type": "git", + "url": "ssh://git@github.com:trilitech/tezos-unity-sdk.git" + }, + "documentationUrl": "https://opentezos.com/gaming/unity-sdk/getting-started/", + "changelogUrl": "https://github.com/trilitech/tezos-unity-sdk/blob/main/CHANGELOG.md", + "author": { + "name": "Trilitech", + "email" : "contact@trili.tech", + "url": "https://tezos.com/unity/" + }, + "license": "MIT" +} \ No newline at end of file diff --git a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.bak.meta b/package.json.meta similarity index 60% rename from Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.bak.meta rename to package.json.meta index b9a33b01..80b08eba 100644 --- a/Assets/Plugins/Android/Source/wallet/WalletViewModel.kt.bak.meta +++ b/package.json.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 79a988a136eb59846996dee1e41d2e42 -DefaultImporter: +guid: d2b6ffd887c0648ed946caa9c7c29f89 +PackageManifestImporter: externalObjects: {} userData: assetBundleName: