@defuse-protocol/nearintents-mpp-sdk 0.0.0 → 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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -0
  3. package/dist/Errors.d.ts +57 -0
  4. package/dist/Errors.d.ts.map +1 -0
  5. package/dist/Errors.js +54 -0
  6. package/dist/Errors.js.map +1 -0
  7. package/dist/Methods.d.ts +44 -0
  8. package/dist/Methods.d.ts.map +1 -0
  9. package/dist/Methods.js +23 -0
  10. package/dist/Methods.js.map +1 -0
  11. package/dist/Types.d.ts +125 -0
  12. package/dist/Types.d.ts.map +1 -0
  13. package/dist/Types.js +195 -0
  14. package/dist/Types.js.map +1 -0
  15. package/dist/client/Charge.d.ts +141 -0
  16. package/dist/client/Charge.d.ts.map +1 -0
  17. package/dist/client/Charge.js +167 -0
  18. package/dist/client/Charge.js.map +1 -0
  19. package/dist/client/index.d.ts +5 -0
  20. package/dist/client/index.d.ts.map +1 -0
  21. package/dist/client/index.js +5 -0
  22. package/dist/client/index.js.map +1 -0
  23. package/dist/index.d.ts +5 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +5 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/internal/OneClick.d.ts +243 -0
  28. package/dist/internal/OneClick.d.ts.map +1 -0
  29. package/dist/internal/OneClick.js +422 -0
  30. package/dist/internal/OneClick.js.map +1 -0
  31. package/dist/server/Charge.d.ts +241 -0
  32. package/dist/server/Charge.d.ts.map +1 -0
  33. package/dist/server/Charge.js +404 -0
  34. package/dist/server/Charge.js.map +1 -0
  35. package/dist/server/index.d.ts +5 -0
  36. package/dist/server/index.d.ts.map +1 -0
  37. package/dist/server/index.js +5 -0
  38. package/dist/server/index.js.map +1 -0
  39. package/package.json +87 -9
  40. package/src/Errors.ts +86 -0
  41. package/src/Methods.ts +24 -0
  42. package/src/Types.ts +256 -0
  43. package/src/client/Charge.ts +268 -0
  44. package/src/client/index.ts +4 -0
  45. package/src/index.ts +4 -0
  46. package/src/internal/OneClick.ts +634 -0
  47. package/src/server/Charge.ts +621 -0
  48. package/src/server/index.ts +4 -0
package/dist/Types.js ADDED
@@ -0,0 +1,195 @@
1
+ import { Receipt, z } from 'mppx';
2
+ /** Payment method name for `nearintents` challenges. */
3
+ export const paymentMethod = 'nearintents';
4
+ /** Payment intent name for one-time cross-chain charges. */
5
+ export const chargeIntent = 'charge';
6
+ /** `methodDetails.settlementBackend` disclosure value for this method. */
7
+ export const settlementBackend = 'near-intents';
8
+ /** Credential types supported by this method (spec: the only valid value is "hash"). */
9
+ export const credentialTypes = ['hash'];
10
+ // ---------------------------------------------------------------------------
11
+ // CAIP-2 / CAIP-19 identifiers
12
+ //
13
+ // The wire format uses CAIP-19 for `currency` and `methodDetails.destinationAsset`
14
+ // and CAIP-2 for `methodDetails.originNetwork` / `methodDetails.destinationNetwork`.
15
+ // Identifiers MUST be compared by parsed components, with the asset reference
16
+ // compared in the chain's canonical form (EVM addresses case-insensitively).
17
+ // ---------------------------------------------------------------------------
18
+ const caip2Regex = /^([-a-z0-9]{3,8}):([-_a-zA-Z0-9]{1,32})$/;
19
+ const caip19Regex = /^([-a-z0-9]{3,8}):([-_a-zA-Z0-9]{1,32})\/([-a-z0-9]{3,8}):([-.%a-zA-Z0-9]{1,128})$/;
20
+ /** Parses a CAIP-2 chain identifier (e.g. `eip155:42161`). Throws on invalid input. */
21
+ export function parseCaip2(id) {
22
+ const match = caip2Regex.exec(id);
23
+ if (!match)
24
+ throw new Error(`Invalid CAIP-2 chain identifier: "${id}".`);
25
+ return { namespace: match[1], reference: match[2] };
26
+ }
27
+ /** Parses a CAIP-19 asset identifier (e.g. `eip155:42161/erc20:0xaf88…`). Throws on invalid input. */
28
+ export function parseCaip19(id) {
29
+ const match = caip19Regex.exec(id);
30
+ if (!match)
31
+ throw new Error(`Invalid CAIP-19 asset identifier: "${id}".`);
32
+ return {
33
+ chain: { namespace: match[1], reference: match[2] },
34
+ assetNamespace: match[3],
35
+ assetReference: match[4],
36
+ };
37
+ }
38
+ /** Returns the CAIP-2 chain component of a CAIP-19 asset identifier. */
39
+ export function chainOf(assetId) {
40
+ const { chain } = parseCaip19(assetId);
41
+ return `${chain.namespace}:${chain.reference}`;
42
+ }
43
+ /**
44
+ * Non-throwing {@link chainOf} for schema refines: zod runs object-level
45
+ * checks even when a field-level check already failed, so a malformed
46
+ * CAIP-19 must yield `false` (a normal validation issue), not an exception.
47
+ */
48
+ function chainOfSafe(assetId) {
49
+ try {
50
+ return chainOf(assetId);
51
+ }
52
+ catch {
53
+ return undefined;
54
+ }
55
+ }
56
+ /** Compares two CAIP-2 identifiers by parsed components. */
57
+ export function networkEqual(a, b) {
58
+ let left;
59
+ let right;
60
+ try {
61
+ left = parseCaip2(a);
62
+ right = parseCaip2(b);
63
+ }
64
+ catch {
65
+ return false;
66
+ }
67
+ return left.namespace === right.namespace && left.reference === right.reference;
68
+ }
69
+ /**
70
+ * Compares two CAIP-19 identifiers by parsed components.
71
+ *
72
+ * The asset reference is compared in the chain's canonical form: for `eip155`
73
+ * chains (hex addresses) the comparison is case-insensitive; for all other
74
+ * chains it is exact (e.g. base58 references are case-sensitive).
75
+ */
76
+ export function assetEqual(a, b) {
77
+ let left;
78
+ let right;
79
+ try {
80
+ left = parseCaip19(a);
81
+ right = parseCaip19(b);
82
+ }
83
+ catch {
84
+ return false;
85
+ }
86
+ if (left.chain.namespace !== right.chain.namespace)
87
+ return false;
88
+ if (left.chain.reference !== right.chain.reference)
89
+ return false;
90
+ if (left.assetNamespace !== right.assetNamespace)
91
+ return false;
92
+ if (left.chain.namespace === 'eip155')
93
+ return left.assetReference.toLowerCase() === right.assetReference.toLowerCase();
94
+ return left.assetReference === right.assetReference;
95
+ }
96
+ /** Formats a payer identity as a `did:pkh` source (CAIP-2 network + payer address). */
97
+ export function toSource(parameters) {
98
+ return `did:pkh:${parameters.network}:${parameters.address}`;
99
+ }
100
+ // ---------------------------------------------------------------------------
101
+ // Schemas
102
+ // ---------------------------------------------------------------------------
103
+ /** Base-unit integer amount (e.g. "1000000" for 1 USDC at 6 decimals). */
104
+ export function atomicAmount() {
105
+ return z.string().check(z.regex(/^\d+$/, 'Invalid base-unit amount'));
106
+ }
107
+ /** CAIP-2 chain identifier string. */
108
+ export function caip2() {
109
+ return z.string().check(z.regex(caip2Regex, 'Invalid CAIP-2 chain identifier'));
110
+ }
111
+ /** CAIP-19 asset identifier string. */
112
+ export function caip19() {
113
+ return z.string().check(z.regex(caip19Regex, 'Invalid CAIP-19 asset identifier'));
114
+ }
115
+ /** NEAR Intents-specific `methodDetails` for the charge request (spec §Method Details). */
116
+ export const MethodDetailsSchema = z.object({
117
+ /** CAIP-2 identifier of the origin chain (where `recipient` lives and the deposit tx is anchored). */
118
+ originNetwork: caip2(),
119
+ /** CAIP-2 identifier of the chain where the merchant receives the destination asset. */
120
+ destinationNetwork: caip2(),
121
+ /** Destination asset the merchant receives, as CAIP-19; chain component MUST equal `destinationNetwork`. */
122
+ destinationAsset: caip19(),
123
+ /** Merchant address on the destination chain that receives `amountOut`. */
124
+ destinationRecipient: z.string().check(z.minLength(1)),
125
+ /** Exact amount the merchant receives, in base units of `destinationAsset` (EXACT_OUTPUT). */
126
+ amountOut: atomicAmount(),
127
+ /** Minimum deposit the backend accepts, in base units of `currency` — the verification threshold. */
128
+ minAmountIn: atomicAmount(),
129
+ /** Deposit memo required by some origin chains (e.g. Stellar). Absent or null when not required. */
130
+ depositMemo: z.optional(z.nullable(z.string())),
131
+ /** Slippage tolerance in basis points (e.g. 100 = 1%). */
132
+ slippageTolerance: z.optional(z.number()),
133
+ /** Estimated swap completion time in seconds, from the 1Click quote. */
134
+ timeEstimate: z.optional(z.number()),
135
+ /** Origin-chain address refunded if the swap fails or excess exists. */
136
+ refundTo: z.string().check(z.minLength(1)),
137
+ /** Settlement backend disclosure. Always "near-intents" for this method. */
138
+ settlementBackend: z.optional(z.literal(settlementBackend)),
139
+ /** Ordered list of accepted credential types. Only "hash" is valid for this method. */
140
+ credentialTypes: z.optional(z.array(z.literal('hash')).check(z.minLength(1))),
141
+ });
142
+ /**
143
+ * Canonical `nearintents` charge request (the decoded challenge `request` parameter).
144
+ *
145
+ * The standard fields describe the payment the client makes on the origin
146
+ * chain (`recipient` is the single-use 1Click deposit address); the merchant's
147
+ * destination leg is carried in `methodDetails`.
148
+ */
149
+ export const ChargeRequestSchema = z
150
+ .object({
151
+ /**
152
+ * Deposit amount the client is asked to send, in base units of `currency`:
153
+ * the quote's maximum input that guarantees the merchant receives
154
+ * `methodDetails.amountOut` (the spec calls this `maxAmountIn`; the 1Click
155
+ * quote response field is `amountIn`).
156
+ */
157
+ amount: atomicAmount(),
158
+ /** Source asset the client pays with, as CAIP-19; chain component MUST equal `methodDetails.originNetwork`. */
159
+ currency: caip19(),
160
+ /** 1Click deposit address on the origin chain — the payee of the client's on-chain transfer. */
161
+ recipient: z.string().check(z.minLength(1)),
162
+ /** Human-readable payment description. MUST NOT be relied upon for verification. */
163
+ description: z.optional(z.string()),
164
+ /** Merchant reference (order ID, invoice number, etc.). */
165
+ externalId: z.optional(z.string()),
166
+ methodDetails: MethodDetailsSchema,
167
+ })
168
+ .check(z.refine((request) => {
169
+ const chain = chainOfSafe(request.currency);
170
+ return chain !== undefined && networkEqual(chain, request.methodDetails.originNetwork);
171
+ }, 'currency chain component must equal methodDetails.originNetwork'), z.refine((request) => {
172
+ const chain = chainOfSafe(request.methodDetails.destinationAsset);
173
+ return chain !== undefined && networkEqual(chain, request.methodDetails.destinationNetwork);
174
+ }, 'destinationAsset chain component must equal methodDetails.destinationNetwork'));
175
+ /** Push-mode credential payload: the confirmed origin-chain deposit transaction hash. */
176
+ export const HashPayloadSchema = z.object({
177
+ type: z.literal('hash'),
178
+ /** Transaction hash of the client's deposit on `methodDetails.originNetwork` (chain-native format). */
179
+ hash: z.string().check(z.minLength(1)),
180
+ });
181
+ /** Builds a spec-conformant `nearintents` receipt through `Receipt.from`. */
182
+ export function toReceipt(parameters) {
183
+ const { challengeId, destinationNetwork, externalId, originTxHash, reference } = parameters;
184
+ return Receipt.from({
185
+ method: paymentMethod,
186
+ reference,
187
+ status: 'success',
188
+ timestamp: parameters.timestamp ?? new Date().toISOString(),
189
+ challengeId,
190
+ originTxHash,
191
+ ...(destinationNetwork !== undefined && { destinationNetwork }),
192
+ ...(externalId !== undefined && { externalId }),
193
+ });
194
+ }
195
+ //# sourceMappingURL=Types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.js","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,MAAM,CAAA;AAEjC,wDAAwD;AACxD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAsB,CAAA;AAEnD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,QAAiB,CAAA;AAE7C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAuB,CAAA;AAExD,wFAAwF;AACxF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,CAAU,CAAA;AAEhD,8EAA8E;AAC9E,+BAA+B;AAC/B,EAAE;AACF,mFAAmF;AACnF,qFAAqF;AACrF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAE9E,MAAM,UAAU,GAAG,0CAA0C,CAAA;AAC7D,MAAM,WAAW,GACf,oFAAoF,CAAA;AAetF,uFAAuF;AACvF,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACjC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAA;IACxE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,CAAA;AACvD,CAA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yF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,uGAAuG;IACvG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC,CAAA;AAwBF,6EAA6E;AAC7E,MAAM,UAAU,SAAS,CAAC,UAQzB;IACC,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,UAAU,CAAA;IAC3F,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,MAAM,EAAE,aAAa;QACrB,SAAS;QACT,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC3D,WAAW;QACX,YAAY;QACZ,GAAG,CAAC,kBAAkB,KAAK,SAAS,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAC/D,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,CAAC;KAChD,CAAuB,CAAA;AAC1B,CAAC"}
@@ -0,0 +1,141 @@
1
+ import { Method, z } from 'mppx';
2
+ import * as Types from '../Types.js';
3
+ /**
4
+ * Creates a `nearintents` charge method for usage on the client.
5
+ *
6
+ * The client pays before delivery, so the spec's client-side MUSTs are
7
+ * enforced as assertions: the challenge request is schema-validated, `expires`
8
+ * is refused when passed, and the configured payment policy (allowed origin
9
+ * networks/assets, per-asset `maxAmountIn` caps, expected destination leg) is
10
+ * checked before any deposit is made.
11
+ *
12
+ * The deposit itself is provided one of three ways (first match wins):
13
+ * 1. `context.hash` — the deposit was already broadcast; present its tx hash.
14
+ * 2. `sendDeposit` — a callback that pays the origin-chain leg and resolves
15
+ * with the confirmed tx hash (bring-your-own-chain).
16
+ * 3. `walletClient` (config or context) — built-in EVM broadcast for
17
+ * `eip155:*` origins (native transfers and ERC-20 `transfer`); any viem
18
+ * WalletClient extended with public actions satisfies the interface.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { Mppx } from 'mppx/client'
23
+ * import { nearintents } from '@defuse-protocol/nearintents-mpp-sdk/client'
24
+ *
25
+ * const mppx = Mppx.create({
26
+ * methods: [
27
+ * nearintents.charge({
28
+ * walletClient,
29
+ * policy: {
30
+ * allowedOriginNetworks: ['eip155:42161'],
31
+ * maxAmountIn: { 'eip155:42161/erc20:0xaf88…5831': '5000000' },
32
+ * },
33
+ * }),
34
+ * ],
35
+ * })
36
+ * const response = await mppx.fetch('https://api.example.com/paid-resource')
37
+ * ```
38
+ */
39
+ export declare function charge(parameters?: charge.Parameters): Method.Client<{
40
+ readonly name: "nearintents";
41
+ readonly intent: "charge";
42
+ readonly schema: {
43
+ readonly credential: {
44
+ readonly payload: z.ZodMiniObject<{
45
+ type: z.ZodMiniLiteral<"hash">;
46
+ hash: z.ZodMiniString<string>;
47
+ }, z.core.$strip>;
48
+ };
49
+ readonly request: z.ZodMiniObject<{
50
+ amount: z.ZodMiniString<string>;
51
+ currency: z.ZodMiniString<string>;
52
+ recipient: z.ZodMiniString<string>;
53
+ description: z.ZodMiniOptional<z.ZodMiniString<string>>;
54
+ externalId: z.ZodMiniOptional<z.ZodMiniString<string>>;
55
+ methodDetails: z.ZodMiniObject<{
56
+ originNetwork: z.ZodMiniString<string>;
57
+ destinationNetwork: z.ZodMiniString<string>;
58
+ destinationAsset: z.ZodMiniString<string>;
59
+ destinationRecipient: z.ZodMiniString<string>;
60
+ amountOut: z.ZodMiniString<string>;
61
+ minAmountIn: z.ZodMiniString<string>;
62
+ depositMemo: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
63
+ slippageTolerance: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
64
+ timeEstimate: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
65
+ refundTo: z.ZodMiniString<string>;
66
+ settlementBackend: z.ZodMiniOptional<z.ZodMiniLiteral<"near-intents">>;
67
+ credentialTypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniLiteral<"hash">>>;
68
+ }, z.core.$strip>;
69
+ }, z.core.$strip>;
70
+ };
71
+ }, z.ZodMiniObject<{
72
+ hash: z.ZodMiniOptional<z.ZodMiniString<string>>;
73
+ walletClient: z.ZodMiniOptional<z.ZodMiniCustom<charge.EvmWalletClient, charge.EvmWalletClient>>;
74
+ }, z.core.$strip>>;
75
+ export declare namespace charge {
76
+ /**
77
+ * Payment policy — the client's safety surface (it pays before delivery).
78
+ * Every configured list is an allowlist; `maxAmountIn` entries double as a
79
+ * currency allowlist when present.
80
+ */
81
+ type Policy = {
82
+ /** CAIP-2 origin networks the client is willing to pay on. */
83
+ allowedOriginNetworks?: readonly string[] | undefined;
84
+ /** CAIP-19 source assets the client is willing to pay with. */
85
+ allowedCurrencies?: readonly string[] | undefined;
86
+ /**
87
+ * Per-asset deposit caps in base units, keyed by CAIP-19 id. When set,
88
+ * a challenge whose `currency` has no entry is refused.
89
+ */
90
+ maxAmountIn?: Record<string, string> | undefined;
91
+ /** Expected merchant destination leg; mismatches are refused. */
92
+ expectedDestination?: {
93
+ destinationAsset?: string | undefined;
94
+ destinationRecipient?: string | undefined;
95
+ amountOut?: string | undefined;
96
+ } | undefined;
97
+ };
98
+ /**
99
+ * Minimal EVM wallet surface for the built-in `eip155:*` deposit broadcast.
100
+ * A viem `WalletClient` created with `account` and `chain` (so both default
101
+ * per call) and extended with public actions satisfies it;
102
+ * `waitForTransactionReceipt` is optional but strongly recommended — the
103
+ * spec expects a *confirmed* deposit hash.
104
+ */
105
+ type EvmWalletClient = {
106
+ account?: {
107
+ address: string;
108
+ } | undefined;
109
+ chain?: {
110
+ id: number;
111
+ } | undefined;
112
+ sendTransaction: (args: {
113
+ to: `0x${string}`;
114
+ value?: bigint | undefined;
115
+ data?: `0x${string}` | undefined;
116
+ }) => Promise<string>;
117
+ waitForTransactionReceipt?: ((args: {
118
+ hash: `0x${string}`;
119
+ }) => Promise<{
120
+ status?: string | undefined;
121
+ }>) | undefined;
122
+ };
123
+ type SendDeposit = (parameters: {
124
+ challenge: {
125
+ id: string;
126
+ expires?: string | undefined;
127
+ };
128
+ request: Types.ChargeRequest;
129
+ }) => Promise<string>;
130
+ type Parameters = {
131
+ /** Payment policy asserted before every deposit. */
132
+ policy?: Policy | undefined;
133
+ /** Pays the origin-chain leg and resolves with the confirmed tx hash. */
134
+ sendDeposit?: SendDeposit | undefined;
135
+ /** EVM wallet for the built-in `eip155:*` broadcast. */
136
+ walletClient?: EvmWalletClient | undefined;
137
+ /** Payer DID for the credential `source` (defaults to did:pkh from the wallet). */
138
+ source?: string | undefined;
139
+ };
140
+ }
141
+ //# sourceMappingURL=Charge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Charge.d.ts","sourceRoot":"","sources":["../../src/client/Charge.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,MAAM,EAAE,CAAC,EAAE,MAAM,MAAM,CAAA;AAG7D,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,MAAM,CAAC,UAAU,GAAE,MAAM,CAAC,UAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA0DxD;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B;;;;OAIG;IACH,KAAK,MAAM,GAAG;QACZ,8DAA8D;QAC9D,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;QACrD,+DAA+D;QAC/D,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;QACjD;;;WAGG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;QAChD,iEAAiE;QACjE,mBAAm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AwD;QACxD,YAAY,CAAC,EAAE,eAAe,GAAG,SAAS,CAAA;QAC1C,mFAAmF;QACnF,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC5B,CAAA;CACF"}
@@ -0,0 +1,167 @@
1
+ import { Credential, Errors, Expires, Method, z } from 'mppx';
2
+ import * as Methods from '../Methods.js';
3
+ import * as Types from '../Types.js';
4
+ /**
5
+ * Creates a `nearintents` charge method for usage on the client.
6
+ *
7
+ * The client pays before delivery, so the spec's client-side MUSTs are
8
+ * enforced as assertions: the challenge request is schema-validated, `expires`
9
+ * is refused when passed, and the configured payment policy (allowed origin
10
+ * networks/assets, per-asset `maxAmountIn` caps, expected destination leg) is
11
+ * checked before any deposit is made.
12
+ *
13
+ * The deposit itself is provided one of three ways (first match wins):
14
+ * 1. `context.hash` — the deposit was already broadcast; present its tx hash.
15
+ * 2. `sendDeposit` — a callback that pays the origin-chain leg and resolves
16
+ * with the confirmed tx hash (bring-your-own-chain).
17
+ * 3. `walletClient` (config or context) — built-in EVM broadcast for
18
+ * `eip155:*` origins (native transfers and ERC-20 `transfer`); any viem
19
+ * WalletClient extended with public actions satisfies the interface.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { Mppx } from 'mppx/client'
24
+ * import { nearintents } from '@defuse-protocol/nearintents-mpp-sdk/client'
25
+ *
26
+ * const mppx = Mppx.create({
27
+ * methods: [
28
+ * nearintents.charge({
29
+ * walletClient,
30
+ * policy: {
31
+ * allowedOriginNetworks: ['eip155:42161'],
32
+ * maxAmountIn: { 'eip155:42161/erc20:0xaf88…5831': '5000000' },
33
+ * },
34
+ * }),
35
+ * ],
36
+ * })
37
+ * const response = await mppx.fetch('https://api.example.com/paid-resource')
38
+ * ```
39
+ */
40
+ export function charge(parameters = {}) {
41
+ return Method.toClient(Methods.charge, {
42
+ context: z.object({
43
+ /** Tx hash of an already-broadcast deposit (push mode, bring-your-own-broadcast). */
44
+ hash: z.optional(z.string()),
45
+ /** Per-request EVM wallet client (overrides the configured one). */
46
+ walletClient: z.optional(z.custom()),
47
+ }),
48
+ canHandleChallenge({ challenge }) {
49
+ if (challenge.method !== Types.paymentMethod || challenge.intent !== Types.chargeIntent)
50
+ return false;
51
+ const parsed = Types.ChargeRequestSchema.safeParse(challenge.request);
52
+ if (!parsed.success)
53
+ return false;
54
+ try {
55
+ assertPolicy(parameters.policy, parsed.data);
56
+ return true;
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ },
62
+ async createCredential({ challenge, context }) {
63
+ // Spec §Amount and Asset Verification: decode and verify the challenge
64
+ // request before paying; never rely on `description`.
65
+ const request = Types.ChargeRequestSchema.parse(challenge.request);
66
+ // Spec §Expiry: MUST NOT broadcast a deposit after `expires`.
67
+ Expires.assert(challenge.expires, challenge.id);
68
+ assertPolicy(parameters.policy, request);
69
+ const walletClient = context?.walletClient ?? parameters.walletClient;
70
+ const hash = await (async () => {
71
+ if (context?.hash)
72
+ return context.hash;
73
+ if (parameters.sendDeposit)
74
+ return parameters.sendDeposit({ challenge, request });
75
+ if (walletClient)
76
+ return broadcastEvmDeposit(walletClient, request);
77
+ throw new Error('nearintents-mpp-sdk: no way to pay — provide context.hash, a sendDeposit callback, or a walletClient.');
78
+ })();
79
+ const source = parameters.source ??
80
+ (walletClient?.account?.address
81
+ ? Types.toSource({
82
+ network: request.methodDetails.originNetwork,
83
+ address: walletClient.account.address,
84
+ })
85
+ : undefined);
86
+ return Credential.serialize(Credential.from({
87
+ challenge,
88
+ payload: { type: 'hash', hash },
89
+ ...(source && { source }),
90
+ }));
91
+ },
92
+ });
93
+ }
94
+ /** @internal */
95
+ function assertPolicy(policy, request) {
96
+ if (!policy)
97
+ return;
98
+ const { methodDetails } = request;
99
+ if (policy.allowedOriginNetworks &&
100
+ !policy.allowedOriginNetworks.some((network) => Types.networkEqual(network, methodDetails.originNetwork)))
101
+ throw new PolicyError(`origin network ${methodDetails.originNetwork} is not allowed`);
102
+ if (policy.allowedCurrencies &&
103
+ !policy.allowedCurrencies.some((asset) => Types.assetEqual(asset, request.currency)))
104
+ throw new PolicyError(`currency ${request.currency} is not allowed`);
105
+ if (policy.maxAmountIn) {
106
+ const cap = Object.entries(policy.maxAmountIn).find(([asset]) => Types.assetEqual(asset, request.currency))?.[1];
107
+ if (cap === undefined)
108
+ throw new PolicyError(`currency ${request.currency} has no maxAmountIn entry`);
109
+ if (BigInt(request.amount) > BigInt(cap))
110
+ throw new PolicyError(`amount ${request.amount} exceeds the ${cap} cap for this asset`);
111
+ }
112
+ const expected = policy.expectedDestination;
113
+ if (expected) {
114
+ if (expected.destinationAsset !== undefined &&
115
+ !Types.assetEqual(expected.destinationAsset, methodDetails.destinationAsset))
116
+ throw new PolicyError('destination asset does not match the expected destination');
117
+ if (expected.destinationRecipient !== undefined &&
118
+ expected.destinationRecipient !== methodDetails.destinationRecipient)
119
+ throw new PolicyError('destination recipient does not match the expected destination');
120
+ if (expected.amountOut !== undefined && expected.amountOut !== methodDetails.amountOut)
121
+ throw new PolicyError('amountOut does not match the expected destination');
122
+ }
123
+ }
124
+ /** @internal Policy violations map to invalid-payload problems client-side. */
125
+ class PolicyError extends Errors.PaymentError {
126
+ name = 'PolicyError';
127
+ title = 'Payment Policy Violation';
128
+ type = 'https://paymentauth.org/problems/invalid-payload';
129
+ constructor(reason) {
130
+ super(`Payment policy violation: ${reason}.`);
131
+ }
132
+ }
133
+ /** @internal Broadcasts the deposit for `eip155:*` origins and returns the confirmed hash. */
134
+ async function broadcastEvmDeposit(walletClient, request) {
135
+ const currency = Types.parseCaip19(request.currency);
136
+ if (currency.chain.namespace !== 'eip155')
137
+ throw new Error(`nearintents-mpp-sdk: the built-in wallet broadcast only supports eip155 origins (got ${request.methodDetails.originNetwork}); use sendDeposit or context.hash.`);
138
+ if (request.methodDetails.depositMemo != null)
139
+ throw new Error('nearintents-mpp-sdk: EVM deposits cannot carry a deposit memo.');
140
+ const expectedChainId = Number(currency.chain.reference);
141
+ if (walletClient.chain?.id !== expectedChainId)
142
+ throw new Error(`nearintents-mpp-sdk: wallet is on chain ${walletClient.chain?.id ?? 'unknown'} but the challenge origin is eip155:${expectedChainId}.`);
143
+ const amount = BigInt(request.amount);
144
+ const recipient = request.recipient;
145
+ // account/chain are intentionally omitted — the wallet's own defaults apply
146
+ // (and the chain-id assertion above already pinned the network).
147
+ const hash = await (async () => {
148
+ if (currency.assetNamespace === 'slip44')
149
+ return walletClient.sendTransaction({ to: recipient, value: amount });
150
+ // ERC-20 transfer(address,uint256) calldata — 0xa9059cbb + padded args.
151
+ const data = `0xa9059cbb${recipient.slice(2).toLowerCase().padStart(64, '0')}${amount.toString(16).padStart(64, '0')}`;
152
+ return walletClient.sendTransaction({
153
+ to: currency.assetReference,
154
+ data,
155
+ });
156
+ })();
157
+ // Present a *confirmed* hash when the client can wait for inclusion.
158
+ if (walletClient.waitForTransactionReceipt) {
159
+ const receipt = await walletClient.waitForTransactionReceipt({
160
+ hash: hash,
161
+ });
162
+ if (receipt.status && receipt.status !== 'success')
163
+ throw new Error(`nearintents-mpp-sdk: deposit transaction ${hash} reverted.`);
164
+ }
165
+ return hash;
166
+ }
167
+ //# sourceMappingURL=Charge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Charge.js","sourceRoot":"","sources":["../../src/client/Charge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,MAAM,CAAA;AAE7D,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,MAAM,CAAC,aAAgC,EAAE;IACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;QACrC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YAChB,qFAAqF;YACrF,IAAI,EAAE,CAAC,CAAC,QA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K,QAAQ;YACtC,OAAO,YAAY,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;QACvE,wEAAwE;QACxE,MAAM,IAAI,GACR,aAAa,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAmB,CAAA;QAC5H,OAAO,YAAY,CAAC,eAAe,CAAC;YAClC,EAAE,EAAE,QAAQ,CAAC,cAA+B;YAC5C,IAAI;SACL,CAAC,CAAA;IACJ,CAAC,CAAC,EAAE,CAAA;IAEJ,qEAAqE;IACrE,IAAI,YAAY,CAAC,yBAAyB,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,yBAAyB,CAAC;YAC3D,IAAI,EAAE,IAAqB;SAC5B,CAAC,CAAA;QACF,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAChD,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,YAAY,CAAC,CAAA;IACjF,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * as Errors from '../Errors.js';
2
+ export * as Methods from '../Methods.js';
3
+ export * as Types from '../Types.js';
4
+ export * as nearintents from './Charge.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,WAAW,MAAM,aAAa,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * as Errors from '../Errors.js';
2
+ export * as Methods from '../Methods.js';
3
+ export * as Types from '../Types.js';
4
+ export * as nearintents from './Charge.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,WAAW,MAAM,aAAa,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * as Errors from './Errors.js';
2
+ export * as OneClick from './internal/OneClick.js';
3
+ export * as Methods from './Methods.js';
4
+ export * as Types from './Types.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * as Errors from './Errors.js';
2
+ export * as OneClick from './internal/OneClick.js';
3
+ export * as Methods from './Methods.js';
4
+ export * as Types from './Types.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}