stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

`/transactions_with_transfers` not showing FT transfers

Open rafaelcr opened this issue 3 years ago • 1 comments

The /transactions_with_transfers endpoint is not returning FT transfers (maybe also NFT transfers) where it should. We should also add unit tests that specifically exercise this issue. This fix could be included as a part of #1039

Example:

https://stacks-node-api.mainnet.stacks.co/extended/v1/address/SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-token/transactions_with_transfers

    {
      "tx": {
        "tx_id": "0x5aa0bf86956add9efd1afb4c62937b06fc124e86dc8717d2c80fb663f314ef7a",
        "nonce": 5179,
        "fee_rate": "5334",
        "sender_address": "SP1VZB1N7YFBRNX4CC0WAYWY5MHEXYXYF56QH4F1A",
        "sponsored": false,
        "post_condition_mode": "deny",
        "post_conditions": [
          {
            "type": "fungible",
            "condition_code": "sent_equal_to",
            "amount": "1300000",
            "principal": {
              "type_id": "principal_standard",
              "address": "SP1VZB1N7YFBRNX4CC0WAYWY5MHEXYXYF56QH4F1A"
            },
            "asset": {
              "contract_name": "miamicoin-token",
              "asset_name": "miamicoin",
              "contract_address": "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27"
            }
          }
        ],
        "anchor_mode": "any",
        "is_unanchored": false,
        "block_hash": "0x6b59d048795022c228ba0bf9ba929f94b54504c183d473777f0b1f0bf748d8d9",
        "parent_block_hash": "0x66cbf30012128d513134d439df2313cc77c275b223a40abf983285408fcbe44e",
        "block_height": 54045,
        "burn_block_time": 1648482235,
        "burn_block_time_iso": "2022-03-28T15:43:55.000Z",
        "parent_burn_block_time": 1648481327,
        "parent_burn_block_time_iso": "2022-03-28T15:28:47.000Z",
        "canonical": true,
        "tx_index": 17,
        "tx_status": "success",
        "tx_result": {
          "hex": "0x0703",
          "repr": "(ok true)"
        },
        "microblock_hash": "",
        "microblock_sequence": 2147483647,
        "microblock_canonical": true,
        "event_count": 2,
        "events": [
          
        ],
        "execution_cost_read_count": 5,
        "execution_cost_read_length": 5526,
        "execution_cost_runtime": 11226,
        "execution_cost_write_count": 2,
        "execution_cost_write_length": 1,
        "tx_type": "contract_call",
        "contract_call": {
          "contract_id": "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-token",
          "function_name": "transfer",
          "function_signature": "(define-public (transfer (amount uint) (from principal) (to principal) (memo (optional (buff 34)))))",
          "function_args": [
            {
              "hex": "0x010000000000000000000000000013d620",
              "repr": "u1300000",
              "name": "amount",
              "type": "uint"
            },
            {
              "hex": "0x051677f586a7f3d78af48c6038af73c5a45ddf77cf29",
              "repr": "SP1VZB1N7YFBRNX4CC0WAYWY5MHEXYXYF56QH4F1A",
              "name": "from",
              "type": "principal"
            },
            {
              "hex": "0x0516e3d94a92b80d0aabe8ef1b50de84449cd61ad637",
              "repr": "SP3HXJJMJQ06GNAZ8XWDN1QM48JEDC6PP6W3YZPZJ",
              "name": "to",
              "type": "principal"
            },
            {
              "hex": "0x0a0200000006313130303038",
              "repr": "(some 0x313130303038)",
              "name": "memo",
              "type": "(optional (buff 34))"
            }
          ]
        }
      },
      "stx_sent": "0",
      "stx_received": "0",
      "stx_transfers": [
        
      ],
      "ft_transfers": [
        
      ],
      "nft_transfers": [
        
      ]
    },

rafaelcr avatar Mar 28 '22 16:03 rafaelcr

The issue seems to be that the endpoint only retrieves those events when the principal is the sender or the receiver. Example: https://stacks-node-api.mainnet.stacks.co/extended/v1/address/SP30V7ZYEGGY0WQ6EJYZ040V3VHF4234FSTHP128D/transactions_with_transfers

rafaelcr avatar Mar 28 '22 16:03 rafaelcr