#Convert bytes array to Address Account type
14 messages · Page 1 of 1 (latest)
you can't. in the next release you'll be able to convert any valid G... or C... strkey to an address. does your use case require using bytes specifically? what are these bytes representing?
I have a message that contains both an amount and an address represented as bytes. I pass this entire message as bytes to my smart contract from the client side. Inside the smart contract, I need to convert the bytes representing the address into an Address account type. My goal is to mint some tokens to this address. How can I correctly convert these bytes into the Address account type within my smart contract and then proceed to mint tokens to this address?
where this address comes from, i.e. who encoded it as bytes in the first place?
ok, but who encoded it for the other chain then?
like someone has to take the input address from the user (e.g. a strkey). why not just pass it around as strkey or (better) ScVal::Address? the latter can be just directly used as Address
Im just guessing 🙂 but i agree itd be better to just match our encoding types
yeah, I mean that's a totally fair point/use case... but thinking about this more holistically, the endpoint would need to deal with Stellar entities and thus it seems like it should be at least theoretically possible to keep the Stellar entities encoded in Stellar-supported way...
It seems like the offchain agent could convert the data
If my guess of it being a cross chain messager is correct
sure, it doesn't really matter which entity it is, what matters is that there needs to be some stellar-specific logic, so might as well benefit from using the structured data and not reinventing the wheel (serialization format)
Serialization inside the contracts are probably easier on evm since execution limits dont mean much there. My guess is this methodology is getting carried over from that world