@qntx/wallet-engine 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +1057 -20
  2. package/dist/apps-fiat24.d.mts +202 -0
  3. package/dist/apps-fiat24.mjs +1378 -0
  4. package/dist/apps-fiat24.mjs.map +1 -0
  5. package/dist/apps-hyperliquid.d.mts +549 -0
  6. package/dist/apps-hyperliquid.mjs +2742 -0
  7. package/dist/apps-hyperliquid.mjs.map +1 -0
  8. package/dist/apps-polymarket.d.mts +729 -0
  9. package/dist/apps-polymarket.mjs +3786 -0
  10. package/dist/apps-polymarket.mjs.map +1 -0
  11. package/dist/apps.d.mts +136 -0
  12. package/dist/apps.mjs +535 -0
  13. package/dist/apps.mjs.map +1 -0
  14. package/dist/connect-BY1C5ZRI.mjs +210 -0
  15. package/dist/connect-BY1C5ZRI.mjs.map +1 -0
  16. package/dist/connect.d.mts +17 -9
  17. package/dist/connect.mjs +3 -185
  18. package/dist/controller-DpNVHVsj.d.mts +2295 -0
  19. package/dist/controller-rMnaxKAH.mjs +46 -0
  20. package/dist/controller-rMnaxKAH.mjs.map +1 -0
  21. package/dist/decimal-COJ4g8qy.mjs +38 -0
  22. package/dist/decimal-COJ4g8qy.mjs.map +1 -0
  23. package/dist/eligibility-BfM9ybYZ.mjs +48 -0
  24. package/dist/eligibility-BfM9ybYZ.mjs.map +1 -0
  25. package/dist/engine-Dic_kkEr.d.mts +1829 -0
  26. package/dist/errors-B8W-hoYW.d.mts +7 -0
  27. package/dist/errors-horUy5k1.mjs +24 -0
  28. package/dist/errors-horUy5k1.mjs.map +1 -0
  29. package/dist/gateway-contract.d.mts +3 -362
  30. package/dist/gateway-contract.mjs +1531 -81
  31. package/dist/gateway-contract.mjs.map +1 -1
  32. package/dist/idb.d.mts +5 -0
  33. package/dist/idb.mjs +122 -46
  34. package/dist/idb.mjs.map +1 -1
  35. package/dist/index-vBgfOFIh.d.mts +2227 -0
  36. package/dist/index.d.mts +58 -515
  37. package/dist/index.mjs +22314 -4901
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/json-BDwV38cj.mjs +15 -0
  40. package/dist/json-BDwV38cj.mjs.map +1 -0
  41. package/dist/link-Ceq8Dggp.mjs +139 -0
  42. package/dist/link-Ceq8Dggp.mjs.map +1 -0
  43. package/dist/primitives-DbSHLZKq.mjs +31 -0
  44. package/dist/primitives-DbSHLZKq.mjs.map +1 -0
  45. package/dist/push-message-AQuzoNFY.d.mts +84 -0
  46. package/dist/push-message-kbnH1A5w.mjs +142 -0
  47. package/dist/push-message-kbnH1A5w.mjs.map +1 -0
  48. package/dist/push.d.mts +13 -0
  49. package/dist/push.mjs +70 -0
  50. package/dist/push.mjs.map +1 -0
  51. package/dist/qr.d.mts +292 -0
  52. package/dist/qr.mjs +1725 -0
  53. package/dist/qr.mjs.map +1 -0
  54. package/dist/registry-CbtwcxkX.mjs +374 -0
  55. package/dist/registry-CbtwcxkX.mjs.map +1 -0
  56. package/dist/risk-DyABgg4W.mjs +757 -0
  57. package/dist/risk-DyABgg4W.mjs.map +1 -0
  58. package/dist/session-CNJFLarP.mjs +18 -0
  59. package/dist/session-CNJFLarP.mjs.map +1 -0
  60. package/dist/socket-ChG9JRT_.mjs +110 -0
  61. package/dist/socket-ChG9JRT_.mjs.map +1 -0
  62. package/dist/spi-BrTw5s98.d.mts +3 -0
  63. package/dist/timer-Cdk5rGM2.mjs +43 -0
  64. package/dist/timer-Cdk5rGM2.mjs.map +1 -0
  65. package/dist/types-BpvioFGo.d.mts +258 -0
  66. package/dist/types-DbftVZ3I.mjs +90 -0
  67. package/dist/types-DbftVZ3I.mjs.map +1 -0
  68. package/dist/walletconnect.d.mts +86 -0
  69. package/dist/walletconnect.mjs +1507 -0
  70. package/dist/walletconnect.mjs.map +1 -0
  71. package/dist/webln-BgrtPXpG.mjs +2593 -0
  72. package/dist/webln-BgrtPXpG.mjs.map +1 -0
  73. package/dist/webln-Bllk_xJ2.d.mts +666 -0
  74. package/package.json +94 -19
  75. package/dist/connect.mjs.map +0 -1
  76. package/dist/errors-DpkJneDe.d.mts +0 -1696
  77. package/dist/registry-Deo5WQe1.d.mts +0 -25
  78. package/dist/registry-wYrcuFNc.mjs +0 -99
  79. package/dist/registry-wYrcuFNc.mjs.map +0 -1
  80. package/dist/webln-DzsI7jVb.mjs +0 -3629
  81. package/dist/webln-DzsI7jVb.mjs.map +0 -1
@@ -0,0 +1,202 @@
1
+ import { c as AppGroup, i as AppDefinition } from "./types-BpvioFGo.mjs";
2
+ import "./spi-BrTw5s98.mjs";
3
+ import "viem";
4
+ import { Wallet } from "@qntx/wallet";
5
+ import { ChainsApi } from "@qntx/wallet/chains";
6
+ import { Bank, Bank as Bank$1, Banks, Banks as Banks$1, Card, Card as Card$1, Countries, Countries as Countries$1, CountryCities, CountryCities as CountryCities$1, KycStatus, PaymentPurpose, PaymentPurpose as PaymentPurpose$1, Profile, Profile as Profile$1, Rate, Rate as Rate$1, RatePair, RatePair as RatePair$1, TransactionPage, TransactionPage as TransactionPage$1, TransactionQuery, TransactionQuery as TransactionQuery$1 } from "@qntx/fiat24/api";
7
+ import { AccountView, AccountView as AccountView$1, CardCurrency, CardOperation, CardOperation as CardOperation$1, CardState, ExchangeState, FlowState, FlowState as FlowState$1, OnboardingState, PayoutDraft, PayoutDraft as PayoutDraft$1, PayoutState, PayoutTarget, PayoutTarget as PayoutTarget$1, TopUpState, TransferState, TxMismatch, TxPhase, TxRecord } from "@qntx/fiat24/flows";
8
+ import { AccountStatus, AccountStatus as AccountStatus$1, Currency, Currency as Currency$1, Fiat24ErrorCode, Fiat24ErrorCode as Fiat24ErrorCode$1, PayoutCurrency, PayoutCurrency as PayoutCurrency$1, Recipient, Recipient as Recipient$1 } from "@qntx/fiat24/core";
9
+ import { PayoutSettlement, PayoutSettlement as PayoutSettlement$1 } from "@qntx/fiat24/chain";
10
+ /** What a group's account read settles to — the SDK `AccountView` carried verbatim. */
11
+ type Fiat24AccountState = {
12
+ readonly status: "no-account";
13
+ readonly owner: `0x${string}`;
14
+ } | {
15
+ readonly status: AccountStatus$1 | "stale";
16
+ readonly owner: `0x${string}`;
17
+ readonly view: Exclude<AccountView$1, {
18
+ readonly step: "no-account";
19
+ }>;
20
+ } | {
21
+ /** The pinned deployment drifted — every write must fail closed until it settles. */
22
+ readonly status: "contract-changed";
23
+ readonly owner: `0x${string}`;
24
+ };
25
+ /**
26
+ * Why a signer call refused without producing a request or a signature — the app's flow surface
27
+ * reports it to the caller; it never carries request payloads.
28
+ */
29
+ type Fiat24Refusal =
30
+ /** The user rejected the request. */
31
+ "rejected" |
32
+ /** The request's TTL elapsed before approval. */
33
+ "expired" |
34
+ /** The vault locked or the account group changed while the request was open. */
35
+ "invalidated" |
36
+ /** The request failed before the `signed` stage — nothing was broadcast. */
37
+ "failed-before-signing" |
38
+ /** The sender's next free nonce differs from the nonce the SDK chose. */
39
+ "nonce-conflict" |
40
+ /** `prepare` threw for another reason — nothing was shown. */
41
+ "prepare-failed" |
42
+ /** The call itself fails validation — no request was opened. */
43
+ "invalid-call";
44
+ /** The read-only slice of `Fiat24Session` the app surfaces — writes stay inside flows. */
45
+ type Fiat24SecuredReads = {
46
+ readonly profile: () => Promise<Profile$1>;
47
+ readonly cards: () => Promise<ReadonlyArray<Card$1>>;
48
+ /** The 5-minute Marqeta display token for the host's card widget. */
49
+ readonly cardDisplayToken: (externalId: string) => Promise<string>;
50
+ readonly transactions: (query: TransactionQuery$1) => Promise<TransactionPage$1>;
51
+ /** Ends the grant — the next secured call of this group opens a fresh session. */
52
+ readonly end: () => void;
53
+ };
54
+ type Fiat24FlowEntry = {
55
+ readonly id: string;
56
+ readonly state: FlowState$1 | PayoutDraft$1;
57
+ /** What the signer reported during this `advance` — memory only, never persisted. */
58
+ readonly refusal?: Fiat24Refusal;
59
+ };
60
+ /**
61
+ * A `list` entry: a decodable flow state, or `{ invalid: true }` for a persisted record that no
62
+ * longer decodes — it can never be reconciled, `start` stays `flow-unresolved` while one exists (it
63
+ * cannot be proven not to be `sending`), `discard` removes it, and `advance`/`reconcile` on it is a
64
+ * `protocol` `invalid-state`.
65
+ */
66
+ type Fiat24Flow = Fiat24FlowEntry | {
67
+ readonly id: string;
68
+ readonly invalid: true;
69
+ };
70
+ type Fiat24FlowInput = {
71
+ readonly flow: "transfer";
72
+ readonly currency: Currency$1;
73
+ readonly amount: bigint;
74
+ readonly to: Recipient$1;
75
+ } | {
76
+ readonly flow: "exchange";
77
+ readonly side: "exact-in" | "exact-out";
78
+ readonly from: Currency$1;
79
+ readonly to: Currency$1;
80
+ readonly amount: bigint;
81
+ } | {
82
+ readonly flow: "payout";
83
+ readonly currency: PayoutCurrency$1;
84
+ readonly amount: bigint;
85
+ readonly target: PayoutTarget$1;
86
+ } | {
87
+ readonly flow: "top-up";
88
+ readonly output: Currency$1;
89
+ readonly usdcAmount: bigint;
90
+ } | {
91
+ readonly flow: "onboarding";
92
+ readonly tokenId: bigint;
93
+ readonly payment: "f24" | "eth";
94
+ } | {
95
+ readonly flow: "card-setup";
96
+ readonly cap: {
97
+ readonly currency: Currency$1;
98
+ readonly amount: bigint;
99
+ };
100
+ } | {
101
+ readonly flow: "card";
102
+ readonly operation: CardOperation$1;
103
+ };
104
+ type Fiat24Flows = {
105
+ /** The group's persisted flows plus its in-memory payout drafts. */
106
+ readonly list: (group: AppGroup) => Promise<ReadonlyArray<Fiat24Flow>>;
107
+ readonly start: (group: AppGroup, input: Fiat24FlowInput) => Promise<Fiat24FlowEntry>;
108
+ /** One advance at a time per group — concurrent calls queue behind the running one. */
109
+ readonly advance: (group: AppGroup, id: string) => Promise<Fiat24FlowEntry>;
110
+ readonly discard: (group: AppGroup, id: string) => Promise<void>;
111
+ readonly payoutSettlement: (group: AppGroup, id: string) => Promise<PayoutSettlement$1 & {
112
+ readonly txid: string;
113
+ }>;
114
+ };
115
+ /** Fiat24 provider error categories — never carry request payloads or secrets. */
116
+ type Fiat24AppErrorCategory =
117
+ /** The vault is locked — the group address cannot be resolved; nothing was read. */
118
+ "unlock-required" |
119
+ /** The group's app status is not `enabled`. */
120
+ "not-enabled" |
121
+ /** The call needs the group's owned live Fiat24 account and it has none. */
122
+ "no-account" |
123
+ /** No `api.fiat24.com` fetch was injected — API-backed features are off. */
124
+ "api-unavailable" |
125
+ /** An enablement flow is already running for the group — wait or cancel it. */
126
+ "busy" |
127
+ /** The jurisdiction allows only winding positions down — no new exposure. */
128
+ "close-only" |
129
+ /** A flow's transaction is still `sending`/`submitted`/`unknown` — no start or discard. */
130
+ "flow-unresolved" |
131
+ /** The flow id is neither persisted nor an in-memory draft. */
132
+ "unknown-flow" |
133
+ /** The read could not be completed (endpoint down, malformed answer) — a retry may succeed. */
134
+ "unavailable" |
135
+ /** A caller input fails validation before any request. */
136
+ "invalid-input" |
137
+ /**
138
+ * The SDK reported the failure — `code` carries its closed `Fiat24ErrorCode` (`rpc-error`,
139
+ * `invalid-rpc-response`, `contract-revert`, …); `contract-changed` is a state, not an error.
140
+ */
141
+ "protocol";
142
+ export declare class Fiat24AppError extends Error {
143
+ readonly category: Fiat24AppErrorCategory;
144
+ /** The SDK's closed error code — set on `protocol` only. */
145
+ readonly code?: Fiat24ErrorCode$1;
146
+ constructor(category: Fiat24AppErrorCategory, message: string, options?: {
147
+ readonly code?: Fiat24ErrorCode$1;
148
+ });
149
+ }
150
+ /** The pacing the SDK README gives for advancing an in-flight flow — reused for account polls. */
151
+ export declare const FIAT24_POLL_MS = 15000;
152
+ /** What a live view reports — `data` is kept while `stale`, never past a lock or a close. */
153
+ type Fiat24LiveState = {
154
+ readonly status: "loading" | "live" | "stale";
155
+ readonly data: Fiat24AccountState | undefined;
156
+ readonly updatedAt: number | undefined;
157
+ /** The last read failure, mapped — `protocol` carries the SDK's closed `code`. */
158
+ readonly error?: {
159
+ readonly category: Fiat24AppErrorCategory;
160
+ readonly code?: Fiat24ErrorCode$1 | undefined;
161
+ } | undefined;
162
+ };
163
+ type Fiat24LiveView = {
164
+ readonly getState: () => Fiat24LiveState;
165
+ /** Listener on every state change; returns an unsubscribe. */
166
+ readonly subscribe: (listener: (state: Fiat24LiveState) => void) => () => void;
167
+ /** Stops this view's polling — account data does not outlive the view. */
168
+ readonly close: () => Promise<void>;
169
+ };
170
+ /** The host's config — `fetch` is for api.fiat24.com only; nothing else may use it. */
171
+ type Fiat24Config = {
172
+ readonly fetch?: typeof globalThis.fetch;
173
+ };
174
+ /** The unauthenticated Fiat24 REST reads — every one needs the injected fetch. */
175
+ type Fiat24PublicReads = {
176
+ readonly rates: () => Promise<Readonly<Partial<Record<RatePair$1, Rate$1>>>>;
177
+ readonly paymentPurposes: () => Promise<ReadonlyArray<PaymentPurpose$1>>;
178
+ readonly countries: () => Promise<Countries$1>;
179
+ readonly countryCities: () => Promise<CountryCities$1>;
180
+ readonly banks: () => Promise<Banks$1>;
181
+ readonly bankByIban: (iban: string) => Promise<Bank$1>;
182
+ /** The host's Sumsub KYC link — a pure URL build, no fetch needed. */
183
+ readonly kycUrl: (walletProviderId?: bigint) => string;
184
+ };
185
+ /** The Fiat24 surface `createApps` returns under `fiat24`. */
186
+ type Fiat24App = {
187
+ /** The group's Fiat24 account — the SDK view over the pinned, corroborated deployment. */
188
+ readonly account: (group: AppGroup) => Promise<Fiat24AccountState>;
189
+ /** A 15 s account view — polls only while `setVisible(true)` and the vault is unlocked. */
190
+ readonly live: (group: AppGroup) => Fiat24LiveView;
191
+ /** The host's visibility signal — account and reconcile polling run only while visible. */
192
+ readonly setVisible: (visible: boolean) => void;
193
+ /** The resumable flows — state persisted per group, one advance at a time. */
194
+ readonly flows: Fiat24Flows;
195
+ /** The group's secured REST reads — the session grant is minted on first call. */
196
+ readonly session: (group: AppGroup) => Fiat24SecuredReads;
197
+ /** The unauthenticated REST reads. */
198
+ readonly api: Fiat24PublicReads;
199
+ };
200
+ export declare function fiat24(config?: Fiat24Config): AppDefinition<"fiat24", Fiat24App>;
201
+ export type { AccountStatus, AccountView, Bank, Banks, Card, CardCurrency, CardOperation, CardState, Countries, CountryCities, Currency, ExchangeState, Fiat24AccountState, Fiat24App, Fiat24AppErrorCategory, Fiat24Config, Fiat24ErrorCode, Fiat24Flow, Fiat24FlowEntry, Fiat24FlowInput, Fiat24Flows, Fiat24LiveState, Fiat24LiveView, Fiat24PublicReads, Fiat24Refusal, Fiat24SecuredReads, FlowState, KycStatus, OnboardingState, PaymentPurpose, PayoutCurrency, PayoutDraft, PayoutSettlement, PayoutState, PayoutTarget, Profile, Rate, RatePair, Recipient, TopUpState, TransactionPage, TransactionQuery, TransferState, TxMismatch, TxPhase, TxRecord };
202
+ //# sourceMappingURL=apps-fiat24.d.mts.map