From b7d2893fa4d8894b795e6252d79931a4c803e804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Fri, 26 Jul 2024 09:47:55 +0200 Subject: [PATCH] Add Bruno collection for interacting with swaps and specifically for NIM-to-CRC swaps --- bruno_collection/Assets.bru | 11 +++++++ bruno_collection/Cancel Swap.bru | 11 +++++++ bruno_collection/Get Swap.bru | 11 +++++++ bruno_collection/NIM to CRC/Confirm Swap.bru | 33 ++++++++++++++++++++ bruno_collection/NIM to CRC/Create Swap.bru | 27 ++++++++++++++++ bruno_collection/bruno.json | 13 ++++++++ bruno_collection/collection.bru | 3 ++ bruno_collection/environments/Testnet.bru | 7 +++++ 8 files changed, 116 insertions(+) create mode 100644 bruno_collection/Assets.bru create mode 100644 bruno_collection/Cancel Swap.bru create mode 100644 bruno_collection/Get Swap.bru create mode 100644 bruno_collection/NIM to CRC/Confirm Swap.bru create mode 100644 bruno_collection/NIM to CRC/Create Swap.bru create mode 100644 bruno_collection/bruno.json create mode 100644 bruno_collection/collection.bru create mode 100644 bruno_collection/environments/Testnet.bru diff --git a/bruno_collection/Assets.bru b/bruno_collection/Assets.bru new file mode 100644 index 0000000..ee21051 --- /dev/null +++ b/bruno_collection/Assets.bru @@ -0,0 +1,11 @@ +meta { + name: Assets + type: http + seq: 1 +} + +get { + url: {{API_URL}}/fast/v1/assets + body: none + auth: none +} diff --git a/bruno_collection/Cancel Swap.bru b/bruno_collection/Cancel Swap.bru new file mode 100644 index 0000000..1b160c3 --- /dev/null +++ b/bruno_collection/Cancel Swap.bru @@ -0,0 +1,11 @@ +meta { + name: Cancel Swap + type: http + seq: 2 +} + +delete { + url: {{API_URL}}/fast/v1/swaps/{{swap_id}} + body: none + auth: none +} diff --git a/bruno_collection/Get Swap.bru b/bruno_collection/Get Swap.bru new file mode 100644 index 0000000..a36acc2 --- /dev/null +++ b/bruno_collection/Get Swap.bru @@ -0,0 +1,11 @@ +meta { + name: Get Swap + type: http + seq: 3 +} + +get { + url: {{API_URL}}/fast/v1/swaps/{{swap_id}} + body: none + auth: none +} diff --git a/bruno_collection/NIM to CRC/Confirm Swap.bru b/bruno_collection/NIM to CRC/Confirm Swap.bru new file mode 100644 index 0000000..d6dfb5f --- /dev/null +++ b/bruno_collection/NIM to CRC/Confirm Swap.bru @@ -0,0 +1,33 @@ +meta { + name: Confirm Swap + type: http + seq: 2 +} + +post { + url: {{API_URL}}/fast/v1/swaps/{{swap_id}} + body: json + auth: none +} + +body:json { + { + "confirm": true, + "beneficiary": { + "CRC": { + "kty": "OKP", + "crv": "Ed25519", + "x": "uV_GMw9cXt9fSwuGq61GNfOejJcljCIDfC5aP_FVyx4" + } + }, + "refund": { + "NIM": "NQ65 KV7F 17QA LBYD V0SA NQ6B FCLX 3MYG XK6C" + } + } +} + +docs { + - Private Key: `47d8e55cda5a42a49b0f908cb916e45c958e663c7095ee8d12c3dd05a96dc435` + - Public Key: `b95fc6330f5c5edf5f4b0b86abad4635f39e8c97258c22037c2e5a3ff155cb1e` + - Address: `NQ65 KV7F 17QA LBYD V0SA NQ6B FCLX 3MYG XK6C` +} diff --git a/bruno_collection/NIM to CRC/Create Swap.bru b/bruno_collection/NIM to CRC/Create Swap.bru new file mode 100644 index 0000000..b838ba1 --- /dev/null +++ b/bruno_collection/NIM to CRC/Create Swap.bru @@ -0,0 +1,27 @@ +meta { + name: Create Swap + type: http + seq: 1 +} + +post { + url: {{API_URL}}/fast/v1/swaps + body: json + auth: none +} + +body:json { + { + "from": "NIM", + "to": { + "CRC": 500 + }, + "includedFees": "required" + } +} + +script:post-response { + let data = res.getBody(); + bru.setEnvVar("swap_id",data.id); + +} diff --git a/bruno_collection/bruno.json b/bruno_collection/bruno.json new file mode 100644 index 0000000..821f184 --- /dev/null +++ b/bruno_collection/bruno.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "name": "Fastspot v1", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ], + "presets": { + "requestType": "http", + "requestUrl": "{{API_URL}}/fast/v1/" + } +} \ No newline at end of file diff --git a/bruno_collection/collection.bru b/bruno_collection/collection.bru new file mode 100644 index 0000000..6b46c62 --- /dev/null +++ b/bruno_collection/collection.bru @@ -0,0 +1,3 @@ +headers { + X-FAST-ApiKey: {{API_KEY}} +} diff --git a/bruno_collection/environments/Testnet.bru b/bruno_collection/environments/Testnet.bru new file mode 100644 index 0000000..29f5aea --- /dev/null +++ b/bruno_collection/environments/Testnet.bru @@ -0,0 +1,7 @@ +vars { + API_URL: https://api.test.fastspot.io + swap_id: empty +} +vars:secret [ + API_KEY +]