Package com.tnsai.payment.x402
Record Class WalletSpec
java.lang.Object
java.lang.Record
com.tnsai.payment.x402.WalletSpec
- Record Components:
backend- backend identifier, e.g."in-memory","env-keystore"; matches the factory's discovery namenetwork- target network — wallets are network-bound at creation timeattributes- backend-specific key/value config (never null)
public record WalletSpec(String backend, Network network, Map<String,String> attributes)
extends Record
Backend-agnostic configuration a
Wallet.Factory consumes to
instantiate a Wallet.
The shape stays deliberately bag-of-attributes — each concrete wallet
backend (env keystore, AWS KMS, hardware ledger, …) reads the keys it
cares about and ignores the rest. P2 only ships InMemoryWallet
which reads address from attributes(); production
backends arrive in P4.
Common keys callers are expected to populate (per-backend):
address— the wallet's public address (always required; backends that derive from a private key still echo it here so the upper layer doesn't need to round-trip the key).passphrase_env— env var holding the unlock passphrase (env-keystore backend).keystore_path— path to a JSON keystore on disk (env-keystore backend).remote_signer_url— URL of an out-of-process signing service (delegated-wallet backend).
None of these keys are validated here on purpose — the factory's
Wallet.Factory.create(WalletSpec) is the only place that knows
what it actually needs.
- Since:
- 0.10.5 (TNS-449 P2)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvenience accessor — returns the attribute value ornull.Returns the value of theattributesrecord component.backend()Returns the value of thebackendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.network()Returns the value of thenetworkrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
WalletSpec
Creates an instance of aWalletSpecrecord class.- Parameters:
backend- the value for thebackendrecord componentnetwork- the value for thenetworkrecord componentattributes- the value for theattributesrecord component
-
-
Method Details
-
attr
Convenience accessor — returns the attribute value ornull. Identical toattributes().get(key)but reads more cleanly at call sites where the bag-of-attributes shape feels noisy. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
backend
Returns the value of thebackendrecord component.- Returns:
- the value of the
backendrecord component
-
network
Returns the value of thenetworkrecord component.- Returns:
- the value of the
networkrecord component
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-