Skip to content

Commit

Permalink
Add Bruno collection for interacting with swaps and specifically for …
Browse files Browse the repository at this point in the history
…NIM-to-CRC swaps
  • Loading branch information
sisou committed Jul 26, 2024
1 parent 9c43da7 commit b7d2893
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bruno_collection/Assets.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: Assets
type: http
seq: 1
}

get {
url: {{API_URL}}/fast/v1/assets
body: none
auth: none
}
11 changes: 11 additions & 0 deletions bruno_collection/Cancel Swap.bru
Original file line number Diff line number Diff line change
@@ -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
}
11 changes: 11 additions & 0 deletions bruno_collection/Get Swap.bru
Original file line number Diff line number Diff line change
@@ -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
}
33 changes: 33 additions & 0 deletions bruno_collection/NIM to CRC/Confirm Swap.bru
Original file line number Diff line number Diff line change
@@ -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`
}
27 changes: 27 additions & 0 deletions bruno_collection/NIM to CRC/Create Swap.bru
Original file line number Diff line number Diff line change
@@ -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);

}
13 changes: 13 additions & 0 deletions bruno_collection/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "1",
"name": "Fastspot v1",
"type": "collection",
"ignore": [
"node_modules",
".git"
],
"presets": {
"requestType": "http",
"requestUrl": "{{API_URL}}/fast/v1/"
}
}
3 changes: 3 additions & 0 deletions bruno_collection/collection.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
headers {
X-FAST-ApiKey: {{API_KEY}}
}
7 changes: 7 additions & 0 deletions bruno_collection/environments/Testnet.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vars {
API_URL: https://api.test.fastspot.io
swap_id: empty
}
vars:secret [
API_KEY
]

0 comments on commit b7d2893

Please sign in to comment.