Background
USDCx offers (Splice TransferInstruction) already carry an executeBefore : Time field on-ledger. The Go SDK currently hardcodes it to requestedAt + 1h (pkg/cantonsdk/token/client.go:32, 651-653, 893, 1422), so callers have no control over offer validity.
Scope
Plumb a per-call validity duration through the SDK while keeping current callers behaviourally identical.
- Replace
defaultTransferValidity = time.Hour with a much larger default (effectively unbounded, e.g. ~100 years) so existing callers that don't pass a value continue to work, and accidentally expired offers stop appearing in lab/dev environments.
- Add an optional
Validity time.Duration (or ExecuteBefore time.Time) to PrepareTransferRequest and TransferRequest in pkg/cantonsdk/token/types.go. When set, the SDK uses it; when zero, falls back to the default.
- Custodial path (
Client.Transfer / transferViaFactory): consume the new field directly.
- Non-custodial path (
Client.PrepareTransfer): same plumbing, but the HTTP API doesn't yet expose the field. Leave a // TODO(#<this-issue>+1): pass validity from API request next to the call site so the next issue can wire it up.
Out of scope
Indexer changes, API request shape, claim-back. Tracked in follow-up issues.
Acceptance
- New optional validity field accepted on prepare/transfer requests.
- Default validity is effectively infinite — no behaviour change for existing callers, no offer accidentally expires.
- All current tests pass without modification.
Background
USDCx offers (Splice
TransferInstruction) already carry anexecuteBefore : Timefield on-ledger. The Go SDK currently hardcodes it torequestedAt + 1h(pkg/cantonsdk/token/client.go:32, 651-653, 893, 1422), so callers have no control over offer validity.Scope
Plumb a per-call validity duration through the SDK while keeping current callers behaviourally identical.
defaultTransferValidity = time.Hourwith a much larger default (effectively unbounded, e.g. ~100 years) so existing callers that don't pass a value continue to work, and accidentally expired offers stop appearing in lab/dev environments.Validity time.Duration(orExecuteBefore time.Time) toPrepareTransferRequestandTransferRequestinpkg/cantonsdk/token/types.go. When set, the SDK uses it; when zero, falls back to the default.Client.Transfer/transferViaFactory): consume the new field directly.Client.PrepareTransfer): same plumbing, but the HTTP API doesn't yet expose the field. Leave a// TODO(#<this-issue>+1): pass validity from API requestnext to the call site so the next issue can wire it up.Out of scope
Indexer changes, API request shape, claim-back. Tracked in follow-up issues.
Acceptance