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: add /rgbpp/v1/assets/type for get assets type info #183

Merged
merged 8 commits into from
Aug 8, 2024

Conversation

ahonn
Copy link
Collaborator

@ahonn ahonn commented Jul 2, 2024

Add an new API /rgbpp/v1/assets/type to get asset cell type info (xUDT and Spore for now)

Interface

// /rgbpp/v1/assets/type

// query params
{
    querystring: z.object({
    type_script: Script.or(z.string())
      .optional()
      .describe(
        `
        type script to filter cells

        two ways to provide:
        - as a object: 'encodeURIComponent(JSON.stringify({"codeHash":"0x...", "args":"0x...", "hashType":"type"}))'
        - as a hex string: '0x...' (You can pack by @ckb-lumos/codec blockchain.Script.pack({ "codeHash": "0x...", ... }))
      `,
      ),
  }),
}

// response
z.object({
  type: z.literal('xudt')
  symbol: z.string(),
  name: z.string(),
  decimal: z.number(),
  type_hash: z.string(),
}).or(z.object({
  type: z.literal('spore')
  contentType: z.string(),
  cluster: z.object({
    id: z.string(),
    name: z.string(),
    description: z.string(),
  }).optional(),
})).nullable();

Copy link

vercel bot commented Jul 2, 2024

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

Name Status Preview Comments Updated (UTC)
btc-assets-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2024 7:58am

Flouse

This comment was marked as outdated.

@Flouse Flouse force-pushed the feat/rgbpp-assets-info branch from f7f1f7a to db63ae7 Compare July 31, 2024 15:09

This comment was marked as off-topic.

@Flouse Flouse requested a review from duanyytop August 8, 2024 03:37
@Flouse Flouse requested a review from Dawn-githup August 8, 2024 03:39
@Flouse Flouse merged commit 7a6fc03 into develop Aug 8, 2024
2 of 3 checks passed
@Flouse Flouse deleted the feat/rgbpp-assets-info branch August 8, 2024 05:58
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.

Fix the test case of "type_hash": "0x7337d2075479d5c6789564516be1db11478e1d3ca70ad88050fe0bf3ff05acc2"
3 participants