-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into tt-1936-seth-simulate…
…d-backend
- Loading branch information
Showing
77 changed files
with
5,393 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Aptos Blockchain Client | ||
|
||
You need to turn `Rosetta` off to use this image! Image doesn't work with `OrbStack` currently. | ||
|
||
Docker Desktop | ||
|
||
![img.png](rosetta-settings.png) | ||
|
||
Default image is `aptoslabs/tools:aptos-node-v1.18.0` | ||
|
||
API is available on [localhost:8080](http://localhost:8080/v1) | ||
|
||
## Configuration | ||
|
||
```toml | ||
[blockchain_a] | ||
type = "aptos" | ||
image = "aptoslabs/tools:aptos-node-v1.18.0" # or aptoslabs/tools:nightly | ||
contracts_dir = "$your_dir" | ||
``` | ||
|
||
## Usage | ||
|
||
```golang | ||
package examples | ||
|
||
import ( | ||
"github.com/go-resty/resty/v2" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
type CfgAptos struct { | ||
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"` | ||
} | ||
|
||
func TestAptosSmoke(t *testing.T) { | ||
in, err := framework.Load[CfgAptos](t) | ||
require.NoError(t, err) | ||
|
||
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA) | ||
require.NoError(t, err) | ||
|
||
// execute any additional commands, to deploy contracts or set up | ||
// network is already funded, here are the keys | ||
_ = blockchain.DefaultAptosAccount | ||
_ = blockchain.DefaultAptosPrivateKey | ||
|
||
_, err = framework.ExecContainer(bc.ContainerName, []string{"ls", "-lah"}) | ||
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 interact | ||
_ = bc.Nodes[0].HostHTTPUrl | ||
r := resty.New().SetBaseURL(bc.Nodes[0].HostHTTPUrl).EnableTrace() | ||
_, err := r.R().Get("/v1/transactions") | ||
require.NoError(t, err) | ||
}) | ||
} | ||
``` | ||
|
||
## Test Private Keys | ||
|
||
Default account is already funded with `100000000 Octas` | ||
|
||
``` | ||
Account: 0xa337b42bd0eecf8fb59ee5929ea4541904b3c35a642040223f3d26ab57f59d6e | ||
PrivateKey: 0xd477c65f88ed9e6d4ec6e2014755c3cfa3e0c44e521d0111a02868c5f04c41d4 | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Sui Blockchain Client | ||
|
||
API is available on [localhost:9000](http://localhost:9000) | ||
|
||
## Configuration | ||
|
||
```toml | ||
[blockchain_a] | ||
type = "sui" | ||
image = "mysten/sui-tools:mainnet" # if omitted default is mysten/sui-tools:devnet | ||
contracts_dir = "$your_dir" | ||
``` | ||
|
||
## Usage | ||
|
||
```golang | ||
package examples | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/block-vision/sui-go-sdk/models" | ||
"github.com/block-vision/sui-go-sdk/signer" | ||
"github.com/block-vision/sui-go-sdk/sui" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
type CfgSui struct { | ||
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"` | ||
} | ||
|
||
func TestSuiSmoke(t *testing.T) { | ||
in, err := framework.Load[CfgSui](t) | ||
require.NoError(t, err) | ||
|
||
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA) | ||
require.NoError(t, err) | ||
|
||
// network is already funded, here are the keys | ||
_ = bc.NetworkSpecificData.SuiAccount.Mnemonic | ||
_ = bc.NetworkSpecificData.SuiAccount.PublicBase64Key | ||
_ = bc.NetworkSpecificData.SuiAccount.SuiAddress | ||
|
||
// execute any additional commands, to deploy contracts or set up | ||
_, err = framework.ExecContainer(bc.ContainerName, []string{"ls", "-lah"}) | ||
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 interact | ||
_ = bc.Nodes[0].HostHTTPUrl | ||
|
||
cli := sui.NewSuiClient(bc.Nodes[0].HostHTTPUrl) | ||
|
||
signerAccount, err := signer.NewSignertWithMnemonic(bc.NetworkSpecificData.SuiAccount.Mnemonic) | ||
require.NoError(t, err) | ||
rsp, err := cli.SuiXGetAllBalance(context.Background(), models.SuiXGetAllBalanceRequest{ | ||
Owner: signerAccount.Address, | ||
}) | ||
require.NoError(t, err) | ||
fmt.Printf("My funds: %v\n", rsp) | ||
}) | ||
} | ||
``` | ||
|
||
## Test Private Keys | ||
|
||
Since Sui doesn't have official local development chain we are using real node and generating mnemonic at start then funding that account through internal faucet, see | ||
``` | ||
// network is already funded, here are the keys | ||
_ = bc.NetworkSpecificData.SuiAccount.Mnemonic | ||
_ = bc.NetworkSpecificData.SuiAccount.PublicBase64Key | ||
_ = bc.NetworkSpecificData.SuiAccount.SuiAddress | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# TRON Blockchain Client | ||
|
||
## Configuration | ||
```toml | ||
[blockchain_a] | ||
type = "tron" | ||
# image = "tronbox/tre" is default image | ||
``` | ||
Default port is `9090` | ||
|
||
## Usage | ||
```golang | ||
package examples | ||
|
||
import ( | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
type CfgTron struct { | ||
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"` | ||
} | ||
|
||
func TestTRONSmoke(t *testing.T) { | ||
in, err := framework.Load[CfgTron](t) | ||
require.NoError(t, err) | ||
|
||
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA) | ||
require.NoError(t, err) | ||
|
||
// all private keys are funded | ||
_ = blockchain.TRONAccounts.PrivateKeys[0] | ||
|
||
t.Run("test something", func(t *testing.T) { | ||
// use internal URL to connect Chainlink nodes | ||
_ = bc.Nodes[0].DockerInternalHTTPUrl | ||
// use host URL to interact | ||
_ = bc.Nodes[0].HostHTTPUrl | ||
|
||
// use bc.Nodes[0].HostHTTPUrl + "/wallet" to access full node | ||
// use bc.Nodes[0].HostHTTPUrl + "/walletsolidity" to access Solidity node | ||
}) | ||
} | ||
``` | ||
|
||
## More info | ||
|
||
Follow the [guide](https://developers.tron.network/reference/tronbox-quickstart) if you want to work with `TRONBox` environment via JS | ||
|
||
## Golang HTTP Client | ||
|
||
TRON doesn't have any library to interact with it in `Golang` but we maintain our internal fork [here](https://github.com/smartcontractkit/chainlink-internal-integrations/tree/69e35041cdea0bc38ddf642aa93fd3cc3fb5d0d9/tron/relayer/gotron-sdk) | ||
|
||
Check TRON [HTTP API](https://tronprotocol.github.io/documentation-en/api/http/) | ||
|
||
Full node is on `:9090/wallet` | ||
``` | ||
curl -X POST http://127.0.0.1:9090/wallet/createtransaction -d '{ | ||
"owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ", | ||
"to_address": "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW", | ||
"amount": 1000000, | ||
"visible": true | ||
}' | ||
``` | ||
|
||
Solidity node is on `:9090/walletsolidity` | ||
``` | ||
curl -X POST http://127.0.0.1:9090/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}' | ||
``` |
Oops, something went wrong.