oneie 5.7.4 → 5.7.6

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 (60) hide show
  1. package/README.md +15 -0
  2. package/dist/package.json +5 -2
  3. package/dist/src/balances.d.ts +89 -0
  4. package/dist/src/balances.js +202 -0
  5. package/dist/src/hl-run.d.ts +119 -0
  6. package/dist/src/hl-run.js +480 -0
  7. package/dist/src/hl.d.ts +17 -0
  8. package/dist/src/hl.js +148 -0
  9. package/dist/src/index.js +4 -0
  10. package/dist/src/key-sweep.d.ts +19 -3
  11. package/dist/src/key-sweep.js +63 -20
  12. package/dist/src/lib/hl-core/actions.d.ts +99 -0
  13. package/dist/src/lib/hl-core/actions.js +69 -0
  14. package/dist/src/lib/hl-core/eip712.d.ts +33 -0
  15. package/dist/src/lib/hl-core/eip712.js +107 -0
  16. package/dist/src/lib/hl-core/errors.d.ts +10 -0
  17. package/dist/src/lib/hl-core/errors.js +15 -0
  18. package/dist/src/lib/hl-core/exchange.d.ts +24 -0
  19. package/dist/src/lib/hl-core/exchange.js +47 -0
  20. package/dist/src/lib/hl-core/index.d.ts +13 -0
  21. package/dist/src/lib/hl-core/index.js +14 -0
  22. package/dist/src/lib/hl-core/meta.d.ts +57 -0
  23. package/dist/src/lib/hl-core/meta.js +110 -0
  24. package/dist/src/lib/hl-core/msgpack.d.ts +18 -0
  25. package/dist/src/lib/hl-core/msgpack.js +136 -0
  26. package/dist/src/lib/hl-core/net.d.ts +2 -0
  27. package/dist/src/lib/hl-core/net.js +7 -0
  28. package/dist/src/lib/hl-core/signing.d.ts +103 -0
  29. package/dist/src/lib/hl-core/signing.js +295 -0
  30. package/dist/src/lib/hl-core/wire.d.ts +34 -0
  31. package/dist/src/lib/hl-core/wire.js +81 -0
  32. package/dist/src/lib/journey-words.d.ts +54 -3
  33. package/dist/src/lib/journey-words.js +159 -20
  34. package/dist/src/lib/journey.js +1 -1
  35. package/dist/src/lib/key-source.d.ts +9 -0
  36. package/dist/src/lib/key-source.js +33 -0
  37. package/dist/src/lib/network.d.ts +15 -0
  38. package/dist/src/lib/network.js +41 -0
  39. package/dist/src/lib/qr.d.ts +21 -0
  40. package/dist/src/lib/qr.js +402 -0
  41. package/dist/src/lib/sale-card.d.ts +117 -0
  42. package/dist/src/lib/sale-card.js +261 -0
  43. package/dist/src/lib/sui-grpc-send.d.ts +50 -0
  44. package/dist/src/lib/sui-grpc-send.js +89 -0
  45. package/dist/src/lib/swap-core.d.ts +163 -0
  46. package/dist/src/lib/swap-core.js +405 -0
  47. package/dist/src/lib/wallet-money.d.ts +222 -0
  48. package/dist/src/lib/wallet-money.js +578 -0
  49. package/dist/src/lib/wallet-request.d.ts +50 -0
  50. package/dist/src/lib/wallet-request.js +86 -0
  51. package/dist/src/onboard.js +4 -3
  52. package/dist/src/shop.js +38 -1
  53. package/dist/src/staff.js +10 -0
  54. package/dist/src/start.js +14 -6
  55. package/dist/src/swap.d.ts +93 -0
  56. package/dist/src/swap.js +622 -0
  57. package/dist/src/wallet-money.d.ts +152 -0
  58. package/dist/src/wallet-money.js +564 -0
  59. package/dist/src/wallet.js +169 -24
  60. package/package.json +5 -2
@@ -0,0 +1,152 @@
1
+ /**
2
+ * wallet-money.ts — the loaded wallet's money, one command away:
3
+ *
4
+ * one wallet balances [--net mainnet|testnet] every chain, wallet:get first, chains for the rest
5
+ * one wallet receive --chain base one address, one QR, never ambiguous
6
+ * one wallet send 1 USDC@base 0x… DRY: exactly what would be signed, fees, the chain
7
+ * one wallet send 0.0004 ETH@ethereum 0x… --live --dir ~/.one/tony
8
+ * one wallet request 25 USD a wallet:invoice payment link
9
+ * one wallet request 5 USDC --wait a link the owner opens and signs with Touch ID
10
+ *
11
+ * THE SERVER SIGNS NOTHING (R19). A --live send opens the sealed vault in --dir on THIS
12
+ * machine (Touch ID or a typed passphrase), signs here, broadcasts to a public node, and
13
+ * drops the key. Before the key opens: the gate (an agent shell signs only with its OWN
14
+ * vault and --yes), and the client check (R16) — the transaction is rebuilt from the
15
+ * person's own words and compared, never trusted from an echo.
16
+ *
17
+ * `balances` is the dev session's command (src/balances.ts, kept byte-identical so the two
18
+ * merge cleanly); `upgradeBalances` adds --net and the wallet:get fan-out to it in place.
19
+ */
20
+ import { Command } from 'commander';
21
+ import { type Fetch } from './balances.js';
22
+ import { type SuiSendReq, type SuiSendDone } from './lib/sui-grpc-send.js';
23
+ import { type Net, type Obj, type SendPlan, type SendAsset, type SendChain } from './lib/wallet-money.js';
24
+ type Ask = (receiver: string, data: Obj) => Promise<Obj>;
25
+ type VaultKey = {
26
+ chain: string;
27
+ address: string;
28
+ privateKeyHex: string;
29
+ };
30
+ export interface MoneyIO {
31
+ /** One receiver call for this command's --api/--key; throws on a refusal. */
32
+ ask: (opts: {
33
+ api: string;
34
+ key?: string;
35
+ }, receiver: string, data: Obj) => Promise<Obj>;
36
+ workspace: (explicit: string | undefined) => string;
37
+ /** Who this command's key acts as, and where it came from (`machine` = the global login, null when it is the same key). */
38
+ identity?: (opts: {
39
+ api: string;
40
+ key?: string;
41
+ }, which: 'resolved' | 'machine') => Promise<{
42
+ actor?: string;
43
+ from: string;
44
+ local: boolean;
45
+ } | null>;
46
+ unlock: (dir: string) => Promise<{
47
+ keys: VaultKey[];
48
+ } | {
49
+ error: string;
50
+ }>;
51
+ /** The pre-signed relay (`send <to> --payment-tx`) — the form `wallet send` had before. */
52
+ relay: (c: Command, to: string, opts: Obj) => Promise<void>;
53
+ defaultApi: string;
54
+ fetch?: Fetch;
55
+ sleep?: (ms: number) => Promise<void>;
56
+ }
57
+ /** fetch with a deadline: a node that hangs is a failed read, not a hung CLI. */
58
+ export declare const deadlineFetch: (ms?: number) => Fetch;
59
+ /** A word safe to paste into a shell: plain words as they are, anything else single-quoted. */
60
+ export declare const shq: (w: string) => string;
61
+ export interface GateArgs {
62
+ env: NodeJS.ProcessEnv;
63
+ yes: boolean;
64
+ interactive: boolean;
65
+ dir: string;
66
+ plan: SendPlan;
67
+ /** `--to-address`: the person's own copy of a resolved recipient. */
68
+ toAddress?: string;
69
+ /** `--workspace`: where the caller's wallet row lives (an agent's: its owner's workspace). */
70
+ workspace?: string;
71
+ }
72
+ export interface GateDeps {
73
+ ask: Ask;
74
+ /** The vault's Sui address from its public authPub — no unlock, no Touch ID. */
75
+ vaultSuiAddress: (dir: string) => string | null;
76
+ confirm: (prompt: string) => Promise<boolean>;
77
+ }
78
+ /**
79
+ * Before any key opens. `--yes` skips the prompt ONLY for a vault proven to be an agent's
80
+ * own (agentOwnVault) — never on an env marker alone, which a shell can simply not set, and
81
+ * never for a person's vault: the Keychain read behind "Touch ID" is `security -w`, which
82
+ * the OS may answer silently. A person's vault is opened only after a y/N typed at a terminal,
83
+ * every time. A shell an agent drives never opens anything but its own vault. A recipient
84
+ * found by name must be pinned with --to-address whenever nobody reads it at a prompt.
85
+ */
86
+ export declare function liveGate(a: GateArgs, d: GateDeps): Promise<{
87
+ ok: true;
88
+ } | {
89
+ ok: false;
90
+ error: string;
91
+ message: string;
92
+ }>;
93
+ export interface EvmSigner {
94
+ signEip1559: (tx: NonNullable<SendPlan['tx']>, key: Uint8Array) => string;
95
+ evmAddressFromKey: (key: Uint8Array) => string;
96
+ evmTxHash: (raw: string) => string;
97
+ hexToBytes: (h: string) => Uint8Array;
98
+ }
99
+ export type { SuiSendReq, SuiSendDone };
100
+ export interface LiveDeps {
101
+ fetch: Fetch;
102
+ unlock: () => Promise<{
103
+ keys: VaultKey[];
104
+ } | {
105
+ error: string;
106
+ }>;
107
+ loadEvm?: () => Promise<EvmSigner>;
108
+ /** A string is a digest alone (the older shape); SuiSendDone carries the gas and the time to finality too. */
109
+ suiSend?: (r: SuiSendReq) => Promise<SuiSendDone | string>;
110
+ sleep?: (ms: number) => Promise<void>;
111
+ /** Receipt polls after an EVM broadcast (each `sleep(5000)` apart). */
112
+ polls?: number;
113
+ }
114
+ export declare const suiSendDefault: (r: SuiSendReq) => Promise<SuiSendDone>;
115
+ /**
116
+ * Sign and broadcast ONE plan. The client check runs first, against the person's own
117
+ * words; then the vault opens; then its key must derive `from`. One broadcast, never
118
+ * re-sent: on a failure after signing the locally computed hash is returned so the
119
+ * person can look before trying again.
120
+ */
121
+ export declare function executeSend(plan: SendPlan, own: {
122
+ amount: string;
123
+ asset: SendAsset;
124
+ chain: SendChain;
125
+ to: string;
126
+ net: Net;
127
+ suiRpc?: string;
128
+ }, d: LiveDeps): Promise<Obj>;
129
+ export type Who = {
130
+ actor?: string;
131
+ from: string;
132
+ local: boolean;
133
+ };
134
+ export declare const actingLine: (w: Who | null | undefined) => string | undefined;
135
+ /**
136
+ * `no_from_address` from a folder-local key that is NOT the global login is the folder changing the
137
+ * answer: name both, and the way out. Any other refusal keeps its own words.
138
+ */
139
+ export declare function noFromCause(io: MoneyIO, o: {
140
+ api: string;
141
+ key?: string;
142
+ }, me: Who | null | undefined, family: string, workspace: string): Promise<string | undefined>;
143
+ /**
144
+ * Give the dev session's `balances` (src/balances.ts) the network word and the server
145
+ * fan-out. Its explicit-address form on mainnet is left to its own reader, unchanged.
146
+ */
147
+ export declare function upgradeBalances(balances: Command, io: MoneyIO): void;
148
+ export declare function receiveCmd(io: MoneyIO): Command;
149
+ export declare function requestCmd(io: MoneyIO): Command;
150
+ export declare function sendCmd(io: MoneyIO): Command;
151
+ /** The vault's Sui address from its PUBLIC authPub — read without opening it. */
152
+ export declare function vaultSuiAddressOf(dir: string): string | null;