Skip to content

[Feature Request] Add "Copy Field" Button for Struct Fields in Response #1065

@mshakeg

Description

@mshakeg

🚀 Feature Request Description

Add a "Copy Field" button next to each field in struct responses that automatically copies the unescaped, ready-to-use version of that field to the clipboard.

Is your feature request related to a problem? Please describe you use case.

When viewing complex struct responses in the Aptos Explorer, fields containing special characters (like quotes) are displayed with JSON escape sequences. This makes it difficult to copy and reuse these values as inputs for other function calls.

For example, when calling the get_token_data_id function (https://explorer.aptoslabs.com/account/0x57c91eb220f453f9ba1f21b8f8a020bae67c391b9e9f7560945762ccc44fffb7/modules/view/vault/get_token_data_id?network=mainnet), the response includes a name field with escaped quotes:

{
  "collection": "ICHI_Vault_LP",
  "creator": "0xaaead394fd54c88538ec2372bdb8023a347b80338d40559b0f2732113dda87ab",
  "name": "ICHI vault #\"USDC\"-\"APT\"-\"X20\"-\"@0x6e24baa92d82586c89dbd02bf6aeb0939fa98ea112254e76223226f2d176c5d1\""
}

Use the following args for the function above:

T0: 0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC
T1: 0x1::aptos_coin::AptosCoin
T2: 0x54cb0bb2c18564b86e34539b9f89cfe1186e39d89fce54e1cd007b8e61673a85::bin_steps::X20

arg0: 0x6e24baa92d82586c89dbd02bf6aeb0939fa98ea112254e76223226f2d176c5d1

I need to copy this name and use it as input for other functions, but the backslashes cause issues when pasted.

Expected Behavior

Describe the solution you would like
I would like to see a small "copy" icon next to each field in the displayed struct. When clicked, this icon should copy the actual unescaped string value to the clipboard, ready to be used as input in another function.

For the example above, clicking "copy" next to the name field would copy:

ICHI vault #"USDC"-"APT"-"X20"-"@0x6e24baa92d82586c89dbd02bf6aeb0939fa98ea112254e76223226f2d176c5d1"

without the backslashes.

Additional context

Describe alternatives you've considered

Manually removing the backslashes when copying, which is error-prone

Are you willing to open a pull request?

I am not willing to contribute this improvement at the moment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions