Skip to content

Commit 455dbfa

Browse files
authored
Merge branch 'main' into main
2 parents 8a9af9a + 91aaca6 commit 455dbfa

File tree

3 files changed

+28
-38
lines changed

3 files changed

+28
-38
lines changed

doc-site/docs/tutorials/chains/cardano.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ ff init cardano dev \
4646
--blockfrost-key previewXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4747
```
4848

49+
### Option 3: Use Blockfrost RYO
50+
51+
You can run a Blockfrost API provider for free on your own infrastructure. This is called Blockfrost Run-Your-Own or Blockfrost RYO. See [the service's GitHub page](https://github.com/blockfrost/blockfrost-backend-ryo) for more information on this.
52+
53+
The example below uses firefly-cli to
54+
- Create a new Cardano-based stack named `dev`
55+
- Connect to a Blockfrost RYO instance running at http://localhost:3000
56+
57+
```sh
58+
ff init cardano dev \
59+
--network preview \
60+
--blockfrost-base-url http://localhost:3000
61+
```
62+
4963
## Start the stack
5064

5165
Now you should be able to start your stack by running:
@@ -84,3 +98,7 @@ The response will look like
8498
```
8599

86100
If you're developing against a testnet such as preview, you can receive funds from the [testnet faucet](https://docs.cardano.org/cardano-testnets/tools/faucet). Pass the `address` from that response to the faucet.
101+
102+
## Next steps: Develop a contract
103+
104+
Now that you have a stack running, you're ready to start developing contracts for it. See the [Cardano custom contract guide](../custom_contracts/cardano.md) for more information.

internal/reference/reference.go

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"os"
2525
"path/filepath"
2626
"reflect"
27+
"slices"
2728
"strings"
2829

2930
"github.com/hyperledger/firefly-common/pkg/fftypes"
@@ -892,17 +893,11 @@ func writeStructFields(ctx context.Context, t reflect.Type, rootPageNames, simpl
892893

893894
fieldInRootPages := false
894895
fieldInSimpleTypes := false
895-
for _, rootPageName := range rootPageNames {
896-
if strings.ToLower(fieldType.Name()) == rootPageName {
897-
fieldInRootPages = true
898-
break
899-
}
896+
if slices.Contains(rootPageNames, strings.ToLower(fieldType.Name())) {
897+
fieldInRootPages = true
900898
}
901-
for _, simpleTypeName := range simpleTypeNames {
902-
if strings.ToLower(fieldType.Name()) == simpleTypeName {
903-
fieldInSimpleTypes = true
904-
break
905-
}
899+
if slices.Contains(simpleTypeNames, strings.ToLower(fieldType.Name())) {
900+
fieldInSimpleTypes = true
906901
}
907902

908903
link := ""
@@ -920,13 +915,7 @@ func writeStructFields(ctx context.Context, t reflect.Type, rootPageNames, simpl
920915
fireflyType = fmt.Sprintf("[%s](%s)", fireflyType, link)
921916

922917
// Generate the table for the sub type
923-
tableAlreadyGenerated := false
924-
for _, tableName := range generatedTableNames {
925-
if strings.ToLower(fieldType.Name()) == tableName {
926-
tableAlreadyGenerated = true
927-
break
928-
}
929-
}
918+
tableAlreadyGenerated := slices.Contains(generatedTableNames, strings.ToLower(fieldType.Name()))
930919
if isStruct && !tableAlreadyGenerated && !fieldInRootPages && !fieldInSimpleTypes {
931920
subFieldBuff.WriteString(fmt.Sprintf("## %s\n\n", fieldType.Name()))
932921
subFieldMarkdown, newTableNames, _ := generateObjectReferenceMarkdown(ctx, false, nil, fieldType, rootPageNames, simpleTypeNames, generatedTableNames, outputPath)

internal/spievents/websockets.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"encoding/json"
2222
"io"
23+
"slices"
2324
"sync"
2425
"time"
2526

@@ -66,36 +67,18 @@ func newWebSocket(ae *adminEventManager, wsConn *websocket.Conn) *webSocket {
6667
}
6768

6869
func (wc *webSocket) eventMatches(changeEvent *core.ChangeEvent) bool {
69-
collectionMatches := false
70-
for _, c := range wc.collections {
71-
if c == changeEvent.Collection {
72-
collectionMatches = true
73-
break
74-
}
75-
}
70+
collectionMatches := slices.Contains(wc.collections, changeEvent.Collection)
7671
if !collectionMatches {
7772
return false
7873
}
7974
if len(wc.filter.Namespaces) > 0 {
80-
namespaceMatches := false
81-
for _, ns := range wc.filter.Namespaces {
82-
if ns == changeEvent.Namespace {
83-
namespaceMatches = true
84-
break
85-
}
86-
}
75+
namespaceMatches := slices.Contains(wc.filter.Namespaces, changeEvent.Namespace)
8776
if !namespaceMatches {
8877
return false
8978
}
9079
}
9180
if len(wc.filter.Types) > 0 {
92-
typeMatches := false
93-
for _, t := range wc.filter.Types {
94-
if t == changeEvent.Type {
95-
typeMatches = true
96-
break
97-
}
98-
}
81+
typeMatches := slices.Contains(wc.filter.Types, changeEvent.Type)
9982
if !typeMatches {
10083
return false
10184
}

0 commit comments

Comments
 (0)