fragment NFTAssetParts on NftAsset {
  id
  name
  nftContract {
    id
    chain
    address
  }
  tokenId
  image {
    id
    url
  }
  collection {
    id
    name
  }
}

fragment NFTTransferParts on NftTransfer {
  id
  asset {
    ...NFTAssetParts
  }
  nftStandard
  sender
  recipient
  direction
}

fragment TokenAssetParts on Token {
  id
  name
  symbol
  address
  decimals
  chain
  standard
  project {
    id
    isSpam
    logo {
      id
      url
    }
  }
}

fragment TokenTransferParts on TokenTransfer {
  id
  asset {
    ...TokenAssetParts
  }
  tokenStandard
  quantity
  sender
  recipient
  direction
  transactedValue {
    id
    currency
    value
  }
}

fragment TokenApprovalParts on TokenApproval {
  id
  asset {
    ...TokenAssetParts
  }
  tokenStandard
  approvedAddress
  quantity
}

fragment NFTApprovalParts on NftApproval {
  id
  asset {
    ...NFTAssetParts
  }
  nftStandard
  approvedAddress
}

fragment NFTApproveForAllParts on NftApproveForAll {
  id
  asset {
    ...NFTAssetParts
  }
  nftStandard
  operatorAddress
  approved
}

fragment TransactionParts on Transaction {
  id
  blockNumber
  hash
  status
  to
  from
}

fragment AssetActivityParts on AssetActivity {
  id
  timestamp
  type
  chain
  transaction {
    ...TransactionParts
  }
  assetChanges {
    __typename
    ... on TokenTransfer {
      ...TokenTransferParts
    }
    ... on NftTransfer {
      ...NFTTransferParts
    }
    ... on TokenApproval {
      ...TokenApprovalParts
    }
    ... on NftApproval {
      ...NFTApprovalParts
    }
    ... on NftApproveForAll {
      ...NFTApproveForAllParts
    }
  }
}

query TransactionList($account: String!) {
  portfolios(ownerAddresses: [$account]) {
    id
    assetActivities(pageSize: 50, page: 1) {
      ...AssetActivityParts
    }
  }
}
