@w-pay/appkit 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hector Morel
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,57 @@
1
+ # @w-pay/appkit
2
+
3
+ Pay an ENS name with [Reown AppKit Pay](https://www.npmjs.com/package/@reown/appkit-pay).
4
+
5
+ ```bash
6
+ npm install @w-pay/appkit @w-pay/sdk @reown/appkit-pay viem
7
+ ```
8
+
9
+ ```ts
10
+ import * as appkitPay from "@reown/appkit-pay";
11
+ import { payToName } from "@w-pay/appkit";
12
+
13
+ await payToName(publicClient, appkitPay, {
14
+ to: "demo.w-pay.eth",
15
+ amount: 15,
16
+ currency: "USDC",
17
+ });
18
+ ```
19
+
20
+ That's the whole integration. The name is resolved to a chain, token and plain
21
+ address, and `pay()` is called with the address.
22
+
23
+ ## Preview before the wallet opens
24
+
25
+ ```ts
26
+ import { previewPayment } from "@w-pay/appkit";
27
+
28
+ const intent = await previewPayment(publicClient, { to: "demo.w-pay.eth", amount: 15 });
29
+ // show intent.recipient, intent.chainId, intent.token in a confirmation UI
30
+ ```
31
+
32
+ ## Why this is a wrapper and not a plugin
33
+
34
+ AppKit Pay has no provider, plugin, or middleware registration API. Its exports
35
+ are `pay`, `openPay`, `getPayResult`, `getPayError`, `getIsPaymentInProgress`
36
+ and `getExchanges` — there is no `.use()` and no resolver hook. The headless
37
+ WalletConnect Pay SDK does have an injectable "seams" system, but the set is
38
+ closed (`transport`, `wallet`, `clock`, `telemetry`, plus a signing strategy)
39
+ and contains no identity seam.
40
+
41
+ More to the point: `pay()` validates the recipient with `isAddress()` and
42
+ **throws** on anything that is not a plain address. Passing an ENS name directly
43
+ is not merely unsupported — it is an error.
44
+
45
+ So the only correct integration is outside-in: resolve the name first, then hand
46
+ `pay()` an address. That is what this package does, in about thirty lines. It
47
+ needs nobody's permission and works against every version of AppKit that ships
48
+ `pay()`.
49
+
50
+ The AppKit module is **injected** rather than imported, so this package pins no
51
+ AppKit version and can be tested with a stub.
52
+
53
+ ---
54
+
55
+ Source and architecture: **https://github.com/RWA-ID/w-pay-eth**
56
+
57
+ MIT
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @w-pay/appkit — pay an ENS name with Reown AppKit Pay.
3
+ *
4
+ * ## Why this is a wrapper and not a plugin
5
+ *
6
+ * AppKit Pay has no provider, plugin, or middleware registration API. Its
7
+ * exports are `pay`, `openPay`, `getPayResult`, `getPayError`,
8
+ * `getIsPaymentInProgress` and `getExchanges` — there is no `.use()` and no
9
+ * resolver hook. The headless WalletConnect Pay SDK does have an injectable
10
+ * "seams" system, but the set is closed (`transport`, `wallet`, `clock`,
11
+ * `telemetry`, plus a signing strategy) and contains no identity seam.
12
+ *
13
+ * Worse for our purposes, `pay()` validates the recipient with
14
+ * `CoreHelperUtil.isAddress()` and THROWS on anything that is not a plain
15
+ * address — so passing an ENS name directly is not merely unsupported, it is
16
+ * an error. On the merchant side, WalletConnect Pay's `CreatePayment` request
17
+ * has no recipient field at all; the payee is the onboarded merchant's
18
+ * configured settlement destination.
19
+ *
20
+ * So the only correct integration is outside-in: resolve the name to
21
+ * `{chainId, token, address}` first, then hand `pay()` a plain address. That is
22
+ * exactly what this package does, in about thirty lines. It needs nobody's
23
+ * permission and works against every version of AppKit that ships `pay()`.
24
+ */
25
+ import type { PublicClient } from "viem";
26
+ import { type CreatePaymentOptions, type PaymentIntent } from "@w-pay/sdk";
27
+ /** The subset of `@reown/appkit-pay` this adapter needs. */
28
+ export interface AppKitPayLike {
29
+ pay(options: {
30
+ paymentAsset: {
31
+ network: string;
32
+ asset: string;
33
+ metadata: {
34
+ name: string;
35
+ symbol: string;
36
+ decimals: number;
37
+ };
38
+ };
39
+ recipient: string;
40
+ amount: number;
41
+ }): Promise<unknown>;
42
+ }
43
+ export interface PayToNameOptions extends Omit<CreatePaymentOptions, "to"> {
44
+ /** ENS name or plain address to pay. */
45
+ to: string;
46
+ }
47
+ /**
48
+ * Resolve a name and pay it via AppKit Pay.
49
+ *
50
+ * ```ts
51
+ * import * as appkitPay from "@reown/appkit-pay";
52
+ * await payToName(publicClient, appkitPay, {
53
+ * to: "coffee.w-pay.eth", amount: 15, currency: "USDC",
54
+ * });
55
+ * ```
56
+ *
57
+ * The AppKit module is injected rather than imported so this package adds no
58
+ * hard dependency on a specific AppKit version, and so it can be tested with a
59
+ * stub.
60
+ */
61
+ export declare function payToName(client: PublicClient, appkit: AppKitPayLike, options: PayToNameOptions): Promise<{
62
+ intent: PaymentIntent;
63
+ result: unknown;
64
+ }>;
65
+ /**
66
+ * Resolve without paying — useful for showing the payee and the exact target
67
+ * chain/token in a confirmation UI before the wallet opens.
68
+ */
69
+ export declare function previewPayment(client: PublicClient, options: PayToNameOptions): Promise<PaymentIntent>;
70
+ export type { PaymentIntent };
71
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAiB,KAAK,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1F,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,OAAO,EAAE;QACX,YAAY,EAAE;YACZ,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,QAAQ,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAA;aAAE,CAAC;SAC9D,CAAC;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC;IACxE,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAIrD;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAExB;AAED,YAAY,EAAE,aAAa,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @w-pay/appkit — pay an ENS name with Reown AppKit Pay.
3
+ *
4
+ * ## Why this is a wrapper and not a plugin
5
+ *
6
+ * AppKit Pay has no provider, plugin, or middleware registration API. Its
7
+ * exports are `pay`, `openPay`, `getPayResult`, `getPayError`,
8
+ * `getIsPaymentInProgress` and `getExchanges` — there is no `.use()` and no
9
+ * resolver hook. The headless WalletConnect Pay SDK does have an injectable
10
+ * "seams" system, but the set is closed (`transport`, `wallet`, `clock`,
11
+ * `telemetry`, plus a signing strategy) and contains no identity seam.
12
+ *
13
+ * Worse for our purposes, `pay()` validates the recipient with
14
+ * `CoreHelperUtil.isAddress()` and THROWS on anything that is not a plain
15
+ * address — so passing an ENS name directly is not merely unsupported, it is
16
+ * an error. On the merchant side, WalletConnect Pay's `CreatePayment` request
17
+ * has no recipient field at all; the payee is the onboarded merchant's
18
+ * configured settlement destination.
19
+ *
20
+ * So the only correct integration is outside-in: resolve the name to
21
+ * `{chainId, token, address}` first, then hand `pay()` a plain address. That is
22
+ * exactly what this package does, in about thirty lines. It needs nobody's
23
+ * permission and works against every version of AppKit that ships `pay()`.
24
+ */
25
+ import { createPayment } from "@w-pay/sdk";
26
+ /**
27
+ * Resolve a name and pay it via AppKit Pay.
28
+ *
29
+ * ```ts
30
+ * import * as appkitPay from "@reown/appkit-pay";
31
+ * await payToName(publicClient, appkitPay, {
32
+ * to: "coffee.w-pay.eth", amount: 15, currency: "USDC",
33
+ * });
34
+ * ```
35
+ *
36
+ * The AppKit module is injected rather than imported so this package adds no
37
+ * hard dependency on a specific AppKit version, and so it can be tested with a
38
+ * stub.
39
+ */
40
+ export async function payToName(client, appkit, options) {
41
+ const intent = await createPayment(client, options);
42
+ const result = await appkit.pay(intent.appkitPayArgs);
43
+ return { intent, result };
44
+ }
45
+ /**
46
+ * Resolve without paying — useful for showing the payee and the exact target
47
+ * chain/token in a confirmation UI before the wallet opens.
48
+ */
49
+ export async function previewPayment(client, options) {
50
+ return createPayment(client, options);
51
+ }
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@w-pay/appkit",
3
+ "version": "0.1.0",
4
+ "description": "Pay an ENS name with Reown AppKit Pay. Resolves the name, then calls pay() with a plain address.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit"
23
+ },
24
+ "peerDependencies": {
25
+ "@reown/appkit-pay": ">=1.8.0",
26
+ "@w-pay/sdk": "^0.1.0",
27
+ "viem": "^2.21.0"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "^5.7.2",
31
+ "viem": "^2.52.0"
32
+ },
33
+ "license": "MIT",
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/RWA-ID/w-pay-eth.git",
40
+ "directory": "packages/appkit"
41
+ },
42
+ "homepage": "https://github.com/RWA-ID/w-pay-eth/tree/main/packages/appkit#readme",
43
+ "bugs": {
44
+ "url": "https://github.com/RWA-ID/w-pay-eth/issues"
45
+ },
46
+ "keywords": [
47
+ "ens",
48
+ "payments",
49
+ "reown",
50
+ "appkit",
51
+ "walletconnect",
52
+ "ethereum",
53
+ "identity"
54
+ ]
55
+ }