Class: WidgetProvider
The EIP-1193 provider the RP receives from
UpbondClient.getEthereumProvider() (embedded mode). It bridges standard
request() calls to the wallet-origin widget over a MessagePort and emits
the standard connect/disconnect/accountsChanged/chainChanged events;
ethers/viem plug into it directly. Keys, tokens, and the signing ceremony
stay inside the widget — this object only ever sees addresses, chain id, and
signatures. Obtain instances via the SDK facade rather than constructing one.
Constructors
Constructor
new WidgetProvider(
frame,opts?):WidgetProvider
Parameters
frame
WidgetFrame
opts?
requestTimeoutMs?
number
Returns
WidgetProvider
Accessors
accounts
Get Signature
get accounts():
string[]
The currently connected accounts, from the last widget state snapshot.
Returns
string[]
chainId
Get Signature
get chainId():
`0x${string}`
The active chain id as a 0x-prefixed hex string. Moved by
wallet_switchEthereumChain and by the in-widget network picker; both
emit chainChanged (docs/24 D22).
Returns
`0x${string}`
connected
Get Signature
get connected():
boolean
Whether the widget currently reports a connected wallet.
Returns
boolean
Methods
closeWallet()
closeWallet():
void
Hide the wallet overlay.
Returns
void
destroy()
destroy():
void
Rejects every in-flight request and detaches from the port. Called by EmbeddedWallet.destroy() — a torn-down widget must not leave callers awaiting forever.
Returns
void
on()
on(
event,listener):this
Subscribe to a provider event (EIP-1193 on); returns this for chaining.
Parameters
event
listener
(payload) => void
Returns
this
openWallet()
openWallet(
view?,options?):void
RP-initiated overlay open (e.g. a "wallet" button): shows the frame and tells the widget which view to render.
Parameters
view?
WalletView = 'home'
options?
Returns
void
removeListener()
removeListener(
event,listener):this
Unsubscribe a listener previously added with WidgetProvider.on.
Parameters
event
listener
(payload) => void
Returns
this
request()
request<
T>(args,opts?):Promise<T>
Issue an EIP-1193 JSON-RPC request to the wallet. Signing methods surface a confirm + fresh-biometric ceremony inside the widget before resolving.
Type Parameters
T
T = unknown
Parameters
args
The method and optional params.
opts?
timeoutMs overrides the provider-wide request timeout for
this one call (e.g. the SDK's logout uses a short bound so an
unresponsive widget cannot stall the issuer sign-out).
timeoutMs?
number
Returns
Promise<T>
The RPC result.
Throws
Eip1193Error on an RPC error, a request timeout (widget unresponsive), or a destroyed provider.