ci / gate (push) Waiting to run
wallet_core::orders is the pure part: Quoted → AwaitingDeposit → Processing → Success | Refunded | Failed, with Expired when a quote's deadline passes before a deposit is seen; it never moves backwards, a quote past its deadline expires without a network call, and the poll delay doubles from ten seconds to five minutes (five seconds while processing). Orders persist through an OrderStore port on the same SQLite file; on start the app follows every order still open, and the follower asks the provider with backoff and jitter, persists each move and emits orders:updated. Commands: swap_assets (what 1Click lists and the registry maps), swap_preview (a dry quote), swap_order_create (a wet quote persisted with its deposit address and deadline) and orders_list. The swap screen sits behind a preview setting, says plainly that every pair today is paid from an external wallet, quotes, shows the deposit address with a QR, memo and deadline, and lists orders with their states. Driven live on the dev network: BTC on bitcoin to USDC on near, 0.001 BTC quoted at 75.568313 USDC, at least 74.812629, about 805 s. Reserving a deposit address failed with 1Click's "Failed to get quote": a wet quote needs the partner credential the relay will hold (#40), which is the operator's registration. Until then the screen previews and the poller has nothing to follow; the state machine and the store are covered by unit tests, including the mid-order restart the store makes possible. Refs #39 Refs #41 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ftBXYuba8ARhQeF74oUgW
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
import type { Amount } from "./Amount";
|
|
import type { AssetId } from "./AssetId";
|
|
import type { OrderState } from "./OrderState";
|
|
|
|
/**
|
|
* A swap order as the wallet keeps it: the quote it was made from, where
|
|
* to pay, and where it stands. Persisted so it survives a restart.
|
|
*/
|
|
export type Order = {
|
|
/**
|
|
* The provider's identifier: for 1Click, the deposit address.
|
|
*/
|
|
id: string, provider: string, from: AssetId, to: AssetId, amount_in: Amount, amount_out: Amount,
|
|
/**
|
|
* Where the origin asset must be paid, and any memo it needs.
|
|
*/
|
|
deposit_address: string, deposit_memo: string | null, recipient: string, refund_to: string,
|
|
/**
|
|
* Unix seconds; after this the provider refunds and the wallet stops asking.
|
|
*/
|
|
deadline_unix: number, created_unix: number, updated_unix: number, state: OrderState,
|
|
/**
|
|
* The deposit transaction this wallet made itself, when it did (a
|
|
* Quantus leg, later); `None` when an external wallet paid.
|
|
*/
|
|
deposit_tx: string | null, };
|