-
how to print detail value in balances value?
I saw function GetDynamicFieldObject, but I don't know how to construct the params. And GetDynamicFields return nothing. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Change the def get_dynamic_fields():
"""Get dynamic field objects."""
client = SyncClient(SuiConfig.default_config())
target_obj = "0x6428faf5303575518c656326f138297d71b1982a2e37fad014fb1f851b3d50ea"
result = client.execute(GetDynamicFields(target_obj))
if result.is_ok():
for dfield in result.result_data.data:
if dfield.field_type == "DynamicObject":
fmap = SuiMap("foo", "bar")
fmap.map = dfield.name
builder = GetDynamicFieldObject(target_obj, name=fmap)
result = client.execute(builder)
if result.is_ok():
print("Dynamic Object Field")
print(result.result_data.to_json(indent=2))
else:
print(f"fail:{result.result_string}")
else:
print("Dynamic Field")
print(dfield.to_json(indent=2))
else:
print(result.result_string) |
Beta Was this translation helpful? Give feedback.
-
I have another question, could you please help me? If I only have one gas coin object, how can I make a transaction about gas coin? As I know, gas coin object can not be in use, and split coin also need "not in use" object, but I only have 1 object. |
Beta Was this translation helpful? Give feedback.
-
You can use the txb = SyncTransaction(client=client)
# Split some portion from gas coin
scres = txer.split_coin(coin=txb.gas, amounts=[30000000])
# Use scres in movecall or transfer back to yourself
txb.transfer_objects(transfers=scres, recipient=client.config.active_address) |
Beta Was this translation helpful? Give feedback.
Thanks a lot, it works. So If I need to call a move func which need sui coin, I need to split sui coin to at least 2 object?