You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Re-export signer type (`pub use <name>::<Name>Signer`)
55
60
3.`Signer` enum variant
56
61
4. Factory method on `impl Signer` (`from_<name>`)
57
-
5.**All 5 match arms** in `impl SolanaSigner for Signer`:
62
+
5.**All 4 match arms** in `impl SolanaSigner for Signer`:
58
63
-`pubkey()`
59
64
-`sign_transaction()`
60
65
-`sign_message()`
61
-
-`sign_partial_transaction()`
62
66
-`is_available()`
63
67
6. Add feature to `compile_error!` cfg gate (search for `compile_error!`)
64
68
65
69
**c) `rust/src/error.rs`** — If signer uses reqwest, add feature to the `#[cfg(any(...))]` gate on `From<reqwest::Error> for SignerError`. Without this, `?` on reqwest calls won't compile.
66
70
67
71
### Critical Gotchas
68
72
69
-
-**5 trait methods**: Always read `rust/src/traits.rs` for the current trait definition — it is the source of truth.
70
-
-**Return type**: `sign_transaction` and `sign_partial_transaction` return `SignedTransaction = (String, Signature)` — a tuple of base64-encoded transaction + signature.
73
+
-**4 trait methods**: Always read `rust/src/traits.rs` for the current trait definition — it is the source of truth. The trait has `pubkey()`, `sign_transaction()`, `sign_message()`, and `is_available()`.
74
+
-**Return type**: `sign_transaction` returns `SignTransactionResult` (an enum of `Complete(SignedTransaction)` or `Partial(SignedTransaction)`). Use `TransactionUtil::classify_signed_transaction()` from `rust/src/transaction_util.rs` to classify the result.
75
+
-**Shared utilities**: Use `TransactionUtil::add_signature_to_transaction()` and `TransactionUtil::serialize_transaction()` instead of implementing your own.
71
76
-**SDK adapter**: Import types from `crate::sdk_adapter`, not `solana_sdk` directly. The project supports both SDK v2 and v3 via an adapter layer.
72
-
-**`sign_partial_transaction`**: Serialize with `requireAllSignatures: false`. See existing signers (e.g., `rust/src/para/mod.rs`) for the pattern.
77
+
-**HTTPS enforcement**: Remote signers must use `reqwest::ClientBuilder::https_only(true)` gated behind `#[cfg(not(test))]` for wiremock compatibility.
78
+
-**HTTP timeouts**: Accept optional `HttpClientConfig` from `crate::http_client_config` for request/connect timeouts (defaults: 30s/5s).
79
+
-**Error safety**: Never use `.expect()` or `.unwrap()` on untrusted API responses. Both `Display` and `Debug` on `SignerError` are redacted — keep error messages generic.
@@ -89,6 +96,7 @@ let mut signer = <Name>Signer::new(config);
89
96
signer.init().await?;
90
97
Ok(Self::<Name>(signer))
91
98
```
99
+
**Important**: Use `Option<Pubkey>` (not `Pubkey::default()`) for the public key field before `init()`. Return `SignerError::ConfigError` from signing methods if `init()` hasn't been called.
92
100
93
101
**Async constructor** (no separate init step): AWS KMS, GCP KMS
0 commit comments