@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.
- package/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/cjs/amount-privacy.d.ts +30 -0
- package/dist/cjs/amount-privacy.d.ts.map +1 -0
- package/dist/cjs/amount-privacy.js +30 -0
- package/dist/cjs/amount-privacy.js.map +1 -0
- package/dist/cjs/constants.d.ts +7 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +10 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/errors.d.ts +57 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +91 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.d.ts +10 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +42 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/payments.d.ts +49 -0
- package/dist/cjs/payments.d.ts.map +1 -0
- package/dist/cjs/payments.js +266 -0
- package/dist/cjs/payments.js.map +1 -0
- package/dist/cjs/send-to-wallet.d.ts +57 -0
- package/dist/cjs/send-to-wallet.d.ts.map +1 -0
- package/dist/cjs/send-to-wallet.js +104 -0
- package/dist/cjs/send-to-wallet.js.map +1 -0
- package/dist/cjs/sweep.d.ts +47 -0
- package/dist/cjs/sweep.d.ts.map +1 -0
- package/dist/cjs/sweep.js +241 -0
- package/dist/cjs/sweep.js.map +1 -0
- package/dist/cjs/types.d.ts +27 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/amount-privacy.d.ts +30 -0
- package/dist/esm/amount-privacy.d.ts.map +1 -0
- package/dist/esm/amount-privacy.js +25 -0
- package/dist/esm/amount-privacy.js.map +1 -0
- package/dist/esm/constants.d.ts +7 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +7 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/errors.d.ts +57 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +78 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/payments.d.ts +49 -0
- package/dist/esm/payments.d.ts.map +1 -0
- package/dist/esm/payments.js +261 -0
- package/dist/esm/payments.js.map +1 -0
- package/dist/esm/send-to-wallet.d.ts +57 -0
- package/dist/esm/send-to-wallet.d.ts.map +1 -0
- package/dist/esm/send-to-wallet.js +100 -0
- package/dist/esm/send-to-wallet.js.map +1 -0
- package/dist/esm/sweep.d.ts +47 -0
- package/dist/esm/sweep.d.ts.map +1 -0
- package/dist/esm/sweep.js +237 -0
- package/dist/esm/sweep.js.map +1 -0
- package/dist/esm/types.d.ts +27 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ShroudFi contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @shroud-fi/payments
|
|
2
|
+
|
|
3
|
+
> Sender-side stealth payment construction for ShroudFi. ETH + ERC-20 on Base.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@shroud-fi/payments)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i @shroud-fi/payments viem
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
`@shroud-fi/payments` is the sender side of a ShroudFi payment. For each transfer it:
|
|
15
|
+
|
|
16
|
+
1. Derives a fresh one-time stealth address from the recipient's `(spendPub, scanPub)` meta-address.
|
|
17
|
+
2. Computes the EIP-5564 announcement and broadcasts it on-chain.
|
|
18
|
+
3. Sends ETH or ERC-20 to that one-time address.
|
|
19
|
+
4. Resolves recipient meta-addresses from a plain EVM wallet via the on-chain ERC-6538 registry.
|
|
20
|
+
|
|
21
|
+
The graph of who-pays-whom never reaches the public ledger — every payment lands at an unlinkable destination only the recipient can spend from.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { sendETHPayment, lookupMetaAddress } from '@shroud-fi/payments';
|
|
27
|
+
import { createTransport } from '@shroud-fi/transport';
|
|
28
|
+
|
|
29
|
+
const transport = createTransport({ chain: 'base', rpcUrl });
|
|
30
|
+
const meta = await lookupMetaAddress(transport, '0xRecipientWallet');
|
|
31
|
+
|
|
32
|
+
await sendETHPayment({
|
|
33
|
+
transport,
|
|
34
|
+
walletClient,
|
|
35
|
+
recipientMeta: meta.metaAddressEncoded,
|
|
36
|
+
amountWei: 10_000_000_000_000n, // 0.00001 ETH
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Exports
|
|
41
|
+
|
|
42
|
+
| Symbol | Purpose |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `sendETHPayment(args)` | Derive stealth, announce, transfer ETH — one call. |
|
|
45
|
+
| `sendERC20Payment(args)` | Same shape for ERC-20. USDC on Base mainnet is the v1 target. |
|
|
46
|
+
| `sweepETH` · `sweepERC20` | Direct sweep from stealth address to destination. Fee-free, no relayer. |
|
|
47
|
+
| `lookupMetaAddress(transport, wallet)` | Resolve a wallet's registered meta-address via ERC-6538. |
|
|
48
|
+
| `RecipientNotOnboardedError` | Thrown when a wallet has no published meta-address. Structured `.wallet` field for privacy-safe UX. |
|
|
49
|
+
|
|
50
|
+
Full API reference: [shroudfi.live/sdk#payments](https://shroudfi.live/sdk#payments)
|
|
51
|
+
|
|
52
|
+
## Threat model notes
|
|
53
|
+
|
|
54
|
+
- **Amounts are visible.** v1 ShroudFi provides recipient unlinkability, not amount privacy. Amount-fingerprinting is an active mitigation surface.
|
|
55
|
+
- **Address rotation is mandatory.** Sweeping detected payments back to a long-lived wallet collapses the privacy property — use one-shot destinations or batched sweeps.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT — see [LICENSE](./LICENSE).
|
|
60
|
+
|
|
61
|
+
Part of the [ShroudFi](https://shroudfi.live) privacy SDK for AI agents on Base.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
export interface ShieldResult {
|
|
3
|
+
readonly txHash: string;
|
|
4
|
+
readonly noteId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PrivateTransferResult {
|
|
7
|
+
readonly txHash: string;
|
|
8
|
+
readonly recipient: Address;
|
|
9
|
+
}
|
|
10
|
+
export interface UnshieldResult {
|
|
11
|
+
readonly txHash: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AmountPrivacyProvider {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
shield(token: Address, amount: bigint): Promise<ShieldResult>;
|
|
16
|
+
privateTransfer(to: Address, amount: bigint, token: Address): Promise<PrivateTransferResult>;
|
|
17
|
+
unshield(amount: bigint, token: Address): Promise<UnshieldResult>;
|
|
18
|
+
grantViewAccess(viewer: Address): Promise<void>;
|
|
19
|
+
estimateGas(token: Address, amount: bigint): Promise<bigint>;
|
|
20
|
+
}
|
|
21
|
+
export declare class NullAmountPrivacyProvider implements AmountPrivacyProvider {
|
|
22
|
+
readonly name = "null";
|
|
23
|
+
shield(_token?: Address, _amount?: bigint): Promise<ShieldResult>;
|
|
24
|
+
privateTransfer(_to?: Address, _amount?: bigint, _token?: Address): Promise<PrivateTransferResult>;
|
|
25
|
+
unshield(_amount?: bigint, _token?: Address): Promise<UnshieldResult>;
|
|
26
|
+
grantViewAccess(_viewer?: Address): Promise<void>;
|
|
27
|
+
estimateGas(_token?: Address, _amount?: bigint): Promise<bigint>;
|
|
28
|
+
}
|
|
29
|
+
export declare function assertSupported(provider: AmountPrivacyProvider): void;
|
|
30
|
+
//# sourceMappingURL=amount-privacy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount-privacy.d.ts","sourceRoot":"","sources":["../../src/amount-privacy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7F,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAClE,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D;AAED,qBAAa,yBAA0B,YAAW,qBAAqB;IACrE,QAAQ,CAAC,IAAI,UAAU;IAEjB,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIjE,eAAe,CACnB,GAAG,CAAC,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;IAI3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IAIrE,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGvE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAIrE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NullAmountPrivacyProvider = void 0;
|
|
4
|
+
exports.assertSupported = assertSupported;
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
|
+
class NullAmountPrivacyProvider {
|
|
7
|
+
name = 'null';
|
|
8
|
+
async shield(_token, _amount) {
|
|
9
|
+
throw new errors_js_1.AmountPrivacyNotSupportedError('shield');
|
|
10
|
+
}
|
|
11
|
+
async privateTransfer(_to, _amount, _token) {
|
|
12
|
+
throw new errors_js_1.AmountPrivacyNotSupportedError('privateTransfer');
|
|
13
|
+
}
|
|
14
|
+
async unshield(_amount, _token) {
|
|
15
|
+
throw new errors_js_1.AmountPrivacyNotSupportedError('unshield');
|
|
16
|
+
}
|
|
17
|
+
async grantViewAccess(_viewer) {
|
|
18
|
+
throw new errors_js_1.AmountPrivacyNotSupportedError('grantViewAccess');
|
|
19
|
+
}
|
|
20
|
+
async estimateGas(_token, _amount) {
|
|
21
|
+
throw new errors_js_1.AmountPrivacyNotSupportedError('estimateGas');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.NullAmountPrivacyProvider = NullAmountPrivacyProvider;
|
|
25
|
+
function assertSupported(provider) {
|
|
26
|
+
if (provider.name === 'null') {
|
|
27
|
+
throw new errors_js_1.AmountPrivacyNotSupportedError(provider.name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=amount-privacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount-privacy.js","sourceRoot":"","sources":["../../src/amount-privacy.ts"],"names":[],"mappings":";;;AAsDA,0CAIC;AAzDD,2CAA6D;AAyB7D,MAAa,yBAAyB;IAC3B,IAAI,GAAG,MAAM,CAAC;IAEvB,KAAK,CAAC,MAAM,CAAC,MAAgB,EAAE,OAAgB;QAC7C,MAAM,IAAI,0CAA8B,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,GAAa,EACb,OAAgB,EAChB,MAAgB;QAEhB,MAAM,IAAI,0CAA8B,CAAC,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAgB,EAAE,MAAgB;QAC/C,MAAM,IAAI,0CAA8B,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAiB;QACrC,MAAM,IAAI,0CAA8B,CAAC,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAgB,EAAE,OAAgB;QAClD,MAAM,IAAI,0CAA8B,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC;CACF;AA1BD,8DA0BC;AAED,SAAgB,eAAe,CAAC,QAA+B;IAC7D,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC7B,MAAM,IAAI,0CAA8B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DEFAULT_GAS_MULTIPLIER = 120n;
|
|
2
|
+
export declare const ETH_SENTINEL: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
3
|
+
export declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
4
|
+
export declare const SCHEME_ID = 1n;
|
|
5
|
+
export declare const ERC20_TRANSFER_GAS_ESTIMATE = 65000n;
|
|
6
|
+
export declare const ETH_TRANSFER_GAS_ESTIMATE = 21000n;
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,eAAO,MAAM,YAAY,8CAA0E,CAAC;AAEpG,eAAO,MAAM,YAAY,8CAA0E,CAAC;AAEpG,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,eAAO,MAAM,2BAA2B,SAAU,CAAC;AACnD,eAAO,MAAM,yBAAyB,SAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ETH_TRANSFER_GAS_ESTIMATE = exports.ERC20_TRANSFER_GAS_ESTIMATE = exports.SCHEME_ID = exports.ZERO_ADDRESS = exports.ETH_SENTINEL = exports.DEFAULT_GAS_MULTIPLIER = void 0;
|
|
4
|
+
exports.DEFAULT_GAS_MULTIPLIER = 120n;
|
|
5
|
+
exports.ETH_SENTINEL = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
6
|
+
exports.ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
7
|
+
exports.SCHEME_ID = 1n;
|
|
8
|
+
exports.ERC20_TRANSFER_GAS_ESTIMATE = 65000n;
|
|
9
|
+
exports.ETH_TRANSFER_GAS_ESTIMATE = 21000n;
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE9B,QAAA,YAAY,GAAG,4CAAuE,CAAC;AAEvF,QAAA,YAAY,GAAG,4CAAuE,CAAC;AAEvF,QAAA,SAAS,GAAG,EAAE,CAAC;AAEf,QAAA,2BAA2B,GAAG,MAAO,CAAC;AACtC,QAAA,yBAAyB,GAAG,MAAO,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare class PaymentError extends Error {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class SweepError extends Error {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class InvalidRecipientError extends PaymentError {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
export declare class InsufficientBalanceError extends SweepError {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
export declare class ZeroAmountError extends PaymentError {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class AmountPrivacyNotSupportedError extends Error {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
constructor(method: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class MissingWalletClientError extends PaymentError {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
constructor();
|
|
28
|
+
}
|
|
29
|
+
export declare class StealthPaymentContractNotConfiguredError extends PaymentError {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when a sender tries to pay a wallet that has not yet registered a
|
|
35
|
+
* stealth meta-address in the canonical ERC-6538 registry. The recipient must
|
|
36
|
+
* onboard first (publish their (S, B) pubkeys) before stealth payments are
|
|
37
|
+
* possible.
|
|
38
|
+
*
|
|
39
|
+
* Privacy note: the offending wallet address is NOT placed in `.message`. It
|
|
40
|
+
* is exposed via the `wallet` property so callers can show a useful UI hint
|
|
41
|
+
* without leaking the address into logs that only capture `.message`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class RecipientNotOnboardedError extends PaymentError {
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly wallet: `0x${string}`;
|
|
46
|
+
constructor(wallet: `0x${string}`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Thrown when the bytes returned by `stealthMetaAddressOf` are not the
|
|
50
|
+
* expected 66 raw bytes (33 spending pubkey + 33 viewing pubkey) with valid
|
|
51
|
+
* compressed-point prefixes. Indicates registry corruption or off-spec usage.
|
|
52
|
+
*/
|
|
53
|
+
export declare class MalformedMetaAddressError extends PaymentError {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
constructor();
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAkB;gBACpC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,UAAW,SAAQ,KAAK;IACnC,SAAkB,IAAI,EAAE,MAAM,CAAgB;gBAClC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,SAAkB,IAAI,EAAE,MAAM,CAA2B;;CAI1D;AAED,qBAAa,wBAAyB,SAAQ,UAAU;IACtD,SAAkB,IAAI,EAAE,MAAM,CAA8B;;CAI7D;AAED,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAkB,IAAI,EAAE,MAAM,CAAqB;;CAIpD;AAED,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,SAAkB,IAAI,EAAE,MAAM,CAAoC;gBACtD,MAAM,EAAE,MAAM;CAG3B;AAED,qBAAa,wBAAyB,SAAQ,YAAY;IACxD,SAAkB,IAAI,EAAE,MAAM,CAA8B;;CAI7D;AAED,qBAAa,wCAAyC,SAAQ,YAAY;IACxE,SAAkB,IAAI,EAAE,MAAM,CAA8C;;CAI7E;AAED;;;;;;;;;GASG;AACH,qBAAa,0BAA2B,SAAQ,YAAY;IAC1D,SAAkB,IAAI,EAAE,MAAM,CAAgC;IAC9D,QAAQ,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;gBACnB,MAAM,EAAE,KAAK,MAAM,EAAE;CAIlC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,YAAY;IACzD,SAAkB,IAAI,EAAE,MAAM,CAA+B;;CAI9D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MalformedMetaAddressError = exports.RecipientNotOnboardedError = exports.StealthPaymentContractNotConfiguredError = exports.MissingWalletClientError = exports.AmountPrivacyNotSupportedError = exports.ZeroAmountError = exports.InsufficientBalanceError = exports.InvalidRecipientError = exports.SweepError = exports.PaymentError = void 0;
|
|
4
|
+
class PaymentError extends Error {
|
|
5
|
+
name = 'PaymentError';
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PaymentError = PaymentError;
|
|
11
|
+
class SweepError extends Error {
|
|
12
|
+
name = 'SweepError';
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.SweepError = SweepError;
|
|
18
|
+
class InvalidRecipientError extends PaymentError {
|
|
19
|
+
name = 'InvalidRecipientError';
|
|
20
|
+
constructor() {
|
|
21
|
+
super('Invalid recipient meta-address');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.InvalidRecipientError = InvalidRecipientError;
|
|
25
|
+
class InsufficientBalanceError extends SweepError {
|
|
26
|
+
name = 'InsufficientBalanceError';
|
|
27
|
+
constructor() {
|
|
28
|
+
super('Insufficient balance to cover gas');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.InsufficientBalanceError = InsufficientBalanceError;
|
|
32
|
+
class ZeroAmountError extends PaymentError {
|
|
33
|
+
name = 'ZeroAmountError';
|
|
34
|
+
constructor() {
|
|
35
|
+
super('Amount must be greater than zero');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ZeroAmountError = ZeroAmountError;
|
|
39
|
+
class AmountPrivacyNotSupportedError extends Error {
|
|
40
|
+
name = 'AmountPrivacyNotSupportedError';
|
|
41
|
+
constructor(method) {
|
|
42
|
+
super(`Amount privacy not supported: ${method}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.AmountPrivacyNotSupportedError = AmountPrivacyNotSupportedError;
|
|
46
|
+
class MissingWalletClientError extends PaymentError {
|
|
47
|
+
name = 'MissingWalletClientError';
|
|
48
|
+
constructor() {
|
|
49
|
+
super('Transport has no walletClient configured');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.MissingWalletClientError = MissingWalletClientError;
|
|
53
|
+
class StealthPaymentContractNotConfiguredError extends PaymentError {
|
|
54
|
+
name = 'StealthPaymentContractNotConfiguredError';
|
|
55
|
+
constructor() {
|
|
56
|
+
super('ShroudFiStealth contract address not configured');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.StealthPaymentContractNotConfiguredError = StealthPaymentContractNotConfiguredError;
|
|
60
|
+
/**
|
|
61
|
+
* Thrown when a sender tries to pay a wallet that has not yet registered a
|
|
62
|
+
* stealth meta-address in the canonical ERC-6538 registry. The recipient must
|
|
63
|
+
* onboard first (publish their (S, B) pubkeys) before stealth payments are
|
|
64
|
+
* possible.
|
|
65
|
+
*
|
|
66
|
+
* Privacy note: the offending wallet address is NOT placed in `.message`. It
|
|
67
|
+
* is exposed via the `wallet` property so callers can show a useful UI hint
|
|
68
|
+
* without leaking the address into logs that only capture `.message`.
|
|
69
|
+
*/
|
|
70
|
+
class RecipientNotOnboardedError extends PaymentError {
|
|
71
|
+
name = 'RecipientNotOnboardedError';
|
|
72
|
+
wallet;
|
|
73
|
+
constructor(wallet) {
|
|
74
|
+
super('Recipient wallet has not registered a stealth meta-address');
|
|
75
|
+
this.wallet = wallet;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.RecipientNotOnboardedError = RecipientNotOnboardedError;
|
|
79
|
+
/**
|
|
80
|
+
* Thrown when the bytes returned by `stealthMetaAddressOf` are not the
|
|
81
|
+
* expected 66 raw bytes (33 spending pubkey + 33 viewing pubkey) with valid
|
|
82
|
+
* compressed-point prefixes. Indicates registry corruption or off-spec usage.
|
|
83
|
+
*/
|
|
84
|
+
class MalformedMetaAddressError extends PaymentError {
|
|
85
|
+
name = 'MalformedMetaAddressError';
|
|
86
|
+
constructor() {
|
|
87
|
+
super('Registry returned a malformed stealth meta-address');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.MalformedMetaAddressError = MalformedMetaAddressError;
|
|
91
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;IACnB,IAAI,GAAW,cAAc,CAAC;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AALD,oCAKC;AAED,MAAa,UAAW,SAAQ,KAAK;IACjB,IAAI,GAAW,YAAY,CAAC;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AALD,gCAKC;AAED,MAAa,qBAAsB,SAAQ,YAAY;IACnC,IAAI,GAAW,uBAAuB,CAAC;IACzD;QACE,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC1C,CAAC;CACF;AALD,sDAKC;AAED,MAAa,wBAAyB,SAAQ,UAAU;IACpC,IAAI,GAAW,0BAA0B,CAAC;IAC5D;QACE,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAC7C,CAAC;CACF;AALD,4DAKC;AAED,MAAa,eAAgB,SAAQ,YAAY;IAC7B,IAAI,GAAW,iBAAiB,CAAC;IACnD;QACE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC5C,CAAC;CACF;AALD,0CAKC;AAED,MAAa,8BAA+B,SAAQ,KAAK;IACrC,IAAI,GAAW,gCAAgC,CAAC;IAClE,YAAY,MAAc;QACxB,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC;CACF;AALD,wEAKC;AAED,MAAa,wBAAyB,SAAQ,YAAY;IACtC,IAAI,GAAW,0BAA0B,CAAC;IAC5D;QACE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACpD,CAAC;CACF;AALD,4DAKC;AAED,MAAa,wCAAyC,SAAQ,YAAY;IACtD,IAAI,GAAW,0CAA0C,CAAC;IAC5E;QACE,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,CAAC;CACF;AALD,4FAKC;AAED;;;;;;;;;GASG;AACH,MAAa,0BAA2B,SAAQ,YAAY;IACxC,IAAI,GAAW,4BAA4B,CAAC;IACrD,MAAM,CAAgB;IAC/B,YAAY,MAAqB;QAC/B,KAAK,CAAC,4DAA4D,CAAC,CAAC;QACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAPD,gEAOC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,YAAY;IACvC,IAAI,GAAW,2BAA2B,CAAC;IAC7D;QACE,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC9D,CAAC;CACF;AALD,8DAKC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { sendETHPayment, sendERC20Payment, prepareStealthPayment, } from './payments.js';
|
|
2
|
+
export { sweepETH, sweepERC20, } from './sweep.js';
|
|
3
|
+
export { sendToWallet, lookupMetaAddress, } from './send-to-wallet.js';
|
|
4
|
+
export { NullAmountPrivacyProvider, assertSupported, } from './amount-privacy.js';
|
|
5
|
+
export type { SendOptions, PaymentReceipt, SweepReceipt, PreparedStealthPayment, } from './types.js';
|
|
6
|
+
export type { SendToWalletAsset } from './send-to-wallet.js';
|
|
7
|
+
export type { AmountPrivacyProvider, ShieldResult, PrivateTransferResult, UnshieldResult, } from './amount-privacy.js';
|
|
8
|
+
export { DEFAULT_GAS_MULTIPLIER, ETH_SENTINEL, ZERO_ADDRESS, SCHEME_ID, ETH_TRANSFER_GAS_ESTIMATE, ERC20_TRANSFER_GAS_ESTIMATE, } from './constants.js';
|
|
9
|
+
export { PaymentError, SweepError, InvalidRecipientError, InsufficientBalanceError, ZeroAmountError, AmountPrivacyNotSupportedError, MissingWalletClientError, StealthPaymentContractNotConfiguredError, RecipientNotOnboardedError, MalformedMetaAddressError, } from './errors.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EACV,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EACf,8BAA8B,EAC9B,wBAAwB,EACxB,wCAAwC,EACxC,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Public surface — @shroud-fi/payments
|
|
3
|
+
// Phase 1: stealth payment construction + sweep (self-funded).
|
|
4
|
+
// Sweep timing (log-normal delay, destination rotation) lives in @shroud-fi/scanning (P3).
|
|
5
|
+
// Relayer-funded sweep + EIP-2612 permit lives in the relayer service (P5).
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MalformedMetaAddressError = exports.RecipientNotOnboardedError = exports.StealthPaymentContractNotConfiguredError = exports.MissingWalletClientError = exports.AmountPrivacyNotSupportedError = exports.ZeroAmountError = exports.InsufficientBalanceError = exports.InvalidRecipientError = exports.SweepError = exports.PaymentError = exports.ERC20_TRANSFER_GAS_ESTIMATE = exports.ETH_TRANSFER_GAS_ESTIMATE = exports.SCHEME_ID = exports.ZERO_ADDRESS = exports.ETH_SENTINEL = exports.DEFAULT_GAS_MULTIPLIER = exports.assertSupported = exports.NullAmountPrivacyProvider = exports.lookupMetaAddress = exports.sendToWallet = exports.sweepERC20 = exports.sweepETH = exports.prepareStealthPayment = exports.sendERC20Payment = exports.sendETHPayment = void 0;
|
|
8
|
+
// Functions
|
|
9
|
+
var payments_js_1 = require("./payments.js");
|
|
10
|
+
Object.defineProperty(exports, "sendETHPayment", { enumerable: true, get: function () { return payments_js_1.sendETHPayment; } });
|
|
11
|
+
Object.defineProperty(exports, "sendERC20Payment", { enumerable: true, get: function () { return payments_js_1.sendERC20Payment; } });
|
|
12
|
+
Object.defineProperty(exports, "prepareStealthPayment", { enumerable: true, get: function () { return payments_js_1.prepareStealthPayment; } });
|
|
13
|
+
var sweep_js_1 = require("./sweep.js");
|
|
14
|
+
Object.defineProperty(exports, "sweepETH", { enumerable: true, get: function () { return sweep_js_1.sweepETH; } });
|
|
15
|
+
Object.defineProperty(exports, "sweepERC20", { enumerable: true, get: function () { return sweep_js_1.sweepERC20; } });
|
|
16
|
+
var send_to_wallet_js_1 = require("./send-to-wallet.js");
|
|
17
|
+
Object.defineProperty(exports, "sendToWallet", { enumerable: true, get: function () { return send_to_wallet_js_1.sendToWallet; } });
|
|
18
|
+
Object.defineProperty(exports, "lookupMetaAddress", { enumerable: true, get: function () { return send_to_wallet_js_1.lookupMetaAddress; } });
|
|
19
|
+
var amount_privacy_js_1 = require("./amount-privacy.js");
|
|
20
|
+
Object.defineProperty(exports, "NullAmountPrivacyProvider", { enumerable: true, get: function () { return amount_privacy_js_1.NullAmountPrivacyProvider; } });
|
|
21
|
+
Object.defineProperty(exports, "assertSupported", { enumerable: true, get: function () { return amount_privacy_js_1.assertSupported; } });
|
|
22
|
+
// Constants
|
|
23
|
+
var constants_js_1 = require("./constants.js");
|
|
24
|
+
Object.defineProperty(exports, "DEFAULT_GAS_MULTIPLIER", { enumerable: true, get: function () { return constants_js_1.DEFAULT_GAS_MULTIPLIER; } });
|
|
25
|
+
Object.defineProperty(exports, "ETH_SENTINEL", { enumerable: true, get: function () { return constants_js_1.ETH_SENTINEL; } });
|
|
26
|
+
Object.defineProperty(exports, "ZERO_ADDRESS", { enumerable: true, get: function () { return constants_js_1.ZERO_ADDRESS; } });
|
|
27
|
+
Object.defineProperty(exports, "SCHEME_ID", { enumerable: true, get: function () { return constants_js_1.SCHEME_ID; } });
|
|
28
|
+
Object.defineProperty(exports, "ETH_TRANSFER_GAS_ESTIMATE", { enumerable: true, get: function () { return constants_js_1.ETH_TRANSFER_GAS_ESTIMATE; } });
|
|
29
|
+
Object.defineProperty(exports, "ERC20_TRANSFER_GAS_ESTIMATE", { enumerable: true, get: function () { return constants_js_1.ERC20_TRANSFER_GAS_ESTIMATE; } });
|
|
30
|
+
// Errors
|
|
31
|
+
var errors_js_1 = require("./errors.js");
|
|
32
|
+
Object.defineProperty(exports, "PaymentError", { enumerable: true, get: function () { return errors_js_1.PaymentError; } });
|
|
33
|
+
Object.defineProperty(exports, "SweepError", { enumerable: true, get: function () { return errors_js_1.SweepError; } });
|
|
34
|
+
Object.defineProperty(exports, "InvalidRecipientError", { enumerable: true, get: function () { return errors_js_1.InvalidRecipientError; } });
|
|
35
|
+
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return errors_js_1.InsufficientBalanceError; } });
|
|
36
|
+
Object.defineProperty(exports, "ZeroAmountError", { enumerable: true, get: function () { return errors_js_1.ZeroAmountError; } });
|
|
37
|
+
Object.defineProperty(exports, "AmountPrivacyNotSupportedError", { enumerable: true, get: function () { return errors_js_1.AmountPrivacyNotSupportedError; } });
|
|
38
|
+
Object.defineProperty(exports, "MissingWalletClientError", { enumerable: true, get: function () { return errors_js_1.MissingWalletClientError; } });
|
|
39
|
+
Object.defineProperty(exports, "StealthPaymentContractNotConfiguredError", { enumerable: true, get: function () { return errors_js_1.StealthPaymentContractNotConfiguredError; } });
|
|
40
|
+
Object.defineProperty(exports, "RecipientNotOnboardedError", { enumerable: true, get: function () { return errors_js_1.RecipientNotOnboardedError; } });
|
|
41
|
+
Object.defineProperty(exports, "MalformedMetaAddressError", { enumerable: true, get: function () { return errors_js_1.MalformedMetaAddressError; } });
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,+DAA+D;AAC/D,2FAA2F;AAC3F,4EAA4E;;;AAE5E,YAAY;AACZ,6CAIuB;AAHrB,6GAAA,cAAc,OAAA;AACd,+GAAA,gBAAgB,OAAA;AAChB,oHAAA,qBAAqB,OAAA;AAEvB,uCAGoB;AAFlB,oGAAA,QAAQ,OAAA;AACR,sGAAA,UAAU,OAAA;AAEZ,yDAG6B;AAF3B,iHAAA,YAAY,OAAA;AACZ,sHAAA,iBAAiB,OAAA;AAEnB,yDAG6B;AAF3B,8HAAA,yBAAyB,OAAA;AACzB,oHAAA,eAAe,OAAA;AAkBjB,YAAY;AACZ,+CAOwB;AANtB,sHAAA,sBAAsB,OAAA;AACtB,4GAAA,YAAY,OAAA;AACZ,4GAAA,YAAY,OAAA;AACZ,yGAAA,SAAS,OAAA;AACT,yHAAA,yBAAyB,OAAA;AACzB,2HAAA,2BAA2B,OAAA;AAG7B,SAAS;AACT,yCAWqB;AAVnB,yGAAA,YAAY,OAAA;AACZ,uGAAA,UAAU,OAAA;AACV,kHAAA,qBAAqB,OAAA;AACrB,qHAAA,wBAAwB,OAAA;AACxB,4GAAA,eAAe,OAAA;AACf,2HAAA,8BAA8B,OAAA;AAC9B,qHAAA,wBAAwB,OAAA;AACxB,qIAAA,wCAAwC,OAAA;AACxC,uHAAA,0BAA0B,OAAA;AAC1B,sHAAA,yBAAyB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ShroudFi Payments - Stealth Payment Construction
|
|
3
|
+
*
|
|
4
|
+
* Builds and submits stealth payments through the ShroudFiStealth contract.
|
|
5
|
+
* Uses generateStealthAddress from @shroud-fi/core for derivation.
|
|
6
|
+
*
|
|
7
|
+
* Privacy invariants enforced:
|
|
8
|
+
* - No private key material in any error message
|
|
9
|
+
* - No plaintext amounts in any error message
|
|
10
|
+
* - No console.log/warn/error anywhere
|
|
11
|
+
* - Non-custodial: only constructs transactions, never holds funds
|
|
12
|
+
*/
|
|
13
|
+
import type { Address } from 'viem';
|
|
14
|
+
import type { StealthMetaAddress } from '@shroud-fi/core';
|
|
15
|
+
import type { ShroudFiTransport } from '@shroud-fi/transport';
|
|
16
|
+
import type { PaymentReceipt, PreparedStealthPayment, SendOptions } from './types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Prepare stealth payment material from a recipient meta-address.
|
|
19
|
+
* Pure helper - does not submit any transaction.
|
|
20
|
+
*
|
|
21
|
+
* @throws InvalidRecipientError if the meta-address is malformed or invalid.
|
|
22
|
+
*/
|
|
23
|
+
export declare function prepareStealthPayment(metaAddress: StealthMetaAddress): PreparedStealthPayment;
|
|
24
|
+
/**
|
|
25
|
+
* Send native ETH to a stealth address derived from `metaAddress`.
|
|
26
|
+
*
|
|
27
|
+
* Privacy notes:
|
|
28
|
+
* - The contract emits a StealthPayment event with the stealth address.
|
|
29
|
+
* - The amount is on-chain by necessity (no native ETH amount privacy).
|
|
30
|
+
* - Caller pays gas - relayer abstraction is a separate concern.
|
|
31
|
+
*
|
|
32
|
+
* @throws MissingWalletClientError if transport has no walletClient configured.
|
|
33
|
+
* @throws ZeroAmountError if valueWei is 0n.
|
|
34
|
+
* @throws InvalidRecipientError if the meta-address is invalid.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sendETHPayment(transport: ShroudFiTransport, contractAddress: Address, metaAddress: StealthMetaAddress, valueWei: bigint, options?: SendOptions): Promise<PaymentReceipt>;
|
|
37
|
+
/**
|
|
38
|
+
* Send an ERC-20 token to a stealth address derived from `metaAddress`.
|
|
39
|
+
*
|
|
40
|
+
* **Pre-approval required:** the caller MUST have already approved
|
|
41
|
+
* `contractAddress` to spend at least `amount` of `token` from the sender's
|
|
42
|
+
* account. v1 does not include an approve flow.
|
|
43
|
+
*
|
|
44
|
+
* @throws MissingWalletClientError if transport has no walletClient configured.
|
|
45
|
+
* @throws ZeroAmountError if amount is 0n.
|
|
46
|
+
* @throws InvalidRecipientError if the meta-address is invalid.
|
|
47
|
+
*/
|
|
48
|
+
export declare function sendERC20Payment(transport: ShroudFiTransport, contractAddress: Address, metaAddress: StealthMetaAddress, token: Address, amount: bigint, options?: SendOptions): Promise<PaymentReceipt>;
|
|
49
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/payments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAA+C,MAAM,MAAM,CAAC;AAGjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,WAAW,EACZ,MAAM,YAAY,CAAC;AA4BpB;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,kBAAkB,GAC9B,sBAAsB,CAaxB;AAoDD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,iBAAiB,EAC5B,eAAe,EAAE,OAAO,EACxB,WAAW,EAAE,kBAAkB,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,cAAc,CAAC,CA2EzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,iBAAiB,EAC5B,eAAe,EAAE,OAAO,EACxB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,cAAc,CAAC,CAiFzB"}
|