but this function will fail to build a proper struct tag in a recursive case, e.g. for LP coins like:
0x31a6675cbe84365bf2b0cbce617ece6c47023ef70826533bde5203d32171dc3c::swap::LPToken<0x1::aptos_coin::AptosCoin, 0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC>
🚀 Feature Request Description
Add support for creating a struct tag from a string
Motivation
There are a few helper functions to create a few basic struct tag, such as
NewStringTag
,NewOptionTag
, andNewObjectTag
I would like to have a new function, that can parse a string:
NewStructTagFromString
that can parse (recursively) and build a struct tagthe motivation is to be able to easily build transfer transactions from the name of a coin
e.g. here is a snippet, of how I implemented a basic function to do so:
but this function will fail to build a proper struct tag in a recursive case, e.g. for LP coins like:
0x31a6675cbe84365bf2b0cbce617ece6c47023ef70826533bde5203d32171dc3c::swap::LPToken<0x1::aptos_coin::AptosCoin, 0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC>
This function, does exist in the python SDK: https://github.com/aptos-labs/aptos-python-sdk/blob/e5e1ecb0a6bea419a24098f17582798cdfc7be56/aptos_sdk/type_tag.py#L311
and it is parsing the string and building the struct recursively from the string