Skip to content

Class X402::RemoteWallet

Inherits: Object

HTTP client adapter implementing the duck-typed wallet interface by calling a remote @bsv/simple server wallet API.

Provides the same interface as BSV::Wallet::WalletClient: - +#get_public_key(identity_key:)+ — fetches the identity key - +#get_public_key(protocol_id:, key_id:, ...)+ — derives a key - +#internalize_action(tx:, outputs:, description:)+ — relays payment

Thread-safe: all mutable state is protected by a Mutex.

Constants

DEFAULT_TIMEOUT

seconds

Public Instance Methods

get_public_key(args = {}, **kwargs)

Fetch a public key from the remote wallet.

When +identity_key: true+, returns the wallet's identity public key (cached after first call). Otherwise, delegates to the remote wallet for BRC-42/43 key derivation.

Matches ProtoWallet interface: accepts a positional Hash of arguments. Also supports keyword arguments for convenience (used by tests and direct callers). - @param args [Hash] arguments hash (ProtoWallet style) - @return [Hash] +{ public_key: "hex" }+

initialize(url:, timeout: = DEFAULT_TIMEOUT)

  • @param url [String] base URL of the remote wallet API
  • @param timeout [Integer] HTTP timeout in seconds (default 10)
  • @return [RemoteWallet] a new instance of RemoteWallet

internalize_action(args = {}, **kwargs)

Relay a settled payment to the remote wallet for internalisation.

Matches ProtoWallet interface: accepts a positional Hash of arguments. Also supports keyword arguments for convenience. - @param args [Hash] arguments hash (ProtoWallet style) - @return [Hash] the wallet's response