Skip to content

Commit

Permalink
changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Dec 23, 2024
1 parent ec9d2df commit bf5da09
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 15 deletions.
1 change: 1 addition & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- [Components](framework/components/overview.md)
- [Blockchains](framework/components/blockchains/overview.md)
- [EVM](framework/components/blockchains/evm.md)
- [Solana](framework/components/blockchains/solana.md)
- [Optimism Stack]()
- [Arbitrum Stack]()
- [Chainlink](framework/components/chainlink.md)
Expand Down
64 changes: 64 additions & 0 deletions book/src/framework/components/blockchains/solana.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Solana Blockchain Client

Since `Solana` doesn't have official image for `arm64` we built it, images we use are:
```
amd64 solanalabs/solana:v1.18.26 - used in CI
arm64 f4hrenh9it/solana:latest - used locally
```

## Configuration
```toml
[blockchain_a]
type = "solana"
# public key for mint
public_key = "9n1pyVGGo6V4mpiSDMVay5As9NurEkY283wwRk1Kto2C"
# contracts directory, programs
contracts_dir = "."
# optional, in case you need some custom image
# image = "solanalabs/solana:v1.18.26"
```

## Usage
```golang
package examples

import (
"context"
"fmt"
"github.com/blocto/solana-go-sdk/client"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
"github.com/stretchr/testify/require"
"testing"
)

type CfgSolana struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
}

func TestSolanaSmoke(t *testing.T) {
in, err := framework.Load[CfgSolana](t)
require.NoError(t, err)

bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
require.NoError(t, err)

t.Run("test something", func(t *testing.T) {
// use internal URL to connect chainlink nodes
_ = bc.Nodes[0].DockerInternalHTTPUrl
// use host URL to deploy contracts
c := client.NewClient(bc.Nodes[0].HostHTTPUrl)
latestSlot, err := c.GetSlotWithConfig(context.Background(), client.GetSlotConfig{Commitment: "processed"})
require.NoError(t, err)
fmt.Printf("Latest slot: %v\n", latestSlot)
})
}
```

## Test Private Keys

```
Public: 9n1pyVGGo6V4mpiSDMVay5As9NurEkY283wwRk1Kto2C
Private: [11,2,35,236,230,251,215,68,220,208,166,157,229,181,164,26,150,230,218,229,41,20,235,80,183,97,20,117,191,159,228,243,130,101,145,43,51,163,139,142,11,174,113,54,206,213,188,127,131,147,154,31,176,81,181,147,78,226,25,216,193,243,136,149]
```

1 change: 1 addition & 0 deletions framework/.changeset/v0.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add basic Solana network support
2 changes: 1 addition & 1 deletion framework/components/blockchain/solana.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ commitment: finalized
`

var idJSONRaw = `
[94,214,238,83,144,226,75,151,226,20,5,188,42,110,64,180,196,244,6,199,29,231,108,112,67,175,110,182,3,242,102,83,103,72,221,132,137,219,215,192,224,17,146,227,94,4,173,67,173,207,11,239,127,174,101,204,65,225,90,88,224,45,205,117]
[11,2,35,236,230,251,215,68,220,208,166,157,229,181,164,26,150,230,218,229,41,20,235,80,183,97,20,117,191,159,228,243,130,101,145,43,51,163,139,142,11,174,113,54,206,213,188,127,131,147,154,31,176,81,181,147,78,226,25,216,193,243,136,149]
`

func defaultSolana(in *Input) {
Expand Down
13 changes: 1 addition & 12 deletions framework/examples/myproject/smoke_solana.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,4 @@
type = "solana"
public_key = "9n1pyVGGo6V4mpiSDMVay5As9NurEkY283wwRk1Kto2C"
contracts_dir = "."

[nodeset]
nodes = 5
override_mode = "all"

[nodeset.db]
image = "postgres:12.0"

[[nodeset.node_specs]]

[nodeset.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
image = "solanalabs/solana:v1.18.26"
2 changes: 0 additions & 2 deletions framework/examples/myproject/smoke_solana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import (
"github.com/blocto/solana-go-sdk/client"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set"
"github.com/stretchr/testify/require"
"testing"
)

type CfgSolana struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
NodeSet *ns.Input `toml:"nodeset" validate:"required"`
}

func TestSolanaSmoke(t *testing.T) {
Expand Down

0 comments on commit bf5da09

Please sign in to comment.