Skip to content

Commit

Permalink
Update marketplace generated yaml with req/response examples (#343)
Browse files Browse the repository at this point in the history
* update marketplace generated yaml with req/response examples

* use yargs to parser cli input arguments

* run github action only when marketplace docs are changed

* make github actions more generic

* [AUTOMATED] Update: docs/pages/api/marketplace/marketplace.gen.yaml

* wip

* remove extra file

* [AUTOMATED] Update: docs/pages/api/marketplace/marketplace.gen.yaml

* check if examples file exist

* remove extra logs from github action

* update actions/checkout to v4

* update list currencies response example

* [AUTOMATED] Update: docs/pages/api/marketplace/marketplace.gen.yaml

* Add GetCollectible example

* [AUTOMATED] Update: docs/pages/api/marketplace/marketplace.gen.yaml

* Add example GenerateBuyTransaction

* update buy transaction response

* handle exceptions

* fix buy transaction path

* [AUTOMATED] Update: docs/pages/api/marketplace/marketplace.gen.yaml

---------

Co-authored-by: LukasJenicek <[email protected]>
  • Loading branch information
LukasJenicek and LukasJenicek authored Oct 10, 2024
1 parent 9c46d9d commit 76d91e1
Show file tree
Hide file tree
Showing 7 changed files with 542 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Build and Push
steps:
- name: git-checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
lfs: true

Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Docs

on:
pull_request:
paths:
- "**/*.gen.yaml"

jobs:
build:
runs-on: ubuntu-latest
name: Merge request && response examples
steps:
- name: git-checkout
uses: actions/checkout@v4
with:
lfs: true

- name: Install dependencies
run: |
npm install -g [email protected]
pnpm install
- name: Get changed files
id: changes
run: |
git fetch origin ${{ github.base_ref }}
# List only the files that have changed between the current commit and the previous one
git diff --name-only origin/master | grep '\.gen\.yaml$' > changed_files.txt
# Save the changed files to an output to be used later
echo "::set-output name=files::$(cat changed_files.txt | tr '\n' ' ' | sed -e 's/\ *$//g')"
echo "::set-output name=dirs::$(cat changed_files.txt | xargs -n 1 dirname | sort -u | tr '\n' ' ' | sed -e 's/\ *$//g')"
rm changed_files.txt
- name: Merge request and responses
run: |
# Read the changed files from the previous step
node libs/example_merger.js merge ${{ steps.changes.outputs.files }}
- name: Push changes
uses: 0xsequence/actions/git-commit@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN_GIT_COMMIT }}
with:
src: ${{ steps.changes.outputs.files }}
dst: "${{ steps.changes.outputs.dirs }}/"
branch: ${{ github.head_ref }}
## since openapi docs are generated and PR is automatically created there is no need to try create new one
pr_create: false

108 changes: 108 additions & 0 deletions docs/pages/api/marketplace/examples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"/rpc/Marketplace/ListCurrencies": {
"request": {},
"response": {
"currencies": [
{
"chainId": 137,
"contractAddress": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"name": "",
"symbol": "",
"decimals": 18,
"imageUrl": "",
"exchangeRate": 0,
"defaultChainCurrency": true,
"nativeCurrency": false,
"sardineSupported": false,
"transakSupported": false,
"createdAt": "2024-10-10T14:09:23.649572Z",
"updatedAt": "2024-10-10T14:09:23.649572Z"
},
{
"chainId": 137,
"contractAddress": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
"name": "",
"symbol": "",
"decimals": 18,
"imageUrl": "",
"exchangeRate": 0,
"defaultChainCurrency": true,
"nativeCurrency": false,
"sardineSupported": false,
"transakSupported": false,
"createdAt": "2024-10-10T14:09:23.649578Z",
"updatedAt": "2024-10-10T14:09:23.649578Z"
},
{
"chainId": 137,
"contractAddress": "0x0000000000000000000000000000000000000000",
"name": "Matic",
"symbol": "MATIC",
"decimals": 18,
"imageUrl": "https://assets.sequence.info/images/networks/medium/137.webp",
"exchangeRate": 0,
"defaultChainCurrency": false,
"nativeCurrency": true,
"sardineSupported": false,
"transakSupported": false,
"createdAt": "2024-10-10T14:09:24.295951Z",
"updatedAt": "2024-10-10T14:09:24Z"
}
]
}
},
"/rpc/Marketplace/GetCollectible": {
"request": {
"contractAddress": "0x44B3F42E2BF34F62868FF9E9DAB7C2F807BA97CB",
"tokenId": "0"
},
"response": {
"metadata": {
"tokenId": "0",
"name": "Elf Archer Shard - Common",
"description": "Shards for the Hunters On-Chain game",
"image": "https://hunt-nft.cdn.boombit.cloud/Shards/0.png",
"properties": null,
"attributes": [
{
"trait_type": "Rarity",
"value": "Common"
},
{
"trait_type": "Type",
"value": "Elf Archer"
}
],
"external_url": "https://boomland.io",
"updatedAt": "2024-10-10T14:25:44.332280097Z"
}
}
},
"/rpc/Marketplace/GenerateBuyTransaction": {
"request": {
"collectionAddress": "0x44b3f42e2bf34f62868ff9e9dab7c2f807ba97cb",
"buyer": "0xD2eFbb2f18bfE3D265b26D2ACe83400A65335a07",
"marketplace": "magic_eden",
"ordersData": [
{
"orderId": "0xdb10541c97abdf95eaf55e77b619c58ed06d6b14469131badc657dabb2a823f0",
"quantity": "18"
}
],
"walletType": "sequence"
},
"response": {
"steps": [
{
"id": "tokenApproval",
"data": "0xe7acab24000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006c00000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000d2efbb2f18bfe3d265b26d2ace83400a65335a0700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000004cefda7eb55d6f7dd913032d4ee88ac5609594380000000000000000000000002d1a340cd83434243d090931afabf95b7d3078b00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000066fe1db4000000000000000000000000000000000000000000000000000000006726fc7000000000000000000000000000000000000000000000000000000000000000000e1c0c381d4da48b0000000000000000d467a7aec379c278c0ddc9a86b559e5a87328c9043e7bf343695554eaaf5a8892f7205e300000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000044b3f42e2bf34f62868ff9e9dab7c2f807ba97cb0000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d3751fe908000000000000000000000000000000000000000000000000000000d3751fe9080000000000000000000000000004cefda7eb55d6f7dd913032d4ee88ac5609594380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b5e620f480000000000000000000000000000000000000000000000000000000b5e620f4800000000000000000000000000099f1117f13e072b299942037e6a5d1469912b47a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000048c273950000000000000000000000000000000000000000000000000000000048c2739500000000000000000000000000006fa303e72bed54f515a513496f922bc331e2f27e00000000000000000000000000000000000000000000000000000000000000413cc3ca6b43ab8b01102879bf64a0311a4d92a6727904c2f29a475bf163d77f3900e2fea71f1b616059f353a17e39ccc6c65b289c52aeb971bc0b2dea67d0380c1b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000006707e6368b5bfbd9116608291be1bb6c97bb58d16839d624521f85dd1c8a09368e7d4c7d5d8ce5d60813788e5f08aae22963c5af59a51f087b98ff8a5181cba8ab8278e300c3d56aceec35c08a9a2ed624c39a99054544aa5ccdaba5b2792fce5025476b31000000000000000000000000000000000000000000000000000000000000000000001d4da48b00000000",
"to": "0x0000000000000068F116a894984e2DB1123eB395",
"value": "0x038d7ea4c68000",
"signature": null,
"post": null,
"executeType": null
}
]
}
}
}
Loading

0 comments on commit 76d91e1

Please sign in to comment.