@shroud-fi/payments 0.1.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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -0
  3. package/dist/cjs/amount-privacy.d.ts +30 -0
  4. package/dist/cjs/amount-privacy.d.ts.map +1 -0
  5. package/dist/cjs/amount-privacy.js +30 -0
  6. package/dist/cjs/amount-privacy.js.map +1 -0
  7. package/dist/cjs/constants.d.ts +7 -0
  8. package/dist/cjs/constants.d.ts.map +1 -0
  9. package/dist/cjs/constants.js +10 -0
  10. package/dist/cjs/constants.js.map +1 -0
  11. package/dist/cjs/errors.d.ts +57 -0
  12. package/dist/cjs/errors.d.ts.map +1 -0
  13. package/dist/cjs/errors.js +91 -0
  14. package/dist/cjs/errors.js.map +1 -0
  15. package/dist/cjs/index.d.ts +10 -0
  16. package/dist/cjs/index.d.ts.map +1 -0
  17. package/dist/cjs/index.js +42 -0
  18. package/dist/cjs/index.js.map +1 -0
  19. package/dist/cjs/package.json +1 -0
  20. package/dist/cjs/payments.d.ts +49 -0
  21. package/dist/cjs/payments.d.ts.map +1 -0
  22. package/dist/cjs/payments.js +266 -0
  23. package/dist/cjs/payments.js.map +1 -0
  24. package/dist/cjs/send-to-wallet.d.ts +57 -0
  25. package/dist/cjs/send-to-wallet.d.ts.map +1 -0
  26. package/dist/cjs/send-to-wallet.js +104 -0
  27. package/dist/cjs/send-to-wallet.js.map +1 -0
  28. package/dist/cjs/sweep.d.ts +47 -0
  29. package/dist/cjs/sweep.d.ts.map +1 -0
  30. package/dist/cjs/sweep.js +241 -0
  31. package/dist/cjs/sweep.js.map +1 -0
  32. package/dist/cjs/types.d.ts +27 -0
  33. package/dist/cjs/types.d.ts.map +1 -0
  34. package/dist/cjs/types.js +3 -0
  35. package/dist/cjs/types.js.map +1 -0
  36. package/dist/esm/amount-privacy.d.ts +30 -0
  37. package/dist/esm/amount-privacy.d.ts.map +1 -0
  38. package/dist/esm/amount-privacy.js +25 -0
  39. package/dist/esm/amount-privacy.js.map +1 -0
  40. package/dist/esm/constants.d.ts +7 -0
  41. package/dist/esm/constants.d.ts.map +1 -0
  42. package/dist/esm/constants.js +7 -0
  43. package/dist/esm/constants.js.map +1 -0
  44. package/dist/esm/errors.d.ts +57 -0
  45. package/dist/esm/errors.d.ts.map +1 -0
  46. package/dist/esm/errors.js +78 -0
  47. package/dist/esm/errors.js.map +1 -0
  48. package/dist/esm/index.d.ts +10 -0
  49. package/dist/esm/index.d.ts.map +1 -0
  50. package/dist/esm/index.js +14 -0
  51. package/dist/esm/index.js.map +1 -0
  52. package/dist/esm/payments.d.ts +49 -0
  53. package/dist/esm/payments.d.ts.map +1 -0
  54. package/dist/esm/payments.js +261 -0
  55. package/dist/esm/payments.js.map +1 -0
  56. package/dist/esm/send-to-wallet.d.ts +57 -0
  57. package/dist/esm/send-to-wallet.d.ts.map +1 -0
  58. package/dist/esm/send-to-wallet.js +100 -0
  59. package/dist/esm/send-to-wallet.js.map +1 -0
  60. package/dist/esm/sweep.d.ts +47 -0
  61. package/dist/esm/sweep.d.ts.map +1 -0
  62. package/dist/esm/sweep.js +237 -0
  63. package/dist/esm/sweep.js.map +1 -0
  64. package/dist/esm/types.d.ts +27 -0
  65. package/dist/esm/types.d.ts.map +1 -0
  66. package/dist/esm/types.js +2 -0
  67. package/dist/esm/types.js.map +1 -0
  68. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  69. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  70. package/dist/tsconfig.tsbuildinfo +1 -0
  71. package/package.json +64 -0
@@ -0,0 +1,237 @@
1
+ import { encodeFunctionData } from 'viem';
2
+ import { privateKeyToAccount } from 'viem/accounts';
3
+ import { ERC20Abi } from '@shroud-fi/transport';
4
+ import { SweepError, InsufficientBalanceError } from './errors.js';
5
+ import { DEFAULT_GAS_MULTIPLIER, ETH_SENTINEL, ZERO_ADDRESS, ETH_TRANSFER_GAS_ESTIMATE, ERC20_TRANSFER_GAS_ESTIMATE, } from './constants.js';
6
+ /**
7
+ * Fetch EIP-1559 fee suggestions with a safe fallback. viem's
8
+ * `estimateFeesPerGas` returns the recommended {maxFeePerGas, maxPriorityFeePerGas}
9
+ * given the current base fee; on chains where the method 404s we fall back to
10
+ * the legacy `getGasPrice` + a small priority tip so the tx remains valid.
11
+ *
12
+ * Crucially we DON'T set maxPriorityFeePerGas == maxFeePerGas — Geth-derived
13
+ * RPCs reject EIP-1559 transactions where the priority cap equals the total
14
+ * cap and the base fee is non-zero (effective tip becomes 0, but the producer
15
+ * still gates on `priority < maxFee - baseFee`). Splitting them keeps Base
16
+ * Sepolia + mainnet RPCs from returning TransactionRejectedRpcError (-32003).
17
+ */
18
+ async function suggestEip1559Fees(transport, options) {
19
+ if (options?.maxFeePerGas !== undefined &&
20
+ options.maxPriorityFeePerGas !== undefined) {
21
+ return {
22
+ maxFeePerGas: options.maxFeePerGas,
23
+ maxPriorityFeePerGas: options.maxPriorityFeePerGas,
24
+ };
25
+ }
26
+ try {
27
+ const fees = await transport.publicClient.estimateFeesPerGas();
28
+ return {
29
+ maxFeePerGas: options?.maxFeePerGas ?? fees.maxFeePerGas,
30
+ maxPriorityFeePerGas: options?.maxPriorityFeePerGas ?? fees.maxPriorityFeePerGas,
31
+ };
32
+ }
33
+ catch {
34
+ const legacy = await transport.publicClient.getGasPrice();
35
+ const priority = options?.maxPriorityFeePerGas ?? legacy / 10n;
36
+ const fee = options?.maxFeePerGas ?? legacy * 2n;
37
+ return { maxFeePerGas: fee, maxPriorityFeePerGas: priority };
38
+ }
39
+ }
40
+ /**
41
+ * L2 chains (Base, Optimism, etc.) deduct an L1 data-posting fee from the
42
+ * sender's balance on top of the L2 gas. The sweep formula `balance - L2gas`
43
+ * doesn't account for it and the RPC rejects the broadcast as underfunded.
44
+ *
45
+ * We reserve a small portion of the swept value to cover the L1 fee plus
46
+ * fluctuation headroom. Magnitude: keep min(balance * 2%, 0.0001 ETH).
47
+ */
48
+ function l2DataFeeReserve(balance) {
49
+ const percent = balance / 50n; // 2 %
50
+ const cap = 100000000000000n; // 0.0001 ETH
51
+ return percent < cap ? percent : cap;
52
+ }
53
+ /**
54
+ * Apply gas multiplier (basis-of-100 percent). Default 120n = 120% headroom.
55
+ * Performs ceil-division to avoid undershooting fees.
56
+ */
57
+ function applyGasMultiplier(gas, multiplier) {
58
+ // ceil((gas * multiplier) / 100)
59
+ return (gas * multiplier + 99n) / 100n;
60
+ }
61
+ /**
62
+ * Compute the required ETH gas reserve for a transaction.
63
+ *
64
+ * No amounts are logged or surfaced in errors — privacy invariant #5.
65
+ */
66
+ async function resolveGasCost(transport, gasEstimate, options) {
67
+ const multiplier = options?.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER;
68
+ const adjustedGas = applyGasMultiplier(gasEstimate, multiplier);
69
+ const feePerGas = options?.maxFeePerGas ?? (await transport.publicClient.getGasPrice());
70
+ return adjustedGas * feePerGas;
71
+ }
72
+ /**
73
+ * Sweep the entire ETH balance from a stealth address to a destination.
74
+ *
75
+ * @param transport - ShroudFi transport (publicClient must reach the target chain)
76
+ * @param stealthPrivateKey - one-time stealth address private key. Treat as
77
+ * sensitive: caller MUST NOT log, persist, or transmit this value. The SDK
78
+ * does not retain it after the call returns.
79
+ * @param destination - final address that receives swept ETH
80
+ * @param options - optional fee/nonce overrides
81
+ *
82
+ * @remarks Phase 1: self-funded sweep. The stealth address pays its own gas in ETH,
83
+ * which creates a gas-funding correlation vector documented in research (Umbra deanonymization
84
+ * heuristic H2). This will be addressed in Phase 5 by a gasless relayer flow.
85
+ *
86
+ * @remarks Balance/nonce/gas-price are queried separately before signing. Callers running
87
+ * sweeps concurrently against the same stealth address should pass an explicit `nonce` in
88
+ * options to avoid races. Stack traces of thrown errors should NOT be logged by callers —
89
+ * they may contain RPC payload metadata.
90
+ */
91
+ export async function sweepETH(transport, stealthPrivateKey, destination, options) {
92
+ if (!destination || destination === ZERO_ADDRESS) {
93
+ throw new SweepError('Invalid destination');
94
+ }
95
+ const account = privateKeyToAccount(stealthPrivateKey);
96
+ const balance = await transport.publicClient.getBalance({
97
+ address: account.address,
98
+ });
99
+ if (balance === 0n) {
100
+ throw new InsufficientBalanceError();
101
+ }
102
+ const gasCost = await resolveGasCost(transport, ETH_TRANSFER_GAS_ESTIMATE, options);
103
+ const l2Reserve = l2DataFeeReserve(balance);
104
+ if (balance <= gasCost + l2Reserve) {
105
+ throw new InsufficientBalanceError();
106
+ }
107
+ const valueToSend = balance - gasCost - l2Reserve;
108
+ const chain = transport.chain;
109
+ const nonce = options?.nonce ??
110
+ (await transport.publicClient.getTransactionCount({
111
+ address: account.address,
112
+ }));
113
+ const { maxFeePerGas, maxPriorityFeePerGas } = await suggestEip1559Fees(transport, options);
114
+ const serializedTransaction = await account.signTransaction({
115
+ to: destination,
116
+ value: valueToSend,
117
+ gas: ETH_TRANSFER_GAS_ESTIMATE,
118
+ maxFeePerGas,
119
+ maxPriorityFeePerGas,
120
+ nonce,
121
+ chainId: chain.id,
122
+ type: 'eip1559',
123
+ });
124
+ let txHash;
125
+ try {
126
+ txHash = await transport.publicClient.sendRawTransaction({
127
+ serializedTransaction,
128
+ });
129
+ }
130
+ catch (err) {
131
+ // Privacy: surface only the error class name + a structured tag; never
132
+ // include the serialized transaction (which contains the signature) or
133
+ // the raw RPC error payload (which may quote bytes).
134
+ const tag = err instanceof Error ? err.name : 'unknown';
135
+ throw new SweepError(`sweep broadcast failed (${tag})`);
136
+ }
137
+ const receipt = await transport.publicClient.waitForTransactionReceipt({
138
+ hash: txHash,
139
+ });
140
+ const swept = {
141
+ txHash,
142
+ destination,
143
+ token: ETH_SENTINEL,
144
+ blockNumber: receipt.blockNumber,
145
+ };
146
+ return swept;
147
+ }
148
+ /**
149
+ * Sweep the entire ERC20 balance from a stealth address to a destination.
150
+ *
151
+ * The stealth address must already hold enough ETH to pay gas for the
152
+ * ERC20 transfer. Funding it from another account links the two — see
153
+ * privacy notes below.
154
+ *
155
+ * @param transport - ShroudFi transport
156
+ * @param stealthPrivateKey - one-time stealth private key (see sweepETH note)
157
+ * @param token - ERC20 contract address
158
+ * @param destination - final address that receives swept tokens
159
+ * @param options - optional fee/nonce overrides
160
+ *
161
+ * @remarks Phase 1: self-funded sweep. The stealth address pays its own gas in ETH,
162
+ * which creates a gas-funding correlation vector documented in research (Umbra deanonymization
163
+ * heuristic H2). This will be addressed in Phase 5 by a gasless relayer flow.
164
+ *
165
+ * @remarks Balance/nonce/gas-price are queried separately before signing. Callers running
166
+ * sweeps concurrently against the same stealth address should pass an explicit `nonce` in
167
+ * options to avoid races. Stack traces of thrown errors should NOT be logged by callers —
168
+ * they may contain RPC payload metadata.
169
+ */
170
+ export async function sweepERC20(transport, stealthPrivateKey, token, destination, options) {
171
+ if (!destination || destination === ZERO_ADDRESS) {
172
+ throw new SweepError('Invalid destination');
173
+ }
174
+ if (!token || token === ZERO_ADDRESS) {
175
+ throw new SweepError('Invalid token');
176
+ }
177
+ const account = privateKeyToAccount(stealthPrivateKey);
178
+ const tokenBalance = (await transport.publicClient.readContract({
179
+ address: token,
180
+ abi: ERC20Abi,
181
+ functionName: 'balanceOf',
182
+ args: [account.address],
183
+ }));
184
+ if (tokenBalance === 0n) {
185
+ throw new InsufficientBalanceError();
186
+ }
187
+ const ethBalance = await transport.publicClient.getBalance({
188
+ address: account.address,
189
+ });
190
+ const gasCost = await resolveGasCost(transport, ERC20_TRANSFER_GAS_ESTIMATE, options);
191
+ if (ethBalance < gasCost) {
192
+ throw new InsufficientBalanceError();
193
+ }
194
+ const data = encodeFunctionData({
195
+ abi: ERC20Abi,
196
+ functionName: 'transfer',
197
+ args: [destination, tokenBalance],
198
+ });
199
+ const chain = transport.chain;
200
+ const nonce = options?.nonce ??
201
+ (await transport.publicClient.getTransactionCount({
202
+ address: account.address,
203
+ }));
204
+ const { maxFeePerGas, maxPriorityFeePerGas } = await suggestEip1559Fees(transport, options);
205
+ const serializedTransaction = await account.signTransaction({
206
+ to: token,
207
+ value: 0n,
208
+ data,
209
+ gas: ERC20_TRANSFER_GAS_ESTIMATE,
210
+ maxFeePerGas,
211
+ maxPriorityFeePerGas,
212
+ nonce,
213
+ chainId: chain.id,
214
+ type: 'eip1559',
215
+ });
216
+ let txHash;
217
+ try {
218
+ txHash = await transport.publicClient.sendRawTransaction({
219
+ serializedTransaction,
220
+ });
221
+ }
222
+ catch (err) {
223
+ const tag = err instanceof Error ? err.name : 'unknown';
224
+ throw new SweepError(`sweep broadcast failed (${tag})`);
225
+ }
226
+ const receipt = await transport.publicClient.waitForTransactionReceipt({
227
+ hash: txHash,
228
+ });
229
+ const swept = {
230
+ txHash,
231
+ destination,
232
+ token,
233
+ blockNumber: receipt.blockNumber,
234
+ };
235
+ return swept;
236
+ }
237
+ //# sourceMappingURL=sweep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sweep.js","sourceRoot":"","sources":["../../src/sweep.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;GAWG;AACH,KAAK,UAAU,kBAAkB,CAC/B,SAA4B,EAC5B,OAAgC;IAEhC,IACE,OAAO,EAAE,YAAY,KAAK,SAAS;QACnC,OAAO,CAAC,oBAAoB,KAAK,SAAS,EAC1C,CAAC;QACD,OAAO;YACL,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;SACnD,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,SAAS,C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AC1D,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,EAAE;QACT,IAAI;QACJ,GAAG,EAAE,2BAA2B;QAChC,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC;IAEH,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC;YACvD,qBAAqB;SACtB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACxD,MAAM,IAAI,UAAU,CAAC,2BAA2B,GAAG,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,yBAAyB,CAAC;QACrE,IAAI,EAAE,MAAM;KACb,CAAC,CAAC;IAEH,MAAM,KAAK,GAAiB;QAC1B,MAAM;QACN,WAAW;QACX,KAAK;QACL,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Address, Hash, Hex } from 'viem';
2
+ export interface SendOptions {
3
+ readonly gasMultiplier?: bigint;
4
+ readonly maxFeePerGas?: bigint;
5
+ readonly maxPriorityFeePerGas?: bigint;
6
+ readonly nonce?: number;
7
+ }
8
+ export interface PaymentReceipt {
9
+ readonly txHash: Hash;
10
+ readonly stealthAddress: Address;
11
+ readonly ephemeralPubKey: Hex;
12
+ readonly viewTag: number;
13
+ readonly blockNumber: bigint;
14
+ readonly token: Address;
15
+ }
16
+ export interface SweepReceipt {
17
+ readonly txHash: Hash;
18
+ readonly destination: Address;
19
+ readonly token: Address;
20
+ readonly blockNumber: bigint;
21
+ }
22
+ export interface PreparedStealthPayment {
23
+ readonly stealthAddress: Address;
24
+ readonly ephemeralPubKey: Hex;
25
+ readonly viewTag: number;
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}