@pod-network/trade-sdk 0.1.0-rc.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 (102) hide show
  1. package/README.md +113 -0
  2. package/dist/client.d.ts +93 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +168 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/codec/decode.d.ts +22 -0
  7. package/dist/codec/decode.d.ts.map +1 -0
  8. package/dist/codec/decode.js +251 -0
  9. package/dist/codec/decode.js.map +1 -0
  10. package/dist/codec/fixed.d.ts +11 -0
  11. package/dist/codec/fixed.d.ts.map +1 -0
  12. package/dist/codec/fixed.js +37 -0
  13. package/dist/codec/fixed.js.map +1 -0
  14. package/dist/codec/resolution.d.ts +14 -0
  15. package/dist/codec/resolution.d.ts.map +1 -0
  16. package/dist/codec/resolution.js +35 -0
  17. package/dist/codec/resolution.js.map +1 -0
  18. package/dist/codec/units.d.ts +35 -0
  19. package/dist/codec/units.d.ts.map +1 -0
  20. package/dist/codec/units.js +86 -0
  21. package/dist/codec/units.js.map +1 -0
  22. package/dist/datafeed.d.ts +4 -0
  23. package/dist/datafeed.d.ts.map +1 -0
  24. package/dist/datafeed.js +73 -0
  25. package/dist/datafeed.js.map +1 -0
  26. package/dist/index.d.ts +20 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +19 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/stores/resource.d.ts +50 -0
  31. package/dist/stores/resource.d.ts.map +1 -0
  32. package/dist/stores/resource.js +154 -0
  33. package/dist/stores/resource.js.map +1 -0
  34. package/dist/sync/account-metrics.d.ts +26 -0
  35. package/dist/sync/account-metrics.d.ts.map +1 -0
  36. package/dist/sync/account-metrics.js +41 -0
  37. package/dist/sync/account-metrics.js.map +1 -0
  38. package/dist/sync/candles.d.ts +68 -0
  39. package/dist/sync/candles.d.ts.map +1 -0
  40. package/dist/sync/candles.js +318 -0
  41. package/dist/sync/candles.js.map +1 -0
  42. package/dist/sync/order-preview.d.ts +74 -0
  43. package/dist/sync/order-preview.d.ts.map +1 -0
  44. package/dist/sync/order-preview.js +86 -0
  45. package/dist/sync/order-preview.js.map +1 -0
  46. package/dist/sync/orders.d.ts +49 -0
  47. package/dist/sync/orders.d.ts.map +1 -0
  48. package/dist/sync/orders.js +210 -0
  49. package/dist/sync/orders.js.map +1 -0
  50. package/dist/sync/positions-live.d.ts +3 -0
  51. package/dist/sync/positions-live.d.ts.map +1 -0
  52. package/dist/sync/positions-live.js +86 -0
  53. package/dist/sync/positions-live.js.map +1 -0
  54. package/dist/sync/sources.d.ts +40 -0
  55. package/dist/sync/sources.d.ts.map +1 -0
  56. package/dist/sync/sources.js +197 -0
  57. package/dist/sync/sources.js.map +1 -0
  58. package/dist/transport/rest.d.ts +83 -0
  59. package/dist/transport/rest.d.ts.map +1 -0
  60. package/dist/transport/rest.js +146 -0
  61. package/dist/transport/rest.js.map +1 -0
  62. package/dist/transport/ws.d.ts +60 -0
  63. package/dist/transport/ws.d.ts.map +1 -0
  64. package/dist/transport/ws.js +235 -0
  65. package/dist/transport/ws.js.map +1 -0
  66. package/dist/types/public.d.ts +292 -0
  67. package/dist/types/public.d.ts.map +1 -0
  68. package/dist/types/public.js +4 -0
  69. package/dist/types/public.js.map +1 -0
  70. package/dist/types/wire.d.ts +283 -0
  71. package/dist/types/wire.d.ts.map +1 -0
  72. package/dist/types/wire.js +6 -0
  73. package/dist/types/wire.js.map +1 -0
  74. package/dist/write/delegation.d.ts +54 -0
  75. package/dist/write/delegation.d.ts.map +1 -0
  76. package/dist/write/delegation.js +81 -0
  77. package/dist/write/delegation.js.map +1 -0
  78. package/dist/write/index.d.ts +261 -0
  79. package/dist/write/index.d.ts.map +1 -0
  80. package/dist/write/index.js +428 -0
  81. package/dist/write/index.js.map +1 -0
  82. package/package.json +43 -0
  83. package/src/client.ts +229 -0
  84. package/src/codec/decode.ts +277 -0
  85. package/src/codec/fixed.ts +41 -0
  86. package/src/codec/resolution.ts +39 -0
  87. package/src/codec/units.ts +100 -0
  88. package/src/datafeed.ts +94 -0
  89. package/src/index.ts +49 -0
  90. package/src/stores/resource.ts +172 -0
  91. package/src/sync/account-metrics.ts +71 -0
  92. package/src/sync/candles.ts +326 -0
  93. package/src/sync/order-preview.ts +152 -0
  94. package/src/sync/orders.ts +205 -0
  95. package/src/sync/positions-live.ts +102 -0
  96. package/src/sync/sources.ts +239 -0
  97. package/src/transport/rest.ts +213 -0
  98. package/src/transport/ws.ts +255 -0
  99. package/src/types/public.ts +335 -0
  100. package/src/types/wire.ts +301 -0
  101. package/src/write/delegation.ts +113 -0
  102. package/src/write/index.ts +642 -0
@@ -0,0 +1,283 @@
1
+ import type { Hex } from "./public.js";
2
+ export type WireDecimal = string;
3
+ export interface WireStatus {
4
+ solution_now: number;
5
+ }
6
+ export interface WireMarketStatic {
7
+ id: Hex;
8
+ name: string;
9
+ base_token_address: Hex;
10
+ quote_token_address: Hex;
11
+ base_token_symbol: string;
12
+ quote_token_symbol: string;
13
+ base_token_name: string;
14
+ quote_token_name: string;
15
+ market_type: "spot" | "perp";
16
+ auction_interval_us: number;
17
+ maker_fee: WireDecimal;
18
+ taker_fee: WireDecimal;
19
+ tick_precision: WireDecimal;
20
+ lot_size: WireDecimal;
21
+ max_leverage: number;
22
+ funding_window_us: number;
23
+ }
24
+ export interface WireMarketDynamics {
25
+ orderbook_id: Hex;
26
+ last_clearing_price: WireDecimal;
27
+ volume_24h: WireDecimal;
28
+ high_24h: WireDecimal;
29
+ low_24h: WireDecimal;
30
+ price_change_24h: number;
31
+ oracle_price?: WireDecimal | null;
32
+ mark_price?: WireDecimal | null;
33
+ funding_rate?: WireDecimal | null;
34
+ funding_index?: WireDecimal | null;
35
+ funding_last_updated_us?: number | null;
36
+ open_interest?: WireDecimal | null;
37
+ }
38
+ /** pod_markets push uses `orderbook` instead of `orderbook_id`. */
39
+ export interface WireMarketDynamicsPush extends Omit<WireMarketDynamics, "orderbook_id"> {
40
+ orderbook: Hex;
41
+ }
42
+ export interface WireMarketStatsPage {
43
+ solution_now: number;
44
+ markets: WireMarketDynamics[];
45
+ }
46
+ export interface WireCandle {
47
+ timestamp: number;
48
+ open: WireDecimal;
49
+ close: WireDecimal;
50
+ high: WireDecimal;
51
+ low: WireDecimal;
52
+ volume: WireDecimal;
53
+ quote_volume: WireDecimal;
54
+ }
55
+ /** GET /clob/candles envelope: candles + continuation metadata. */
56
+ export interface WireCandlesEnvelope {
57
+ candles: WireCandle[];
58
+ resolution: string;
59
+ range: {
60
+ from_us: number;
61
+ to_us: number;
62
+ } | null;
63
+ solution_now_us: number;
64
+ }
65
+ /** pod_candles per-tick hint. */
66
+ export interface WireCandleTick {
67
+ orderbook: Hex;
68
+ timestamp_us: number;
69
+ price: WireDecimal;
70
+ volume: WireDecimal;
71
+ }
72
+ export interface WirePartialFill {
73
+ base_amount: WireDecimal;
74
+ quote_amount: WireDecimal;
75
+ timestamp: number;
76
+ price: WireDecimal;
77
+ }
78
+ export interface WireOrder {
79
+ orderbook_id?: Hex;
80
+ market_type?: "spot" | "perp";
81
+ kind: string;
82
+ order_id: Hex;
83
+ tx_hash: Hex;
84
+ bidder: Hex;
85
+ nonce: number;
86
+ order_type: "limit" | "market";
87
+ status: string;
88
+ price: WireDecimal;
89
+ initial_size: WireDecimal;
90
+ filled_base_amount: WireDecimal;
91
+ filled_quote_amount: WireDecimal;
92
+ fee: WireDecimal;
93
+ deadline: number | string;
94
+ end: number | string;
95
+ included_batch?: number | string;
96
+ effective_price?: WireDecimal | null;
97
+ fills?: WirePartialFill[];
98
+ /** Present on WS stream orders (raw engine Order) instead of orderbook_id. */
99
+ pair?: {
100
+ base: Hex;
101
+ quote: Hex;
102
+ };
103
+ /** Present on REST orders; absent on the WS raw Order (derive from `initial_size`). */
104
+ side?: "buy" | "sell";
105
+ reduce_only?: boolean;
106
+ ioc?: boolean;
107
+ direction?: string;
108
+ grouping?: WireDecimal;
109
+ trigger_type?: string | null;
110
+ }
111
+ export interface WireOrdersPage {
112
+ orders: WireOrder[];
113
+ next_cursor: string | null;
114
+ total_count: number;
115
+ solution_now: number;
116
+ }
117
+ export interface WireTickSnapshot {
118
+ volume: WireDecimal;
119
+ minimum_expiry?: number;
120
+ }
121
+ export interface WireOrderbook {
122
+ orderbook_id?: Hex;
123
+ clob_id?: Hex;
124
+ buys: Record<string, WireTickSnapshot>;
125
+ sells: Record<string, WireTickSnapshot>;
126
+ buys_count: number;
127
+ sells_count: number;
128
+ grouping_precision: WireDecimal;
129
+ timestamp: number;
130
+ new_orders_count: number;
131
+ clearing_price?: WireDecimal | null;
132
+ oracle_price?: WireDecimal | null;
133
+ funding_rate?: WireDecimal | null;
134
+ funding_index?: WireDecimal | null;
135
+ funding_last_updated?: number | null;
136
+ }
137
+ export interface WireSpotPosition {
138
+ kind: "spot";
139
+ orderbook_id?: Hex;
140
+ token: Hex;
141
+ balance: WireDecimal;
142
+ free_balance: WireDecimal;
143
+ locked_balance: WireDecimal;
144
+ cost_basis: WireDecimal;
145
+ mark_price: WireDecimal;
146
+ unrealized_pnl: WireDecimal;
147
+ realized_pnl: WireDecimal;
148
+ }
149
+ export interface WirePerpPosition {
150
+ kind: "perp";
151
+ orderbook_id: Hex;
152
+ side: "long" | "short";
153
+ size: WireDecimal;
154
+ notional: WireDecimal;
155
+ entry_price: WireDecimal;
156
+ mark_price: WireDecimal;
157
+ margin: WireDecimal;
158
+ leverage: WireDecimal;
159
+ funding_accrued: WireDecimal;
160
+ entry_funding: WireDecimal;
161
+ liquidation_price: WireDecimal;
162
+ unrealized_pnl: WireDecimal;
163
+ realized_pnl: WireDecimal;
164
+ }
165
+ export type WirePosition = WireSpotPosition | WirePerpPosition;
166
+ export interface WirePositionsSnapshot {
167
+ positions: WirePosition[];
168
+ total_unrealized_pnl: WireDecimal;
169
+ total_realized_pnl: WireDecimal;
170
+ perps_equity: WireDecimal;
171
+ account_value: WireDecimal;
172
+ cash: WireDecimal;
173
+ withdrawable_cash: WireDecimal;
174
+ }
175
+ export interface WireSpotHolding {
176
+ orderbook_id: Hex;
177
+ base_symbol: string;
178
+ quote_symbol: string;
179
+ balance: WireDecimal;
180
+ free_balance: WireDecimal;
181
+ locked_balance: WireDecimal;
182
+ cost_basis: WireDecimal;
183
+ mark_price: WireDecimal;
184
+ unrealized_pnl: WireDecimal;
185
+ realized_pnl: WireDecimal;
186
+ }
187
+ export interface WireBalances {
188
+ balances: WireSpotHolding[];
189
+ cash: WireDecimal;
190
+ withdrawable_cash: WireDecimal;
191
+ net_deposits: WireDecimal;
192
+ }
193
+ /** `/clob/leaderboard` (and RPC ob_getRankedPositions) share this shape. Only
194
+ * the aggregate PnL fields of each account's positions block are read. */
195
+ export interface WireRankedAccount {
196
+ account: Hex;
197
+ positions: {
198
+ total_unrealized_pnl: WireDecimal;
199
+ total_realized_pnl: WireDecimal;
200
+ account_value: WireDecimal;
201
+ };
202
+ }
203
+ export interface WireLeaderboard {
204
+ ranked: WireRankedAccount[];
205
+ total: number;
206
+ }
207
+ export interface WireTrigger {
208
+ orderbook_id: Hex;
209
+ order_id: Hex;
210
+ tx_hash: Hex;
211
+ bidder: Hex;
212
+ nonce: number;
213
+ size: WireDecimal;
214
+ limit_price: WireDecimal;
215
+ trigger_price: WireDecimal;
216
+ trigger_type: string;
217
+ reduce_only: boolean;
218
+ ioc: boolean;
219
+ deadline: number | string;
220
+ end: number | string;
221
+ }
222
+ export interface WireTriggersPage {
223
+ triggers: WireTrigger[];
224
+ total_count: number;
225
+ next_cursor: string | null;
226
+ }
227
+ export interface WireBackstopTransfer {
228
+ orderbook_id?: Hex;
229
+ size: WireDecimal;
230
+ cash: WireDecimal;
231
+ mark_price: WireDecimal;
232
+ equity: WireDecimal;
233
+ timestamp_us: number;
234
+ }
235
+ export interface WireBackstopPage {
236
+ backstop_transfers: WireBackstopTransfer[];
237
+ total_count: number;
238
+ solution_now: number;
239
+ }
240
+ export type WireOrderUpdate = ({
241
+ type: "new";
242
+ } & WireOrder) | ({
243
+ type: "invalid";
244
+ } & WireOrder) | ({
245
+ type: "fill";
246
+ } & WireOrderFill) | {
247
+ type: "expired";
248
+ order_id: Hex;
249
+ } | {
250
+ type: "canceled";
251
+ order_id: Hex;
252
+ } | {
253
+ type: "modified";
254
+ order_id: Hex;
255
+ new_price: WireDecimal;
256
+ new_size: WireDecimal;
257
+ };
258
+ export interface WireOrderFill {
259
+ orderbook_id: Hex;
260
+ order_id: Hex;
261
+ tx_hash: Hex;
262
+ bidder: Hex;
263
+ status: string;
264
+ base_amount: WireDecimal;
265
+ quote_amount: WireDecimal;
266
+ filled_base_amount: WireDecimal;
267
+ filled_quote_amount: WireDecimal;
268
+ effective_price?: WireDecimal | null;
269
+ fee: WireDecimal;
270
+ position_before?: WireDecimal | null;
271
+ position_after?: WireDecimal | null;
272
+ }
273
+ export interface WirePositionsPush {
274
+ account: Hex;
275
+ data: WirePositionsSnapshot;
276
+ }
277
+ export interface WireTriggersPush {
278
+ account: Hex;
279
+ triggers: WireTrigger[];
280
+ total_count: number;
281
+ next_cursor: string | null;
282
+ }
283
+ //# sourceMappingURL=wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/types/wire.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,GAAG,CAAC;IACR,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,GAAG,CAAC;IACxB,mBAAmB,EAAE,GAAG,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,E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,kBAAkB,EAAE,WAAW,CAAC;IAChC,mBAAmB,EAAE,WAAW,CAAC;IACjC,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,GAAG,EAAE,WAAW,CAAC;IACjB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,cAAc,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,qBAAqB,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,6 @@
1
+ // Raw JSON shapes exactly as the indexer emits them (REST `/clob/*` and the
2
+ // `pod_*` WebSocket channels). snake_case; numerics are 1e18-scaled decimal
3
+ // strings; timestamps are microseconds (in `*_us` fields, or bare on candle/
4
+ // orderbook). Decoders in ../codec/decode.ts convert these to ../types/public.
5
+ export {};
6
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/types/wire.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E"}
@@ -0,0 +1,54 @@
1
+ import type { Address, Hash, Hex } from "../types/public.js";
2
+ import { type PodTxRequest } from "./index.js";
3
+ /** EIP-712 payload the master signs (domain "pod delegation" v1). */
4
+ export declare function delegationTypedData(delegate: Address, validUntil: bigint, chainId: number): {
5
+ readonly domain: {
6
+ readonly name: "pod delegation";
7
+ readonly version: "1";
8
+ readonly chainId: number;
9
+ };
10
+ readonly types: {
11
+ readonly DelegationAuth: readonly [{
12
+ readonly name: "delegate";
13
+ readonly type: "address";
14
+ }, {
15
+ readonly name: "validUntil";
16
+ readonly type: "uint64";
17
+ }];
18
+ };
19
+ readonly primaryType: "DelegationAuth";
20
+ readonly message: {
21
+ readonly delegate: `0x${string}`;
22
+ readonly validUntil: bigint;
23
+ };
24
+ };
25
+ export type DelegationTypedData = ReturnType<typeof delegationTypedData>;
26
+ /** A trading session: public cert facts + the one capability, submit(). */
27
+ export interface DelegatedWallet {
28
+ readonly master: Address;
29
+ readonly delegate: Address;
30
+ /** Cert expiry in MICROSECONDS — must cover every inner intent deadline. */
31
+ readonly validUntil: bigint;
32
+ /** Wrap `tx` in the delegated envelope, sign with the ephemeral key, and
33
+ * broadcast (raw send, CLOB revert reasons decoded). Returns the tx hash. */
34
+ submit(tx: PodTxRequest): Promise<Hash>;
35
+ }
36
+ export interface CreateDelegatedWalletParams {
37
+ master: Address;
38
+ chainId: number;
39
+ /** Node JSON-RPC HTTP endpoint (nonce, gas price, broadcast). */
40
+ rpcUrl: string;
41
+ /** The master wallet's typed-data prompt (the one signature of the flow). */
42
+ signTypedData: (td: DelegationTypedData) => Promise<Hex>;
43
+ /** Delegation lifetime in ms; must cover every intent deadline issued during it. */
44
+ ttlMs: number;
45
+ fetch?: typeof fetch;
46
+ }
47
+ /**
48
+ * Create a session: generate an ephemeral key, have the master sign the
49
+ * delegation via `signTypedData`, and verify the returned signature actually
50
+ * recovers to `master` before trusting it (catches a wrong active account in
51
+ * the wallet at login instead of a confusing node revert later).
52
+ */
53
+ export declare function createDelegatedWallet(p: CreateDelegatedWalletParams): Promise<DelegatedWallet>;
54
+ //# sourceMappingURL=delegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../src/write/delegation.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnE,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;EAUzF;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAMzE,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;iFAC6E;IAC7E,MAAM,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,aAAa,EAAE,CAAC,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,eAAe,CAAC,CAoCpG"}
@@ -0,0 +1,81 @@
1
+ // Ephemeral-key delegation, mirroring node/src/delegation/mod.rs (stateless):
2
+ // the master wallet signs one EIP-712 `DelegationAuth { delegate, validUntil }`
3
+ // authorizing a freshly generated ephemeral key; every CLOB tx is then wrapped
4
+ // in the gas-exempt `delegated(master, validUntil, signature, inner)` envelope
5
+ // and signed by that key. No on-chain registration — the cert rides in each tx.
6
+ //
7
+ // SECURITY INVARIANT: the ephemeral private key exists ONLY inside the closure
8
+ // created by createDelegatedWallet() — it is never exported, never persisted,
9
+ // never attached to any object that leaves this module. The only capability a
10
+ // DelegatedWallet exposes is submit(); "logging out" is dropping the object.
11
+ // Keep it that way.
12
+ import { createWalletClient, defineChain, encodeFunctionData, http, parseAbi, recoverTypedDataAddress } from "viem";
13
+ import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
14
+ import { sendRawTransaction } from "./index.js";
15
+ /** EIP-712 payload the master signs (domain "pod delegation" v1). */
16
+ export function delegationTypedData(delegate, validUntil, chainId) {
17
+ return {
18
+ domain: { name: "pod delegation", version: "1", chainId },
19
+ types: { DelegationAuth: [
20
+ { name: "delegate", type: "address" },
21
+ { name: "validUntil", type: "uint64" },
22
+ ] },
23
+ primaryType: "DelegationAuth",
24
+ message: { delegate, validUntil },
25
+ };
26
+ }
27
+ const DELEGATED_ABI = parseAbi([
28
+ "function delegated(address master, uint64 validUntil, bytes signature, bytes inner)",
29
+ ]);
30
+ /**
31
+ * Create a session: generate an ephemeral key, have the master sign the
32
+ * delegation via `signTypedData`, and verify the returned signature actually
33
+ * recovers to `master` before trusting it (catches a wrong active account in
34
+ * the wallet at login instead of a confusing node revert later).
35
+ */
36
+ export async function createDelegatedWallet(p) {
37
+ const account = privateKeyToAccount(generatePrivateKey());
38
+ const validUntil = (BigInt(Date.now()) + BigInt(p.ttlMs)) * 1000n; // µs
39
+ const typedData = delegationTypedData(account.address, validUntil, p.chainId);
40
+ const signature = await p.signTypedData(typedData);
41
+ const recovered = await recoverTypedDataAddress({ ...typedData, signature });
42
+ if (recovered.toLowerCase() !== p.master.toLowerCase()) {
43
+ throw new Error(`delegation signed by ${recovered}, not ${p.master} — is the right account active?`);
44
+ }
45
+ const chain = defineChain({
46
+ id: p.chainId, name: `pod-${p.chainId}`,
47
+ nativeCurrency: { name: "pETH", symbol: "pETH", decimals: 18 },
48
+ rpcUrls: { default: { http: [p.rpcUrl] } },
49
+ });
50
+ const client = createWalletClient({ account, chain, transport: http(p.rpcUrl) });
51
+ const doFetch = p.fetch ?? fetch;
52
+ const submit = async (tx) => {
53
+ // Refuse to sign with a cert that can't cover a fresh intent deadline
54
+ // (~15 min out) — the node would reject the tx as expired anyway.
55
+ if (validUntil <= (BigInt(Date.now()) + 20n * 60000n) * 1000n) {
56
+ throw new Error("delegation expired — re-authorize the wallet");
57
+ }
58
+ const data = encodeFunctionData({
59
+ abi: DELEGATED_ABI,
60
+ functionName: "delegated",
61
+ args: [p.master, validUntil, signature, tx.data],
62
+ });
63
+ const maxFeePerGas = BigInt(await rpc(p.rpcUrl, doFetch, "eth_gasPrice"));
64
+ const prepared = await client.prepareTransactionRequest({ ...tx, data, account, chain, maxFeePerGas });
65
+ const serialized = await client.signTransaction(prepared);
66
+ return sendRawTransaction(p.rpcUrl, serialized, { fetch: doFetch });
67
+ };
68
+ return Object.freeze({ master: p.master, delegate: account.address, validUntil, submit });
69
+ }
70
+ async function rpc(rpcUrl, doFetch, method) {
71
+ const res = await doFetch(rpcUrl, {
72
+ method: "POST",
73
+ headers: { "content-type": "application/json" },
74
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params: [] }),
75
+ });
76
+ const json = (await res.json());
77
+ if (json.error || json.result === undefined)
78
+ throw new Error(json.error?.message ?? `${method} failed`);
79
+ return json.result;
80
+ }
81
+ //# sourceMappingURL=delegation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../src/write/delegation.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,oBAAoB;AAEpB,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAC;AACpH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAq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