Skip to content

Comments

HCS20 Inscription API [Awaiting Documentation]#50

Merged
mattsmithies merged 2 commits intomasterfrom
feature/inscriptions
Jan 7, 2024
Merged

HCS20 Inscription API [Awaiting Documentation]#50
mattsmithies merged 2 commits intomasterfrom
feature/inscriptions

Conversation

@mattsmithies
Copy link
Collaborator

@mattsmithies mattsmithies commented Jan 6, 2024

Overview

This is the the first pass of a HCS20 compliant API which unlocked inscriptions for anyone building on Hedera.

This comprises of updated postman documentation for 4 new endpoints:

  • Deploy
  • Mint
  • Burn
  • Transfer

On mainnet the topic id for inscriptions will default to 0.0.4350190

API will validate payloads but will not validate if it is a proper HCS20 chain/sequence.

Testnet Output

You can see the output of these function on this topic.

https://hashscan.io/testnet/topic/0.0.7459744?p=1&k=1704558987.547089003

Validation Compared with Standard

The HCS20 standard describes shorthand fields that are inline with BRC20

https://patches-1.gitbook.io/hcs-20-auditable-points/standard-details

Within the API we have opted for more human-readable validation, but the messages issued to HCS are in the valid format as requested.

API Response

You receive your topic id, tx, and inscription payload.

{
    "data": {
        "topic_id": "7459744",
        "transaction_id": "0.0.135908@1704556890.630971149",
        "explorer_url": "https://ledger-testnet.hashlog.io/tx/0.0.135908@1704556890.630971149",
        "inscription": {
            "p": "hcs-20",
            "op": "deploy",
            "name": "test",
            "tick": "TICK",
            "max": "100"
        }
    }
}

Look at the postman file for documentation

Screenshot 2024-01-06 at 17 01 55

Routes

The breakdown are as follows:

Deploy

POST
{{domain}}/api/inscription/deploy

curl --location --request POST 'localhost:3000/api/inscription/deploy' \
--header 'x-api-key: 123' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'topic_id=7459744' \
--data-urlencode 'name=test' \
--data-urlencode 'ticker=TICK' \
--data-urlencode 'max=100'

Mint

POST
{{domain}}/api/inscription/{ticker}/mint

curl --location --request POST 'localhost:3000/api/inscription/TICK/mint' \
--header 'x-api-key: 123' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'topic_id=7459744' \
--data-urlencode 'to=0.0.1156' \
--data-urlencode 'amount=1'

Burn

POST
{{domain}}/api/inscription/{ticker}/burn

curl --location --request POST 'localhost:3000/api/inscription/TICK/from' \
--header 'x-api-key: 123' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'topic_id=7459744' \
--data-urlencode 'from=0.0.1156' \
--data-urlencode 'amount=1'

Transfer

POST
{{domain}}/api/inscription/{ticker}/transfer

curl --location --request POST 'localhost:3000/api/inscription/TICK/transfer' \
--header 'x-api-key: 123' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'topic_id=7459744' \
--data-urlencode 'from=0.0.1' \
--data-urlencode 'to=0.0.2' \
--data-urlencode 'amount=1'

@mattsmithies mattsmithies changed the title HCS20 Inscriptions [WIP] HCS20 Inscription API [WIP] Jan 6, 2024
@mattsmithies
Copy link
Collaborator Author

Will complete documentation before merge.

@HGraphPunks
Copy link

This is absolutely amazing, great work!

@mattsmithies mattsmithies changed the title HCS20 Inscription API [WIP] HCS20 Inscription API [Awaiting Documentation] Jan 6, 2024
@mattsmithies mattsmithies merged commit 7bd6bbd into master Jan 7, 2024
@mattsmithies mattsmithies deleted the feature/inscriptions branch January 7, 2024 16:51
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.

2 participants