Examples

Action Examples & Tests

This file contains ready-to-use URLs and test scenarios for every WalletTwo action endpoint.

Replace http://localhost:5173 with your deployed origin when testing against a live environment.


auth

Example URLs

Minimal — postMessage only:

http://localhost:5173/action/auth?iframe=true

With redirect:

http://localhost:5173/action/auth?iframe=true&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback

Direct navigation (non-iframe, shows branded container):

http://localhost:5173/action/auth?redirect_uri=https%3A%2F%2Fexample.com%2Fcallback

Test scenarios

#
Scenario
How to trigger
Expected result

1

Successful auth — postMessage

Open minimal URL in an iframe, listen on message

Receive { event: "wallet_login", code, user, wallet }

2

Successful auth — redirect

Open URL with redirect_uri

Iframe navigates to redirect_uri?code=...&usr=...&wlt=...

3

Not logged in

Open URL without an active session

Iframe redirects to /auth/login

4

Email not verified

Open with logged-in but unverified user

Iframe redirects to /auth/email/verify

5

No wallet created

Open with verified user but no wallet

Iframe redirects to /auth/wallet/register

6

Token exchange

Use the code from test 1 on your backend

Backend confirms valid session

Test page


signature

Example URLs

Simple message:

With redirect:

Long message (UI truncates after 100 chars):

Missing message (no-op):


Test scenarios

#
Scenario
How to trigger
Expected result

1

Successful sign — postMessage

Open URL with message, listen on message

Receive { event: "message_signed", signature, message, user, wallet }

2

Successful sign — redirect

Add redirect_uri

Iframe navigates to redirect_uri?signature=...&usr=...&wlt=... after 3-second countdown

3

Missing message param

Open URL without message

Signing UI mounts but nothing happens. No event fired

4

Signature verification

Take signature and message from test 1

ethers.verifyMessage(message, signature) returns the correct wallet address

5

Message preview truncation

Use a message longer than 100 characters

UI shows first 100 chars followed by ...

Test page


logout

Example URLs

Minimal — postMessage only:

With redirect:

Hidden iframe (programmatic sign-out, no visible UI):


Test scenarios

#
Scenario
How to trigger
Expected result

1

Successful logout — postMessage

Open minimal URL in iframe, listen on message

Receive { event: "wallet_logout", type: "wallet_logout" }

2

Successful logout — redirect

Add redirect_uri

Iframe navigates to redirect_uri (no extra params appended)

3

Logout fires even on server error

Simulate auth server being slow

Event still fires (the view uses .finally())

4

Post-logout navigation

After event fires, open /wallet/dashboard in iframe

Redirected to /auth/login by LoggedMiddleware

5

No active session

Open with no logged-in user

Iframe redirects to /auth/login immediately (before logout logic runs)

Test page


ramp

Example URLs

Minimal (fiat onramp, all defaults):

EUR fiat purchase on Polygon (chain 137):

Crypto-only flow with external reference:

Pre-fill amount and currency with redirect:

With operator and payment method pre-selected:

With additional bundled transaction:

Build this URL programmatically (the JSON value must be URL-encoded):


Test scenarios

#
Scenario
How to trigger
Expected result

1

Default fiat flow

Open minimal URL

Ramp UI loads after network resolves

2

Network loading spinner

Open any URL before network state hydrates

Full-screen spinner until network is ready, then RampProvider mounts

3

Invalid additional_txns JSON

Pass additional_txns=not-valid-json

Parse error is swallowed, ramp continues with []

4

Non-numeric ntwk

Pass ntwk=abc

Number("abc")NaN → falls back to undefined, RampProvider uses its default

5

External reference passthrough

Pass ext_id=order_xyz

_externalId prop is set on RampProvider, confirmed in network logs

6

Crypto-only

Pass use_fiat=false

RampProvider mounts with useFiat=false

Test page


transaction

Example URLs

Single ERC-20 transfer (Polygon):

Two transactions batched:

With custom ABI:


Test scenarios

#
Scenario
How to trigger
Expected result

1

Valid transaction — user confirms

Build URL with valid params, click Confirm

Receive { type: "transactions_executing" } then { type: "transaction_complete" }

2

User cancels — iframe mode, no redirect

Open with iframe=true, no redirect_uri, click Not Now

Receive { type: "transaction_cancelled" }

3

User cancels — with redirect_uri

Open with redirect_uri, click Not Now

Iframe navigates to redirect_uri?status=cancelled

4

Success with auto_forward=true

Include redirect_uri and auto_forward=true

After completion, iframe auto-navigates to redirect_uri?status=success&txId=...&hashes=...

5

Invalid network

Pass network=9999999 (non-existent chain ID)

TransactionNetworkError screen shown

6

Missing method on a transaction

Omit method from one transaction object

TransactionParameterError screen shown

7

Missing address

Omit address from one transaction

TransactionParameterError screen shown

8

params is not an array

Pass params: "0xAddr" (string)

TransactionParameterError screen shown

9

wait_tx: false on any tx

Set wait_tx: false on one tx in a batch

Whole batch is submitted without waiting for confirmation

10

Network auto-switch

Open with a valid network that differs from the currently selected network

WalletTwo silently switches to the requested network before showing the confirmation screen

Test page


Error state reference

Error state
Action(s)
Cause

Iframe shows /auth/login

All

User is not logged in

Iframe shows /auth/email/verify

All

User email not verified

Iframe shows /auth/wallet/register

All

User has no wallet

TransactionNetworkError

transaction

network param does not match any known chain ID

TransactionParameterError

transaction

A transaction is missing method, address, or params is not an array

No message_signed event fired

signature

message param was not provided

additional_txns silently ignored

ramp

JSON in additional_txns was malformed


Quick URL builder (copy-paste into browser console)

Last updated