GetInterchain: perChain + chains options (default first anchor per chain)
Transaction.GetInterchain and Block.GetInterchain take variadic options (client.WithPerChain / client.WithChains, re-exported as sdk.WithPerChain / sdk.WithChains) that map to the new prime-node ?perChain=&chains= query params. Backward compatible: existing no-option calls get the default (one anchor per chain). client.InterchainQuery builds the suffix; unit-tested.
This commit is contained in:
19
README.md
19
README.md
@@ -128,8 +128,27 @@ All API methods accept a `context.Context` as their first parameter for timeout
|
||||
- `Create(ctx, req)` - Create a new transaction
|
||||
- `CreateBulk(ctx, req)` - Create multiple transactions
|
||||
- `Get(ctx, transactionID)` - Get transaction by ID
|
||||
- `GetInterchain(ctx, transactionID, opts...)` - Trace a transaction's interchain anchors
|
||||
- `List(ctx)` - List all transactions
|
||||
|
||||
#### Interchain trace options
|
||||
|
||||
`Transaction.GetInterchain` and `Block.GetInterchain` trace a prime block to the
|
||||
public-chain anchors covering it. By default they return the **first anchor per
|
||||
chain** (anchor proofs are chained, so the earliest per chain is the meaningful
|
||||
one). Tune with functional options:
|
||||
|
||||
```go
|
||||
// Default: first anchor per chain (ETH, BTC, …)
|
||||
trace, _ := client.Block.GetInterchain(ctx, "42")
|
||||
|
||||
// Up to 3 anchors per chain
|
||||
trace, _ = client.Block.GetInterchain(ctx, "42", sdk.WithPerChain(3))
|
||||
|
||||
// All anchors, only the ETH-mainnet chain ("1"); "0" = BTC
|
||||
trace, _ = client.Block.GetInterchain(ctx, "42", sdk.WithPerChain(0), sdk.WithChains("1"))
|
||||
```
|
||||
|
||||
### Transaction Type
|
||||
- `Create(ctx, req)` - Create a new transaction type
|
||||
- `Get(ctx, txnType)` - Get transaction type by name
|
||||
|
||||
Reference in New Issue
Block a user