Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement query field resolvers to list the address's assets/balances #168

Merged

Conversation

ahonn
Copy link
Collaborator

@ahonn ahonn commented Sep 12, 2024

Query

L1 Address

query {
  rgbppAddress(address: "tb1qcw5t6p6shd244s3zwv0y2lrt6zpkuuqx3xhqjm") {
    balances {
      symbol
      typeHash
      amount
      decimal
    }
    assets {
      owner
      cell {
        txHash
        index
      }
      utxo {
        txid
      }
    }
  }
}

L2 Address

query {
  rgbppAddress(address: "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp") {
    balances {
      symbol
      typeHash
      amount
      decimal
    }
    assets {
      owner
      cell {
        txHash
        index
      }
      utxo {
        txid
      }
    }
  }
}

@ahonn ahonn linked an issue Sep 12, 2024 that may be closed by this pull request
Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
utxo-stack-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 6:17am

@ahonn ahonn requested review from ShookLyngs and Flouse September 12, 2024 07:33
return [];
}
const results = await this.prismaService.asset.findMany({
where: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isLive: true,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at d0e60a9

@utxostack utxostack deleted a comment from self-host-2024 bot Sep 12, 2024
@utxostack utxostack deleted a comment from self-host-2024 bot Sep 12, 2024
@self-host-2024
Copy link

self-host-2024 bot commented Sep 13, 2024

The preview deployment is ready. 🟢

Open Build Logs

Last updated at: 2024-09-19 06:16:35 CET

@ahonn ahonn force-pushed the 145-feat-a-query-interface-to-list-the-coins-held-by-an-address branch from d0e60a9 to b6cae53 Compare September 19, 2024 06:14
@Flouse Flouse merged commit 9ef448f into develop Sep 19, 2024
5 checks passed
@Flouse Flouse deleted the 145-feat-a-query-interface-to-list-the-coins-held-by-an-address branch September 19, 2024 11:18
@Flouse
Copy link
Contributor

Flouse commented Sep 19, 2024

Tests

query {
  btc_addr0: rgbppAddress(address: "tb1qcw5t6p6shd244s3zwv0y2lrt6zpkuuqx3xhqjm") {
    balances {
      symbol
      typeHash
      amount
      decimal
    }
    assets {
      owner
      cell {
        txHash
        index
      }
      utxo {
        txid
        vout
      }
    }
  }
  
  ckb_addr1: rgbppAddress(address: "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp") {
    balances {
      symbol
      typeHash
      amount
      decimal
    }
    assets {
      owner
      cell {
        txHash
        index
      }
      utxo {
        txid
        vout
      }
    }
  }
}

Result

{
  "data": {
    "btc_addr0": {
      "balances": [
        {
          "symbol": "SEAL",
          "typeHash": "0x757b1cf54ebc57f2b94fb2bc273166ba6f68b68001acad5cc557cb4935d1213b",
          "amount": "0x0",
          "decimal": 12
        }
      ],
      "assets": [
        {
          "owner": "tb1qcw5t6p6shd244s3zwv0y2lrt6zpkuuqx3xhqjm",
          "cell": {
            "txHash": "0xe8a9a5e5d21b9bee7974e065ef3b306f541cabd15ddbf24c85f75388c6de74ea",
            "index": 1
          },
          "utxo": {
            "txid": "7d84b812ee946369c5043bddd3a9b4122345ade7fa1717bd93f92dedb25a39ef",
            "vout": 1
          }
        },
        {
          "owner": "tb1qcw5t6p6shd244s3zwv0y2lrt6zpkuuqx3xhqjm",
          "cell": {
            "txHash": "0xa8c12690d7bf99d78a533248a09bb6c6c52d7fc82545f6a5a0bdcfff4e9e2323",
            "index": 1
          },
          "utxo": {
            "txid": "9d349a89d1268c05bf1ee14099f640d958f63e20fb1e2ee336a7c8999947652b",
            "vout": 1
          }
        }
      ]
    },
    "ckb_addr1": {
      "balances": [
        {
          "symbol": "tUTXO",
          "typeHash": "0x37b6748d268d4aa62445d546bac1f90ccbc02cbbcecc7831aca3b77d70304e0f",
          "amount": "0x0",
          "decimal": 8
        },
        {
          "symbol": "LP-UTXOSwap V1",
          "typeHash": "0x7e097994c649c19a58f2cc79402a274a6406726de235a3518aab43deb0a8d000",
          "amount": "0x0",
          "decimal": 8
        },
        {
          "symbol": "LP-UTXOSwap V1",
          "typeHash": "0xa1c54a81724bc389dc2ae4899bf36b6f5a59953c831c595df13bbacc5668fde1",
          "amount": "0x0",
          "decimal": 8
        },
        {
          "symbol": "BTCPP",
          "typeHash": "0xcc14aba04f0b03a5df5ef2cc2a163ff34c35863fbd65cd137aede0fb40346f66",
          "amount": "0x0",
          "decimal": 8
        }
      ],
      "assets": [
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x8c063866bc6f4c2882c3ddc889945a7bc0680a83ffec83616f2ead413886c61f",
            "index": 1
          },
          "utxo": null
        },
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x06f7ce42565bab22dbe4fda62ea400ced9e4ee4e9cce0d188042067cf7bb9c89",
            "index": 1
          },
          "utxo": null
        },
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x6285ef97665fa7cf84f5b4d3bea525c12f658ea30112b621583694d8e59736b7",
            "index": 0
          },
          "utxo": null
        },
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x979a583bece2e5cff802278de560c64ec5da754679f4a633f590f6011e65d1aa",
            "index": 2
          },
          "utxo": null
        },
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x7849d4872aee1e4e412ebddfa3396720b7197d6a4b79cf5947c377a4f499e3b2",
            "index": 2
          },
          "utxo": null
        },
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x6ea170191ea942d3eca31d25c29c68adfcb73bbf176dbf610a84012e59423366",
            "index": 1
          },
          "utxo": null
        },
        {
          "owner": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwmnnk4325995vt6r3wz20f9dxus27939ckmuhyp",
          "cell": {
            "txHash": "0x6ea170191ea942d3eca31d25c29c68adfcb73bbf176dbf610a84012e59423366",
            "index": 0
          },
          "utxo": null
        }
      ]
    }
  }
}

cc @Vibes-INS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: a list the coins held by an address
2 participants