Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions examples/basic_solana/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ base64 = "0.22.1"
bincode = { workspace = true }
bs58 = { workspace = true }
candid = { workspace = true }
# Transitive dependency of ic-ed25519
# Transitive dependency
# See https://forum.dfinity.org/t/module-imports-function-wbindgen-describe-from-wbindgen-placeholder-that-is-not-exported-by-the-runtime/11545/8
getrandom = { workspace = true, default-features = false, features = ["custom"] }
ic-cdk = { workspace = true }
ic-ed25519 = { workspace = true }
http = { workspace = true }
num = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sol_rpc_client = { path = "../../libs/client" }
sol_rpc_types = { path = "../../libs/types" }
solana-account-decoder-client-types = { workspace = true }
solana-hash = { workspace = true }
solana-instruction = { workspace = true }
solana-message = { workspace = true }
Expand Down
7 changes: 5 additions & 2 deletions examples/basic_solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ equivalent of "gas" on other blockchains).
### Deploy the smart contract to the Internet Computer

```bash
dfx deploy --ic basic_solana --argument '(record {solana_network = opt variant {Devnet}; ed25519_key_name = opt variant {TestKey1}})'
dfx deploy --ic basic_solana --argument (opt record { solana_network = opt variant {Devnet}; ed25519_key_name = opt variant {TestKey1}; sol_rpc_canister_id = null })
```

#### What this does

- `dfx deploy` tells the command line interface to `deploy` the smart contract
- `--ic` tells the command line to deploy the smart contract to the mainnet ICP blockchain
- `--argument (opt record {solana_network = opt variant {Devnet}; ed25519_key_name = opt variant {TestKey1}})`
- `--argument (opt record { solana_network = opt variant {Devnet}; ed25519_key_name = opt variant {TestKey1}; sol_rpc_canister_id = null })`
initializes the smart contract with the provided arguments:
- `solana_network = opt variant {Devnet}`: the canister uses
the [Solana Devnet](https://solana.com/docs/core/clusters)
Expand All @@ -62,6 +62,9 @@ dfx deploy --ic basic_solana --argument '(record {solana_network = opt variant {
available on the ICP mainnet.
See [signing messages](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/encryption/signing-messages#signing-messages-1)
for more details.
- `sol_rpc_canister_id = null`: the canister makes RPC requests to the Solana network via the standard SOL-RPC canister on the ICP (
canister ID: `tghme-zyaaa-aaaar-qarca-cai`). This can be replaced by the canister ID of another SOL-RPC canister, e.g. a
locally deployed one.

If successful, you should see an output that looks like this:

Expand Down
5 changes: 5 additions & 0 deletions examples/basic_solana/basic_solana.did
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
type InitArg = record {
// The canister will interact with this Solana network.
// If not specified, the value is set to `Devnet`.
solana_network : opt SolanaNetwork;
// EdDSA keys will be derived from this key.
// If not specified, the value is set to `TestKeyLocalDevelopment`.
ed25519_key_name : opt Ed25519KeyName;
// The canister will interact with this SOL RPC canister.
// If not specified, the value is set to `tghme-zyaaa-aaaar-qarca-cai`.
sol_rpc_canister_id : opt principal;
};

type SolanaNetwork = variant {
Expand Down
Loading