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
Copy file name to clipboardExpand all lines: packages/sdk/docs/HOW_TO_CREATE_A_SPOKE_PROVIDER.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,44 @@ Raw spoke providers are ideal for:
43
43
44
44
**Note**: When using raw spoke providers with Sodax features, you must pass the `raw: true` flag to methods like `createIntent()`, `supply()`, etc. This ensures the methods return raw transaction data instead of attempting to execute transactions.
45
45
46
+
### Constructing a Raw Spoke Provider from Config
47
+
48
+
When you have a generic config object (e.g. from API or runtime) and want a single entry point to build the correct raw spoke provider for any supported chain, use the **`constructRawSpokeProvider`** helper. It dispatches on `config.chainConfig.chain.type` and returns the appropriate raw spoke provider instance.
49
+
50
+
**Signature**
51
+
52
+
```typescript
53
+
function constructRawSpokeProvider(config:RawSpokeProviderConfig):RawSpokeProvider
// rawSpokeProvider is EvmRawSpokeProvider — use with Sodax features and raw: true
80
+
```
81
+
82
+
Use`constructRawSpokeProvider`whenthechaintypeis determined at runtime or when you want one code path that works for all supported chains. For a known chain type, you can still instantiate the specific raw spoke provider class directly (e.g. `new EvmRawSpokeProvider(...)`) as shown in the chain-specific sections below.
83
+
46
84
## Prerequisites
47
85
48
86
Beforecreatingaspokeprovider, ensureyouhave:
@@ -1073,6 +1111,7 @@ For detailed staking documentation, see [STAKING.md](./STAKING.md).
0 commit comments