Skip to content

Commit

Permalink
1.0.0 MAM (#104)
Browse files Browse the repository at this point in the history
* `1.0.0` MAM

* fixing asset building
  • Loading branch information
cworsnop-figure authored Mar 7, 2023
1 parent 9ad4228 commit b1c6476
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object Versions {
const val KotlinFaker = "1.7.1"
const val SpringMockk = "3.0.1"
const val Swagger = "1.6.2"
const val AssetModel = "0.1.16"
const val AssetModel = "1.0.0"
const val P8eScope = "0.6.4"
const val ProvenanceHdWallet = "0.1.15"
const val ProvenanceClient = "1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import io.provenance.api.models.eos.store.StoreProtoResponse
import io.provenance.api.models.p8e.PermissionInfo
import io.provenance.api.util.awaitAllBytes
import io.provenance.entity.KeyType
import io.provenance.scope.util.toUuid
import kotlinx.coroutines.reactor.awaitSingle
import org.springframework.http.codec.multipart.FilePart
import org.springframework.http.codec.multipart.FormFieldPart
import org.springframework.http.codec.multipart.Part
import org.springframework.stereotype.Component
import tech.figure.asset.v1beta1.AssetOuterClassBuilders
import tech.figure.asset.v1beta1.Asset
import tech.figure.proto.util.FileNFT
import tech.figure.proto.util.toProtoAny
import tech.figure.proto.util.toProtoUUID

@Component
class StoreFile(
Expand All @@ -33,15 +35,15 @@ class StoreFile(
storeObject.executeBlocking(
StoreObjectRequest(
if (!storeRawBytes)
AssetOuterClassBuilders.Asset {
idBuilder.value = id
this.type = FileNFT.ASSET_TYPE
description = file.filename()
putKv(FileNFT.KEY_FILENAME, file.filename().toProtoAny())
putKv(FileNFT.KEY_BYTES, bytes.toProtoAny())
putKv(FileNFT.KEY_SIZE, bytes.size.toString().toProtoAny())
putKv(FileNFT.KEY_CONTENT_TYPE, file.headers().contentType.toString().toProtoAny())
}.toByteArray() else bytes,
Asset.newBuilder().also {
it.id = id.toUuid().toProtoUUID()
it.type = FileNFT.ASSET_TYPE
it.description = file.filename()
it.putKv(FileNFT.KEY_FILENAME, file.filename().toProtoAny())
it.putKv(FileNFT.KEY_BYTES, bytes.toProtoAny())
it.putKv(FileNFT.KEY_SIZE, bytes.size.toString().toProtoAny())
it.putKv(FileNFT.KEY_CONTENT_TYPE, file.headers().contentType.toString().toProtoAny())
}.build().toByteArray() else bytes,
type,
objectStoreAddress,
args.useObjectStoreGateway,
Expand Down

0 comments on commit b1c6476

Please sign in to comment.