diff --git a/solana/caip2.md b/solana/caip2.md index ec53878..5eded2a 100644 --- a/solana/caip2.md +++ b/solana/caip2.md @@ -34,7 +34,7 @@ The definition for this namespace will use the `genesisHash` as an identifier for different Solana chains. The method for calculating the chain ID is as follows with pseudo-code: -``` +```bash truncate(genesisHash, 32) ``` @@ -72,7 +72,7 @@ Not applicable This is a list of manually composed examples -``` +```bash # Solana Mainnet solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp @@ -91,9 +91,6 @@ solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z - [Base58btc][] encoding "alphabet" (i.e. character-set) [CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md -[Address Lookup Table Proposal]: https://docs.solana.com/proposals/transactions-v2 -[Account Types]: https://docs.solana.com/terminology#account -[Address Expressions]: https://docs.solana.com/cli/transfer-tokens#receive-tokens [Cluster]: https://docs.solana.com/clusters [RPC Endpoints]: https://docs.solana.com/cluster/rpc-endpoints [Solana core]: https://crates.io/crates/solana-program/ diff --git a/solana/caip25.md b/solana/caip25.md index bf0c52e..baf1462 100644 --- a/solana/caip25.md +++ b/solana/caip25.md @@ -25,22 +25,19 @@ Few use-cases incorporating multiple Solana-compatible networks require granular ## Multichain Considerations -Developers addressing multichain use-cases incorporating non-Solana networks are RECOMMENDED to use distinct [CAIP-217] authorization objects per chain type, in cases where those [CAIP-25] capabilities and configurations can be deterministically mapped to [Wallet Standard Multichain Extensions] variables by a [CAIP-25] provider. +Developers addressing multichain use-cases incorporating non-Solana networks are RECOMMENDED to use distinct [CAIP-217] authorization objects per chain type, in cases where those [CAIP-25] capabilities and configurations can be deterministically mapped to [Wallet Standard Multichain Extensions] variables by a [CAIP-25] provider. Also, consumers of the [Wallet Standard][] interface assume the `WalletAdapterNetwork` enum variable to be set to exactly one network at a time, so implementers are recommended to map only one `chains` member at a time to this standard interface, whether by ordering it by preference or by never allowing it to have more than one member at a time. -## Session Properties +## Setting Environmental Variables to pass via Wallet Standard -Wallet capabilities in the [Wallet Standard] model are declared upfront at time of connection and persisted as read-only constants, so wallets are recommended to declare them explicitly in the `sessionProperties` object in a [CAIP-25] interaction for maximum interoperability and stability. -Note that the `sessionProperties` object is shared across any and all namespaces in a given wallet<>application session, which may span multiple types of networks all declaring `sessionProperties`, so to avoid collisions the following properties names are recommended for easily mapping to the **case-sensitive** properties names in the [Wallet Standard]: +Wallet capabilities in the [Wallet Standard] model are declared upfront at time of connection and persisted as read-only constants. +For maximum interoperability and stability, wallets are recommended to declare these variables explicitly in the `scopedProperties` object corresponding to each Solana scope they authorize when accepting a [CAIP-25] connection. +Note that the `scopedProperties` object is partitioned to parallel the `sessionScopes`, so duplicate entries need to be made for each Solana scope. -|`sessionProperties` key in [CAIP-25] expression|[Wallet Adapter] mapping|values|documentation|reference implementation| +|`scopedProperties` key in [CAIP-25] expression|[Wallet Adapter] mapping|values|documentation|interface reference| |---|---|---|---|---| -|`SolanaTransactionVersion`|`SolanaTransactionVersion`|`0` or `legacy` (default)|[solana.com][Transaction Version Declaration]|[github.com][Transaction Version Refimpl]| -|`SolanaTransactionCommitment`|`SolanaTransactionCommitment`|`finalized` (default), `confirmed`, `processed`|[solana.com][State Commitment Declaration]|[github.com][State Commitment Refimpl]| - -As these properties are mandatory and required for stability in [Wallet Standard] connections, [CAIP-25] providers MAY inject defaults if any of the above are not set explicitly by a wallet. -For this reason, wallets are RECOMMENDED to set them explicitly even if not requested by their counterparty to avoid inaccurate values being injected. +|`supportedTransactionVersions`|`supportedTransactionVersions`|array containing `0` and/or `legacy` (both by default)|[solana.com][Transaction Version Declaration]|[github.com][Transaction Version Interface Reference]| ## Examples @@ -53,16 +50,37 @@ Example CAIP-25 Request "jsonrpc": "2.0", "method": "provider_authorize", "params": { - "optionalScopes": { - "eip155": { ... }, - "solana": { ... } + "sessionScopes": { + "bip122": { ... }, + "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": { ... } + "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": { ... } + }, + } +} + +``` + +Example CAIP-25 Response + +```json + +{ + "id": 1, + "jsonrpc": "2.0", + "method": "provider_authorize", + "params": { + "sessionScopes": { + "bip122": { ... }, + "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": { ... } + "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": { ... } }, - "sessionProperties": { - "capabilities": { ... } - "eip155": { ... } - "solana": { - "SolanaTransactionVersion": "0", - "SolanaTransactionCommitment": "finalized" + "scopedProperties": { + "bip122": { ... } + "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": { + "supportedTransactionVersions": ["legacy", "0"] + } + "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": { + "supportedTransactionVersions": ["0"] } } } @@ -77,15 +95,12 @@ Example CAIP-25 Request - [Wallet Adapter][] Tooling - [Wallet Standard Multichain Extensions][] - [Transaction Version Declaration][] -- [State Commitment Declaration][] [Wallet Adapter]: https://github.com/anza-xyz/wallet-adapter/tree/master?tab=readme-ov-file#wallet-adapter [Wallet Standard]: https://wallet-standard.github.io/wallet-standard/ [Wallet Standard Multichain Extensions]: https://github.com/wallet-standard/wallet-standard/blob/master/EXTENSIONS.md [Transaction Version Declaration]: https://solana.com/docs/core/transactions/versions#current-transaction-versions -[Transaction Version Refimpl]: https://github.com/anza-xyz/wallet-standard/blob/2c354cf07daa1d440ba9631fcefc5c00b07aa9dd/packages/core/features/src/signTransaction.ts#L31 -[State Commitment Declaration]: https://solana.com/docs/rpc#configuring-state-commitment -[State Commitment Refimpl]: https://github.com/anza-xyz/wallet-standard/blob/2c354cf07daa1d440ba9631fcefc5c00b07aa9dd/packages/core/features/src/signTransaction.ts#L66 +[Transaction Version Interface Reference]: https://github.com/wallet-standard/wallet-standard/blob/master/packages/example/wallets/src/solanaWallet.ts#L79-L88 [CAIP-25]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-25.md [CAIP-217]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-217.md [EIP155]: https://eips.ethereum.org/EIPS/eip-155