@strimz/sdk 0.1.0 → 0.2.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/README.md +109 -23
- package/dist/{browser-client-DlZg0Aae.d.cts → browser-client-BzLGc50J.d.cts} +27 -26
- package/dist/{browser-client-DlZg0Aae.d.ts → browser-client-BzLGc50J.d.ts} +27 -26
- package/dist/browser-client.cjs +38 -13
- package/dist/browser-client.cjs.map +1 -1
- package/dist/browser-client.d.cts +1 -1
- package/dist/browser-client.d.ts +1 -1
- package/dist/browser-client.js +39 -14
- package/dist/browser-client.js.map +1 -1
- package/dist/eip712.cjs +70 -0
- package/dist/eip712.cjs.map +1 -1
- package/dist/eip712.d.cts +110 -19
- package/dist/eip712.d.ts +110 -19
- package/dist/eip712.js +67 -1
- package/dist/eip712.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +4 -3
- package/dist/errors.d.ts +4 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.cjs +39 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -9
- package/dist/index.d.ts +8 -9
- package/dist/index.js +40 -15
- package/dist/index.js.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +3 -3
- package/dist/webhooks.d.ts +3 -3
- package/dist/webhooks.js.map +1 -1
- package/package.json +4 -4
- package/src/browser-client.ts +11 -11
- package/src/client.ts +4 -4
- package/src/eip712/index.ts +13 -13
- package/src/eip712/pay-intent.ts +54 -0
- package/src/eip712/permit.ts +8 -8
- package/src/eip712/receive-with-authorization.ts +6 -6
- package/src/eip712/subscription-intent.ts +59 -0
- package/src/eip712/types.ts +5 -4
- package/src/errors.ts +4 -3
- package/src/http/fetcher.ts +46 -11
- package/src/http/headers.ts +4 -4
- package/src/idempotency.ts +2 -3
- package/src/resources/checkout.ts +10 -3
- package/src/resources/tokens.ts +10 -11
- package/src/webhooks.ts +3 -3
package/dist/eip712.cjs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,IACjC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,SAAA,EAAU;AAAA,IACnC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,SAAA;AAAU;AAExC;AAOO,SAAS,qBAAqB,MAAA,EAAiD;AACpF,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ;AAAA,MACN,MAAM,MAAA,CAAO,SAAA;AAAA,MACb,SAAS,MAAA,CAAO,YAAA;AAAA,MAChB,SAAS,MAAA,CAAO,OAAA;AAAA,MAChB,mBAAmB,MAAA,CAAO;AAAA,KAC5B;AAAA,IACA,KAAA,EAAO,YAAA;AAAA,IACP,WAAA,EAAa,QAAA;AAAA,IACb,OAAA,EAAS;AAAA,MACP,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,OAAA;AAAA,MAChB,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,UAAU,MAAA,CAAO;AAAA;AACnB,GACF;AACF","file":"eip712.cjs","sourcesContent":["import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-3009 ReceiveWithAuthorization typed-data.\n *\n * - `chainId` is the EVM chain id (Arc Testnet = 5042002).\n * - `token` is the ERC-20 contract whose `receiveWithAuthorization` is\n * being invoked — usually USDC at `0x36...` on Arc.\n * - `tokenName` and `tokenVersion` form the EIP-712 domain. Real USDC\n * on most chains uses `name=\"USD Coin\"` and `version=\"2\"`; tests\n * use whatever the mock token reports. Always read these from the\n * token contract at runtime to avoid drift.\n * - `from` is the payer; the wallet that produces the signature must\n * match this address.\n * - `to` is the recipient of the funds — for Strimz this is the\n * StrimzPayments contract address (the contract pulls funds into\n * itself, then forwards the fee + net split).\n * - `value` is the gross amount in token base units.\n * - `validAfter` / `validBefore` are unix-second timestamps bounding\n * the signature's validity. Strimz's default checkout window is\n * 5 minutes; integrators may widen this for usage-based billing.\n * - `nonce` is a single-use 32-byte value. Generate with crypto.randomBytes\n * (server) or crypto.getRandomValues (browser). The token contract\n * tracks `(authorizer, nonce) -> used` and rejects replays.\n */\nexport interface ReceiveWithAuthorizationParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n from: `0x${string}`\n to: `0x${string}`\n value: bigint\n validAfter: bigint\n validBefore: bigint\n nonce: `0x${string}`\n}\n\n/**\n * EIP-712 type definition for `ReceiveWithAuthorization`. Stable —\n * shared by every EIP-3009 implementation (USDC, EURC, etc.).\n *\n * Exported so consumers can introspect or extend with sibling\n * primitive types (e.g. for x402 batched signing schemes that wrap\n * multiple authorizations in one signature).\n */\nexport const RECEIVE_WITH_AUTHORIZATION_TYPES = {\n ReceiveWithAuthorization: [\n { name: 'from', type: 'address' },\n { name: 'to', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'validAfter', type: 'uint256' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-3009\n * `ReceiveWithAuthorization` signature. Returns the canonical shape\n * compatible with viem, ethers, Privy, and Reown.\n *\n * Pass the result to `walletClient.signTypedData(typedData)` (viem)\n * or `signer._signTypedData(domain, types, message)` (ethers) — the\n * SDK does not bind to a specific signer.\n */\nexport function buildReceiveWithAuthorizationTypedData(\n params: ReceiveWithAuthorizationParams,\n): Eip712TypedData<'ReceiveWithAuthorization'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: RECEIVE_WITH_AUTHORIZATION_TYPES,\n primaryType: 'ReceiveWithAuthorization',\n message: {\n from: params.from,\n to: params.to,\n value: params.value,\n validAfter: params.validAfter,\n validBefore: params.validBefore,\n nonce: params.nonce,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-2612 Permit typed-data.\n *\n * - `chainId`, `token`, `tokenName`, `tokenVersion` form the EIP-712\n * domain (same shape as the EIP-3009 builder).\n * - `owner` is the token holder authorising the allowance — must match\n * the signing wallet.\n * - `spender` is the contract that will pull funds — for Strimz\n * subscriptions this is the StrimzSubscriptions contract.\n * - `value` is the allowance to grant in token base units.\n * `type(uint256).max` produces an unlimited allowance and is the\n * common case for subscription enrolment.\n * - `nonce` is the owner's *current* `nonces(owner)` reading from the\n * token contract. The SDK does not fetch this — the caller is\n * expected to have just queried it. Race-free: the token rejects\n * stale nonces, so a concurrent permit on the same owner just\n * causes one to fail predictably.\n * - `deadline` is the unix-second timestamp after which the permit\n * expires. Strimz default for subscription enrolment is 24h —\n * enough headroom for a slow merchant submit pipeline without\n * leaving an indefinite signature window.\n */\nexport interface PermitParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n owner: `0x${string}`\n spender: `0x${string}`\n value: bigint\n nonce: bigint\n deadline: bigint\n}\n\n/**\n * EIP-712 type definition for `Permit`. Stable across every EIP-2612\n * implementation (USDC, EURC, DAI v2, etc.).\n */\nexport const PERMIT_TYPES = {\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-2612 `Permit` signature.\n * Returns the canonical shape compatible with viem, ethers, Privy,\n * and Reown.\n */\nexport function buildPermitTypedData(params: PermitParams): Eip712TypedData<'Permit'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: PERMIT_TYPES,\n primaryType: 'Permit',\n message: {\n owner: params.owner,\n spender: params.spender,\n value: params.value,\n nonce: params.nonce,\n deadline: params.deadline,\n },\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/eip712/receive-with-authorization.ts","../src/eip712/permit.ts","../src/eip712/pay-intent.ts","../src/eip712/subscription-intent.ts"],"names":[],"mappings":";;;AA8CO,IAAM,gCAAA,GAAmC;AAAA,EAC9C,wBAAA,EAA0B;AAAA,IACxB,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAU;AAAA,IAChC,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,SAAA,EAAU;AAAA,IAC9B,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,SAAA,EAAU;AAAA,IACtC,EAAE,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,SAAA,EAAU;AAAA,IACvC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA;AAAU;AAErC;AAWO,SAAS,uCACd,MAAA,EAC6C;AAC7C,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ;AAAA,MACN,MAAM,MAAA,CAAO,SAAA;AAAA,MACb,SAAS,MAAA,CAAO,YAAA;AAAA,MAChB,SAAS,MAAA,CAAO,OAAA;AAAA,MAChB,mBAAmB,MAAA,CAAO;AAAA,KAC5B;AAAA,IACA,KAAA,EAAO,gCAAA;AAAA,IACP,WAAA,EAAa,0BAAA;AAAA,IACb,OAAA,EAAS;AAAA,MACP,MAAM,MAAA,CAAO,IAAA;AAAA,MACb,IAAI,MAAA,CAAO,EAAA;AAAA,MACX,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,YAAY,MAAA,CAAO,UAAA;AAAA,MACnB,aAAa,MAAA,CAAO,WAAA;AAAA,MACpB,OAAO,MAAA,CAAO;AAAA;AAChB,GACF;AACF;;;AC/CO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ;AAAA,IACN,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE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;AAAA,KAC5B;AAAA,IACA,KAAA,EAAO,yBAAA;AAAA,IACP,WAAA,EAAa,oBAAA;AAAA,IACb,OAAA,EAAS;AAAA,MACP,YAAY,MAAA,CAAO,UAAA;AAAA,MACnB,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,QAAQ,MAAA,CAAO,MAAA;AAAA,MACf,UAAU,MAAA,CAAO,QAAA;AAAA,MACjB,SAAS,MAAA,CAAO,OAAA;AAAA,MAChB,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,gBAAgB,MAAA,CAAO;AAAA;AACzB,GACF;AACF","file":"eip712.cjs","sourcesContent":["import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-3009 ReceiveWithAuthorization typed-data.\n *\n * - `chainId` is the EVM chain id (Arc Testnet = 5042002).\n * - `token` is the ERC-20 contract whose `receiveWithAuthorization` is\n * being invoked. Usually USDC at `0x36...` on Arc.\n * - `tokenName` and `tokenVersion` form the EIP-712 domain. Real USDC\n * on most chains uses `name=\"USD Coin\"` and `version=\"2\"`; tests\n * use whatever the mock token reports. Always read these from the\n * token contract at runtime to avoid drift.\n * - `from` is the payer. The wallet that produces the signature must\n * match this address.\n * - `to` is the recipient of the funds. For Strimz this is the\n * StrimzPayments contract address (the contract pulls funds into\n * itself, then forwards the fee and net split).\n * - `value` is the gross amount in token base units.\n * - `validAfter` / `validBefore` are unix-second timestamps bounding\n * the signature's validity. Strimz's default checkout window is\n * 5 minutes; integrators may widen this for usage-based billing.\n * - `nonce` is a single-use 32-byte value. Generate with crypto.randomBytes\n * (server) or crypto.getRandomValues (browser). The token contract\n * tracks `(authorizer, nonce) -> used` and rejects replays.\n */\nexport interface ReceiveWithAuthorizationParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n from: `0x${string}`\n to: `0x${string}`\n value: bigint\n validAfter: bigint\n validBefore: bigint\n nonce: `0x${string}`\n}\n\n/**\n * EIP-712 type definition for `ReceiveWithAuthorization`. Stable, and\n * shared by every EIP-3009 implementation (USDC, EURC, etc.).\n *\n * Exported so consumers can introspect or extend with sibling\n * primitive types (e.g. for x402 batched signing schemes that wrap\n * multiple authorizations in one signature).\n */\nexport const RECEIVE_WITH_AUTHORIZATION_TYPES = {\n ReceiveWithAuthorization: [\n { name: 'from', type: 'address' },\n { name: 'to', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'validAfter', type: 'uint256' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-3009\n * `ReceiveWithAuthorization` signature. Returns the canonical shape\n * compatible with viem, ethers, Privy, and Reown.\n *\n * Pass the result to `walletClient.signTypedData(typedData)` (viem)\n * or `signer._signTypedData(domain, types, message)` (ethers). The\n * SDK does not bind to a specific signer.\n */\nexport function buildReceiveWithAuthorizationTypedData(\n params: ReceiveWithAuthorizationParams,\n): Eip712TypedData<'ReceiveWithAuthorization'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: RECEIVE_WITH_AUTHORIZATION_TYPES,\n primaryType: 'ReceiveWithAuthorization',\n message: {\n from: params.from,\n to: params.to,\n value: params.value,\n validAfter: params.validAfter,\n validBefore: params.validBefore,\n nonce: params.nonce,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-2612 Permit typed-data.\n *\n * - `chainId`, `token`, `tokenName`, `tokenVersion` form the EIP-712\n * domain (same shape as the EIP-3009 builder).\n * - `owner` is the token holder authorising the allowance. Must match\n * the signing wallet.\n * - `spender` is the contract that will pull funds. For Strimz\n * subscriptions this is the StrimzSubscriptions contract.\n * - `value` is the allowance to grant in token base units.\n * `type(uint256).max` produces an unlimited allowance and is the\n * common case for subscription enrolment.\n * - `nonce` is the owner's *current* `nonces(owner)` reading from the\n * token contract. The SDK does not fetch this. The caller is\n * expected to have just queried it. Race-free: the token rejects\n * stale nonces, so a concurrent permit on the same owner causes one\n * to fail predictably.\n * - `deadline` is the unix-second timestamp after which the permit\n * expires. Strimz default for subscription enrolment is 24h. Enough\n * headroom for a slow merchant submit pipeline without leaving an\n * indefinite signature window.\n */\nexport interface PermitParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n owner: `0x${string}`\n spender: `0x${string}`\n value: bigint\n nonce: bigint\n deadline: bigint\n}\n\n/**\n * EIP-712 type definition for `Permit`. Stable across every EIP-2612\n * implementation (USDC, EURC, DAI v2, etc.).\n */\nexport const PERMIT_TYPES = {\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-2612 `Permit` signature.\n * Returns the canonical shape compatible with viem, ethers, Privy,\n * and Reown.\n */\nexport function buildPermitTypedData(params: PermitParams): Eip712TypedData<'Permit'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: PERMIT_TYPES,\n primaryType: 'Permit',\n message: {\n owner: params.owner,\n spender: params.spender,\n value: params.value,\n nonce: params.nonce,\n deadline: params.deadline,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the Strimz PayIntent. Payer signs this alongside the\n * EIP-3009 auth. Without it, a valid auth sig can be redirected to\n * pay a different merchant.\n *\n * Every field must match the corresponding argument the API will\n * submit on-chain — the contract compares them via ecrecover.\n */\nexport interface PayIntentParams {\n chainId: number\n verifyingContract: `0x${string}`\n merchantId: bigint\n token: `0x${string}`\n amount: bigint\n nonce: `0x${string}`\n validBefore: bigint\n ref: `0x${string}`\n}\n\n/** Field order matches `PAY_INTENT_TYPEHASH` in `StrimzPayments.sol`. */\nexport const PAY_INTENT_TYPES = {\n PayIntent: [\n { name: 'merchantId', type: 'uint256' },\n { name: 'token', type: 'address' },\n { name: 'amount', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'ref', type: 'bytes32' },\n ],\n} as const\n\n/** Domain name + version mirror `EIP712(\"StrimzPayments\", \"1\")`. */\nexport function buildPayIntentTypedData(params: PayIntentParams): Eip712TypedData<'PayIntent'> {\n return {\n domain: {\n name: 'StrimzPayments',\n version: '1',\n chainId: params.chainId,\n verifyingContract: params.verifyingContract,\n },\n types: PAY_INTENT_TYPES,\n primaryType: 'PayIntent',\n message: {\n merchantId: params.merchantId,\n token: params.token,\n amount: params.amount,\n nonce: params.nonce,\n validBefore: params.validBefore,\n ref: params.ref,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the Strimz SubscriptionIntent. Payer signs this\n * alongside the ERC-2612 permit. Without it, a valid permit can be\n * used to enrol the payer in a plan they never picked.\n *\n * `permitDeadline` ties this intent to the accompanying permit —\n * they expire together.\n */\nexport interface SubscriptionIntentParams {\n chainId: number\n verifyingContract: `0x${string}`\n merchantId: bigint\n token: `0x${string}`\n amount: bigint\n interval: number\n startAt: bigint\n endAt: bigint\n permitDeadline: bigint\n}\n\n/** Field order matches `SUBSCRIPTION_INTENT_TYPEHASH` in the contract. */\nexport const SUBSCRIPTION_INTENT_TYPES = {\n SubscriptionIntent: [\n { name: 'merchantId', type: 'uint256' },\n { name: 'token', type: 'address' },\n { name: 'amount', type: 'uint256' },\n { name: 'interval', type: 'uint32' },\n { name: 'startAt', type: 'uint64' },\n { name: 'endAt', type: 'uint64' },\n { name: 'permitDeadline', type: 'uint256' },\n ],\n} as const\n\n/** Domain mirrors `EIP712(\"StrimzSubscriptions\", \"1\")`. */\nexport function buildSubscriptionIntentTypedData(\n params: SubscriptionIntentParams,\n): Eip712TypedData<'SubscriptionIntent'> {\n return {\n domain: {\n name: 'StrimzSubscriptions',\n version: '1',\n chainId: params.chainId,\n verifyingContract: params.verifyingContract,\n },\n types: SUBSCRIPTION_INTENT_TYPES,\n primaryType: 'SubscriptionIntent',\n message: {\n merchantId: params.merchantId,\n token: params.token,\n amount: params.amount,\n interval: params.interval,\n startAt: params.startAt,\n endAt: params.endAt,\n permitDeadline: params.permitDeadline,\n },\n }\n}\n"]}
|
package/dist/eip712.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical EIP-712 typed-data shape.
|
|
3
3
|
*
|
|
4
|
-
* Matches the structure every major wallet library accepts
|
|
4
|
+
* Matches the structure every major wallet library accepts:
|
|
5
5
|
* viem's `signTypedData`
|
|
6
6
|
* ethers' `signer._signTypedData`
|
|
7
7
|
* Privy's `signTypedData`
|
|
8
8
|
* Reown AppKit's typed-data RPC
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* The SDK can produce typed-data without binding to a specific wallet
|
|
11
|
+
* client. Consumers pipe the result into whichever signer they
|
|
11
12
|
* already use.
|
|
12
13
|
*
|
|
13
14
|
* No viem/ethers dependency on purpose: the SDK stays minimal, and
|
|
@@ -30,7 +31,7 @@ type Eip712Types = Record<string, readonly Eip712Field[]>;
|
|
|
30
31
|
* gets hashed at the top level (the `types` object usually contains
|
|
31
32
|
* additional referenced sub-structs).
|
|
32
33
|
*
|
|
33
|
-
* `bigint` is used for uint values
|
|
34
|
+
* `bigint` is used for uint values. Wallet libs handle the conversion
|
|
34
35
|
* to hex/decimal at signing time. If a consumer needs to JSON-serialise
|
|
35
36
|
* this object, convert bigints to strings at that boundary.
|
|
36
37
|
*/
|
|
@@ -46,16 +47,16 @@ interface Eip712TypedData<TPrimary extends string = string> {
|
|
|
46
47
|
*
|
|
47
48
|
* - `chainId` is the EVM chain id (Arc Testnet = 5042002).
|
|
48
49
|
* - `token` is the ERC-20 contract whose `receiveWithAuthorization` is
|
|
49
|
-
* being invoked
|
|
50
|
+
* being invoked. Usually USDC at `0x36...` on Arc.
|
|
50
51
|
* - `tokenName` and `tokenVersion` form the EIP-712 domain. Real USDC
|
|
51
52
|
* on most chains uses `name="USD Coin"` and `version="2"`; tests
|
|
52
53
|
* use whatever the mock token reports. Always read these from the
|
|
53
54
|
* token contract at runtime to avoid drift.
|
|
54
|
-
* - `from` is the payer
|
|
55
|
+
* - `from` is the payer. The wallet that produces the signature must
|
|
55
56
|
* match this address.
|
|
56
|
-
* - `to` is the recipient of the funds
|
|
57
|
+
* - `to` is the recipient of the funds. For Strimz this is the
|
|
57
58
|
* StrimzPayments contract address (the contract pulls funds into
|
|
58
|
-
* itself, then forwards the fee
|
|
59
|
+
* itself, then forwards the fee and net split).
|
|
59
60
|
* - `value` is the gross amount in token base units.
|
|
60
61
|
* - `validAfter` / `validBefore` are unix-second timestamps bounding
|
|
61
62
|
* the signature's validity. Strimz's default checkout window is
|
|
@@ -77,7 +78,7 @@ interface ReceiveWithAuthorizationParams {
|
|
|
77
78
|
nonce: `0x${string}`;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
|
-
* EIP-712 type definition for `ReceiveWithAuthorization`. Stable
|
|
81
|
+
* EIP-712 type definition for `ReceiveWithAuthorization`. Stable, and
|
|
81
82
|
* shared by every EIP-3009 implementation (USDC, EURC, etc.).
|
|
82
83
|
*
|
|
83
84
|
* Exported so consumers can introspect or extend with sibling
|
|
@@ -111,7 +112,7 @@ declare const RECEIVE_WITH_AUTHORIZATION_TYPES: {
|
|
|
111
112
|
* compatible with viem, ethers, Privy, and Reown.
|
|
112
113
|
*
|
|
113
114
|
* Pass the result to `walletClient.signTypedData(typedData)` (viem)
|
|
114
|
-
* or `signer._signTypedData(domain, types, message)` (ethers)
|
|
115
|
+
* or `signer._signTypedData(domain, types, message)` (ethers). The
|
|
115
116
|
* SDK does not bind to a specific signer.
|
|
116
117
|
*/
|
|
117
118
|
declare function buildReceiveWithAuthorizationTypedData(params: ReceiveWithAuthorizationParams): Eip712TypedData<'ReceiveWithAuthorization'>;
|
|
@@ -121,22 +122,22 @@ declare function buildReceiveWithAuthorizationTypedData(params: ReceiveWithAutho
|
|
|
121
122
|
*
|
|
122
123
|
* - `chainId`, `token`, `tokenName`, `tokenVersion` form the EIP-712
|
|
123
124
|
* domain (same shape as the EIP-3009 builder).
|
|
124
|
-
* - `owner` is the token holder authorising the allowance
|
|
125
|
+
* - `owner` is the token holder authorising the allowance. Must match
|
|
125
126
|
* the signing wallet.
|
|
126
|
-
* - `spender` is the contract that will pull funds
|
|
127
|
+
* - `spender` is the contract that will pull funds. For Strimz
|
|
127
128
|
* subscriptions this is the StrimzSubscriptions contract.
|
|
128
129
|
* - `value` is the allowance to grant in token base units.
|
|
129
130
|
* `type(uint256).max` produces an unlimited allowance and is the
|
|
130
131
|
* common case for subscription enrolment.
|
|
131
132
|
* - `nonce` is the owner's *current* `nonces(owner)` reading from the
|
|
132
|
-
* token contract. The SDK does not fetch this
|
|
133
|
+
* token contract. The SDK does not fetch this. The caller is
|
|
133
134
|
* expected to have just queried it. Race-free: the token rejects
|
|
134
|
-
* stale nonces, so a concurrent permit on the same owner
|
|
135
|
-
*
|
|
135
|
+
* stale nonces, so a concurrent permit on the same owner causes one
|
|
136
|
+
* to fail predictably.
|
|
136
137
|
* - `deadline` is the unix-second timestamp after which the permit
|
|
137
|
-
* expires. Strimz default for subscription enrolment is 24h
|
|
138
|
-
*
|
|
139
|
-
*
|
|
138
|
+
* expires. Strimz default for subscription enrolment is 24h. Enough
|
|
139
|
+
* headroom for a slow merchant submit pipeline without leaving an
|
|
140
|
+
* indefinite signature window.
|
|
140
141
|
*/
|
|
141
142
|
interface PermitParams {
|
|
142
143
|
chainId: number;
|
|
@@ -178,4 +179,94 @@ declare const PERMIT_TYPES: {
|
|
|
178
179
|
*/
|
|
179
180
|
declare function buildPermitTypedData(params: PermitParams): Eip712TypedData<'Permit'>;
|
|
180
181
|
|
|
181
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Inputs for the Strimz PayIntent. Payer signs this alongside the
|
|
184
|
+
* EIP-3009 auth. Without it, a valid auth sig can be redirected to
|
|
185
|
+
* pay a different merchant.
|
|
186
|
+
*
|
|
187
|
+
* Every field must match the corresponding argument the API will
|
|
188
|
+
* submit on-chain — the contract compares them via ecrecover.
|
|
189
|
+
*/
|
|
190
|
+
interface PayIntentParams {
|
|
191
|
+
chainId: number;
|
|
192
|
+
verifyingContract: `0x${string}`;
|
|
193
|
+
merchantId: bigint;
|
|
194
|
+
token: `0x${string}`;
|
|
195
|
+
amount: bigint;
|
|
196
|
+
nonce: `0x${string}`;
|
|
197
|
+
validBefore: bigint;
|
|
198
|
+
ref: `0x${string}`;
|
|
199
|
+
}
|
|
200
|
+
/** Field order matches `PAY_INTENT_TYPEHASH` in `StrimzPayments.sol`. */
|
|
201
|
+
declare const PAY_INTENT_TYPES: {
|
|
202
|
+
readonly PayIntent: readonly [{
|
|
203
|
+
readonly name: "merchantId";
|
|
204
|
+
readonly type: "uint256";
|
|
205
|
+
}, {
|
|
206
|
+
readonly name: "token";
|
|
207
|
+
readonly type: "address";
|
|
208
|
+
}, {
|
|
209
|
+
readonly name: "amount";
|
|
210
|
+
readonly type: "uint256";
|
|
211
|
+
}, {
|
|
212
|
+
readonly name: "nonce";
|
|
213
|
+
readonly type: "bytes32";
|
|
214
|
+
}, {
|
|
215
|
+
readonly name: "validBefore";
|
|
216
|
+
readonly type: "uint256";
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "ref";
|
|
219
|
+
readonly type: "bytes32";
|
|
220
|
+
}];
|
|
221
|
+
};
|
|
222
|
+
/** Domain name + version mirror `EIP712("StrimzPayments", "1")`. */
|
|
223
|
+
declare function buildPayIntentTypedData(params: PayIntentParams): Eip712TypedData<'PayIntent'>;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Inputs for the Strimz SubscriptionIntent. Payer signs this
|
|
227
|
+
* alongside the ERC-2612 permit. Without it, a valid permit can be
|
|
228
|
+
* used to enrol the payer in a plan they never picked.
|
|
229
|
+
*
|
|
230
|
+
* `permitDeadline` ties this intent to the accompanying permit —
|
|
231
|
+
* they expire together.
|
|
232
|
+
*/
|
|
233
|
+
interface SubscriptionIntentParams {
|
|
234
|
+
chainId: number;
|
|
235
|
+
verifyingContract: `0x${string}`;
|
|
236
|
+
merchantId: bigint;
|
|
237
|
+
token: `0x${string}`;
|
|
238
|
+
amount: bigint;
|
|
239
|
+
interval: number;
|
|
240
|
+
startAt: bigint;
|
|
241
|
+
endAt: bigint;
|
|
242
|
+
permitDeadline: bigint;
|
|
243
|
+
}
|
|
244
|
+
/** Field order matches `SUBSCRIPTION_INTENT_TYPEHASH` in the contract. */
|
|
245
|
+
declare const SUBSCRIPTION_INTENT_TYPES: {
|
|
246
|
+
readonly SubscriptionIntent: readonly [{
|
|
247
|
+
readonly name: "merchantId";
|
|
248
|
+
readonly type: "uint256";
|
|
249
|
+
}, {
|
|
250
|
+
readonly name: "token";
|
|
251
|
+
readonly type: "address";
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "amount";
|
|
254
|
+
readonly type: "uint256";
|
|
255
|
+
}, {
|
|
256
|
+
readonly name: "interval";
|
|
257
|
+
readonly type: "uint32";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "startAt";
|
|
260
|
+
readonly type: "uint64";
|
|
261
|
+
}, {
|
|
262
|
+
readonly name: "endAt";
|
|
263
|
+
readonly type: "uint64";
|
|
264
|
+
}, {
|
|
265
|
+
readonly name: "permitDeadline";
|
|
266
|
+
readonly type: "uint256";
|
|
267
|
+
}];
|
|
268
|
+
};
|
|
269
|
+
/** Domain mirrors `EIP712("StrimzSubscriptions", "1")`. */
|
|
270
|
+
declare function buildSubscriptionIntentTypedData(params: SubscriptionIntentParams): Eip712TypedData<'SubscriptionIntent'>;
|
|
271
|
+
|
|
272
|
+
export { type Eip712Domain, type Eip712Field, type Eip712TypedData, type Eip712Types, PAY_INTENT_TYPES, PERMIT_TYPES, type PayIntentParams, type PermitParams, RECEIVE_WITH_AUTHORIZATION_TYPES, type ReceiveWithAuthorizationParams, SUBSCRIPTION_INTENT_TYPES, type SubscriptionIntentParams, buildPayIntentTypedData, buildPermitTypedData, buildReceiveWithAuthorizationTypedData, buildSubscriptionIntentTypedData };
|
package/dist/eip712.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical EIP-712 typed-data shape.
|
|
3
3
|
*
|
|
4
|
-
* Matches the structure every major wallet library accepts
|
|
4
|
+
* Matches the structure every major wallet library accepts:
|
|
5
5
|
* viem's `signTypedData`
|
|
6
6
|
* ethers' `signer._signTypedData`
|
|
7
7
|
* Privy's `signTypedData`
|
|
8
8
|
* Reown AppKit's typed-data RPC
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* The SDK can produce typed-data without binding to a specific wallet
|
|
11
|
+
* client. Consumers pipe the result into whichever signer they
|
|
11
12
|
* already use.
|
|
12
13
|
*
|
|
13
14
|
* No viem/ethers dependency on purpose: the SDK stays minimal, and
|
|
@@ -30,7 +31,7 @@ type Eip712Types = Record<string, readonly Eip712Field[]>;
|
|
|
30
31
|
* gets hashed at the top level (the `types` object usually contains
|
|
31
32
|
* additional referenced sub-structs).
|
|
32
33
|
*
|
|
33
|
-
* `bigint` is used for uint values
|
|
34
|
+
* `bigint` is used for uint values. Wallet libs handle the conversion
|
|
34
35
|
* to hex/decimal at signing time. If a consumer needs to JSON-serialise
|
|
35
36
|
* this object, convert bigints to strings at that boundary.
|
|
36
37
|
*/
|
|
@@ -46,16 +47,16 @@ interface Eip712TypedData<TPrimary extends string = string> {
|
|
|
46
47
|
*
|
|
47
48
|
* - `chainId` is the EVM chain id (Arc Testnet = 5042002).
|
|
48
49
|
* - `token` is the ERC-20 contract whose `receiveWithAuthorization` is
|
|
49
|
-
* being invoked
|
|
50
|
+
* being invoked. Usually USDC at `0x36...` on Arc.
|
|
50
51
|
* - `tokenName` and `tokenVersion` form the EIP-712 domain. Real USDC
|
|
51
52
|
* on most chains uses `name="USD Coin"` and `version="2"`; tests
|
|
52
53
|
* use whatever the mock token reports. Always read these from the
|
|
53
54
|
* token contract at runtime to avoid drift.
|
|
54
|
-
* - `from` is the payer
|
|
55
|
+
* - `from` is the payer. The wallet that produces the signature must
|
|
55
56
|
* match this address.
|
|
56
|
-
* - `to` is the recipient of the funds
|
|
57
|
+
* - `to` is the recipient of the funds. For Strimz this is the
|
|
57
58
|
* StrimzPayments contract address (the contract pulls funds into
|
|
58
|
-
* itself, then forwards the fee
|
|
59
|
+
* itself, then forwards the fee and net split).
|
|
59
60
|
* - `value` is the gross amount in token base units.
|
|
60
61
|
* - `validAfter` / `validBefore` are unix-second timestamps bounding
|
|
61
62
|
* the signature's validity. Strimz's default checkout window is
|
|
@@ -77,7 +78,7 @@ interface ReceiveWithAuthorizationParams {
|
|
|
77
78
|
nonce: `0x${string}`;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
|
-
* EIP-712 type definition for `ReceiveWithAuthorization`. Stable
|
|
81
|
+
* EIP-712 type definition for `ReceiveWithAuthorization`. Stable, and
|
|
81
82
|
* shared by every EIP-3009 implementation (USDC, EURC, etc.).
|
|
82
83
|
*
|
|
83
84
|
* Exported so consumers can introspect or extend with sibling
|
|
@@ -111,7 +112,7 @@ declare const RECEIVE_WITH_AUTHORIZATION_TYPES: {
|
|
|
111
112
|
* compatible with viem, ethers, Privy, and Reown.
|
|
112
113
|
*
|
|
113
114
|
* Pass the result to `walletClient.signTypedData(typedData)` (viem)
|
|
114
|
-
* or `signer._signTypedData(domain, types, message)` (ethers)
|
|
115
|
+
* or `signer._signTypedData(domain, types, message)` (ethers). The
|
|
115
116
|
* SDK does not bind to a specific signer.
|
|
116
117
|
*/
|
|
117
118
|
declare function buildReceiveWithAuthorizationTypedData(params: ReceiveWithAuthorizationParams): Eip712TypedData<'ReceiveWithAuthorization'>;
|
|
@@ -121,22 +122,22 @@ declare function buildReceiveWithAuthorizationTypedData(params: ReceiveWithAutho
|
|
|
121
122
|
*
|
|
122
123
|
* - `chainId`, `token`, `tokenName`, `tokenVersion` form the EIP-712
|
|
123
124
|
* domain (same shape as the EIP-3009 builder).
|
|
124
|
-
* - `owner` is the token holder authorising the allowance
|
|
125
|
+
* - `owner` is the token holder authorising the allowance. Must match
|
|
125
126
|
* the signing wallet.
|
|
126
|
-
* - `spender` is the contract that will pull funds
|
|
127
|
+
* - `spender` is the contract that will pull funds. For Strimz
|
|
127
128
|
* subscriptions this is the StrimzSubscriptions contract.
|
|
128
129
|
* - `value` is the allowance to grant in token base units.
|
|
129
130
|
* `type(uint256).max` produces an unlimited allowance and is the
|
|
130
131
|
* common case for subscription enrolment.
|
|
131
132
|
* - `nonce` is the owner's *current* `nonces(owner)` reading from the
|
|
132
|
-
* token contract. The SDK does not fetch this
|
|
133
|
+
* token contract. The SDK does not fetch this. The caller is
|
|
133
134
|
* expected to have just queried it. Race-free: the token rejects
|
|
134
|
-
* stale nonces, so a concurrent permit on the same owner
|
|
135
|
-
*
|
|
135
|
+
* stale nonces, so a concurrent permit on the same owner causes one
|
|
136
|
+
* to fail predictably.
|
|
136
137
|
* - `deadline` is the unix-second timestamp after which the permit
|
|
137
|
-
* expires. Strimz default for subscription enrolment is 24h
|
|
138
|
-
*
|
|
139
|
-
*
|
|
138
|
+
* expires. Strimz default for subscription enrolment is 24h. Enough
|
|
139
|
+
* headroom for a slow merchant submit pipeline without leaving an
|
|
140
|
+
* indefinite signature window.
|
|
140
141
|
*/
|
|
141
142
|
interface PermitParams {
|
|
142
143
|
chainId: number;
|
|
@@ -178,4 +179,94 @@ declare const PERMIT_TYPES: {
|
|
|
178
179
|
*/
|
|
179
180
|
declare function buildPermitTypedData(params: PermitParams): Eip712TypedData<'Permit'>;
|
|
180
181
|
|
|
181
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Inputs for the Strimz PayIntent. Payer signs this alongside the
|
|
184
|
+
* EIP-3009 auth. Without it, a valid auth sig can be redirected to
|
|
185
|
+
* pay a different merchant.
|
|
186
|
+
*
|
|
187
|
+
* Every field must match the corresponding argument the API will
|
|
188
|
+
* submit on-chain — the contract compares them via ecrecover.
|
|
189
|
+
*/
|
|
190
|
+
interface PayIntentParams {
|
|
191
|
+
chainId: number;
|
|
192
|
+
verifyingContract: `0x${string}`;
|
|
193
|
+
merchantId: bigint;
|
|
194
|
+
token: `0x${string}`;
|
|
195
|
+
amount: bigint;
|
|
196
|
+
nonce: `0x${string}`;
|
|
197
|
+
validBefore: bigint;
|
|
198
|
+
ref: `0x${string}`;
|
|
199
|
+
}
|
|
200
|
+
/** Field order matches `PAY_INTENT_TYPEHASH` in `StrimzPayments.sol`. */
|
|
201
|
+
declare const PAY_INTENT_TYPES: {
|
|
202
|
+
readonly PayIntent: readonly [{
|
|
203
|
+
readonly name: "merchantId";
|
|
204
|
+
readonly type: "uint256";
|
|
205
|
+
}, {
|
|
206
|
+
readonly name: "token";
|
|
207
|
+
readonly type: "address";
|
|
208
|
+
}, {
|
|
209
|
+
readonly name: "amount";
|
|
210
|
+
readonly type: "uint256";
|
|
211
|
+
}, {
|
|
212
|
+
readonly name: "nonce";
|
|
213
|
+
readonly type: "bytes32";
|
|
214
|
+
}, {
|
|
215
|
+
readonly name: "validBefore";
|
|
216
|
+
readonly type: "uint256";
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "ref";
|
|
219
|
+
readonly type: "bytes32";
|
|
220
|
+
}];
|
|
221
|
+
};
|
|
222
|
+
/** Domain name + version mirror `EIP712("StrimzPayments", "1")`. */
|
|
223
|
+
declare function buildPayIntentTypedData(params: PayIntentParams): Eip712TypedData<'PayIntent'>;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Inputs for the Strimz SubscriptionIntent. Payer signs this
|
|
227
|
+
* alongside the ERC-2612 permit. Without it, a valid permit can be
|
|
228
|
+
* used to enrol the payer in a plan they never picked.
|
|
229
|
+
*
|
|
230
|
+
* `permitDeadline` ties this intent to the accompanying permit —
|
|
231
|
+
* they expire together.
|
|
232
|
+
*/
|
|
233
|
+
interface SubscriptionIntentParams {
|
|
234
|
+
chainId: number;
|
|
235
|
+
verifyingContract: `0x${string}`;
|
|
236
|
+
merchantId: bigint;
|
|
237
|
+
token: `0x${string}`;
|
|
238
|
+
amount: bigint;
|
|
239
|
+
interval: number;
|
|
240
|
+
startAt: bigint;
|
|
241
|
+
endAt: bigint;
|
|
242
|
+
permitDeadline: bigint;
|
|
243
|
+
}
|
|
244
|
+
/** Field order matches `SUBSCRIPTION_INTENT_TYPEHASH` in the contract. */
|
|
245
|
+
declare const SUBSCRIPTION_INTENT_TYPES: {
|
|
246
|
+
readonly SubscriptionIntent: readonly [{
|
|
247
|
+
readonly name: "merchantId";
|
|
248
|
+
readonly type: "uint256";
|
|
249
|
+
}, {
|
|
250
|
+
readonly name: "token";
|
|
251
|
+
readonly type: "address";
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "amount";
|
|
254
|
+
readonly type: "uint256";
|
|
255
|
+
}, {
|
|
256
|
+
readonly name: "interval";
|
|
257
|
+
readonly type: "uint32";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "startAt";
|
|
260
|
+
readonly type: "uint64";
|
|
261
|
+
}, {
|
|
262
|
+
readonly name: "endAt";
|
|
263
|
+
readonly type: "uint64";
|
|
264
|
+
}, {
|
|
265
|
+
readonly name: "permitDeadline";
|
|
266
|
+
readonly type: "uint256";
|
|
267
|
+
}];
|
|
268
|
+
};
|
|
269
|
+
/** Domain mirrors `EIP712("StrimzSubscriptions", "1")`. */
|
|
270
|
+
declare function buildSubscriptionIntentTypedData(params: SubscriptionIntentParams): Eip712TypedData<'SubscriptionIntent'>;
|
|
271
|
+
|
|
272
|
+
export { type Eip712Domain, type Eip712Field, type Eip712TypedData, type Eip712Types, PAY_INTENT_TYPES, PERMIT_TYPES, type PayIntentParams, type PermitParams, RECEIVE_WITH_AUTHORIZATION_TYPES, type ReceiveWithAuthorizationParams, SUBSCRIPTION_INTENT_TYPES, type SubscriptionIntentParams, buildPayIntentTypedData, buildPermitTypedData, buildReceiveWithAuthorizationTypedData, buildSubscriptionIntentTypedData };
|
package/dist/eip712.js
CHANGED
|
@@ -60,6 +60,72 @@ function buildPermitTypedData(params) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
// src/eip712/pay-intent.ts
|
|
64
|
+
var PAY_INTENT_TYPES = {
|
|
65
|
+
PayIntent: [
|
|
66
|
+
{ name: "merchantId", type: "uint256" },
|
|
67
|
+
{ name: "token", type: "address" },
|
|
68
|
+
{ name: "amount", type: "uint256" },
|
|
69
|
+
{ name: "nonce", type: "bytes32" },
|
|
70
|
+
{ name: "validBefore", type: "uint256" },
|
|
71
|
+
{ name: "ref", type: "bytes32" }
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
function buildPayIntentTypedData(params) {
|
|
75
|
+
return {
|
|
76
|
+
domain: {
|
|
77
|
+
name: "StrimzPayments",
|
|
78
|
+
version: "1",
|
|
79
|
+
chainId: params.chainId,
|
|
80
|
+
verifyingContract: params.verifyingContract
|
|
81
|
+
},
|
|
82
|
+
types: PAY_INTENT_TYPES,
|
|
83
|
+
primaryType: "PayIntent",
|
|
84
|
+
message: {
|
|
85
|
+
merchantId: params.merchantId,
|
|
86
|
+
token: params.token,
|
|
87
|
+
amount: params.amount,
|
|
88
|
+
nonce: params.nonce,
|
|
89
|
+
validBefore: params.validBefore,
|
|
90
|
+
ref: params.ref
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/eip712/subscription-intent.ts
|
|
96
|
+
var SUBSCRIPTION_INTENT_TYPES = {
|
|
97
|
+
SubscriptionIntent: [
|
|
98
|
+
{ name: "merchantId", type: "uint256" },
|
|
99
|
+
{ name: "token", type: "address" },
|
|
100
|
+
{ name: "amount", type: "uint256" },
|
|
101
|
+
{ name: "interval", type: "uint32" },
|
|
102
|
+
{ name: "startAt", type: "uint64" },
|
|
103
|
+
{ name: "endAt", type: "uint64" },
|
|
104
|
+
{ name: "permitDeadline", type: "uint256" }
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
function buildSubscriptionIntentTypedData(params) {
|
|
108
|
+
return {
|
|
109
|
+
domain: {
|
|
110
|
+
name: "StrimzSubscriptions",
|
|
111
|
+
version: "1",
|
|
112
|
+
chainId: params.chainId,
|
|
113
|
+
verifyingContract: params.verifyingContract
|
|
114
|
+
},
|
|
115
|
+
types: SUBSCRIPTION_INTENT_TYPES,
|
|
116
|
+
primaryType: "SubscriptionIntent",
|
|
117
|
+
message: {
|
|
118
|
+
merchantId: params.merchantId,
|
|
119
|
+
token: params.token,
|
|
120
|
+
amount: params.amount,
|
|
121
|
+
interval: params.interval,
|
|
122
|
+
startAt: params.startAt,
|
|
123
|
+
endAt: params.endAt,
|
|
124
|
+
permitDeadline: params.permitDeadline
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { PAY_INTENT_TYPES, PERMIT_TYPES, RECEIVE_WITH_AUTHORIZATION_TYPES, SUBSCRIPTION_INTENT_TYPES, buildPayIntentTypedData, buildPermitTypedData, buildReceiveWithAuthorizationTypedData, buildSubscriptionIntentTypedData };
|
|
64
130
|
//# sourceMappingURL=eip712.js.map
|
|
65
131
|
//# sourceMappingURL=eip712.js.map
|
package/dist/eip712.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eip712/receive-with-authorization.ts","../src/eip712/permit.ts"],"names":[],"mappings":";AA8CO,IAAM,gCAAA,GAAmC;AAAA,EAC9C,wBAAA,EAA0B;AAAA,IACxB,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAU;AAAA,IAChC,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,SAAA,EAAU;AAAA,IAC9B,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,SAAA,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S,MAAA,CAAO,OAAA;AAAA,MAChB,mBAAmB,MAAA,CAAO;AAAA,KAC5B;AAAA,IACA,KAAA,EAAO,YAAA;AAAA,IACP,WAAA,EAAa,QAAA;AAAA,IACb,OAAA,EAAS;AAAA,MACP,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,OAAA;AAAA,MAChB,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,UAAU,MAAA,CAAO;AAAA;AACnB,GACF;AACF","file":"eip712.js","sourcesContent":["import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-3009 ReceiveWithAuthorization typed-data.\n *\n * - `chainId` is the EVM chain id (Arc Testnet = 5042002).\n * - `token` is the ERC-20 contract whose `receiveWithAuthorization` is\n * being invoked — usually USDC at `0x36...` on Arc.\n * - `tokenName` and `tokenVersion` form the EIP-712 domain. Real USDC\n * on most chains uses `name=\"USD Coin\"` and `version=\"2\"`; tests\n * use whatever the mock token reports. Always read these from the\n * token contract at runtime to avoid drift.\n * - `from` is the payer; the wallet that produces the signature must\n * match this address.\n * - `to` is the recipient of the funds — for Strimz this is the\n * StrimzPayments contract address (the contract pulls funds into\n * itself, then forwards the fee + net split).\n * - `value` is the gross amount in token base units.\n * - `validAfter` / `validBefore` are unix-second timestamps bounding\n * the signature's validity. Strimz's default checkout window is\n * 5 minutes; integrators may widen this for usage-based billing.\n * - `nonce` is a single-use 32-byte value. Generate with crypto.randomBytes\n * (server) or crypto.getRandomValues (browser). The token contract\n * tracks `(authorizer, nonce) -> used` and rejects replays.\n */\nexport interface ReceiveWithAuthorizationParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n from: `0x${string}`\n to: `0x${string}`\n value: bigint\n validAfter: bigint\n validBefore: bigint\n nonce: `0x${string}`\n}\n\n/**\n * EIP-712 type definition for `ReceiveWithAuthorization`. Stable —\n * shared by every EIP-3009 implementation (USDC, EURC, etc.).\n *\n * Exported so consumers can introspect or extend with sibling\n * primitive types (e.g. for x402 batched signing schemes that wrap\n * multiple authorizations in one signature).\n */\nexport const RECEIVE_WITH_AUTHORIZATION_TYPES = {\n ReceiveWithAuthorization: [\n { name: 'from', type: 'address' },\n { name: 'to', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'validAfter', type: 'uint256' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-3009\n * `ReceiveWithAuthorization` signature. Returns the canonical shape\n * compatible with viem, ethers, Privy, and Reown.\n *\n * Pass the result to `walletClient.signTypedData(typedData)` (viem)\n * or `signer._signTypedData(domain, types, message)` (ethers) — the\n * SDK does not bind to a specific signer.\n */\nexport function buildReceiveWithAuthorizationTypedData(\n params: ReceiveWithAuthorizationParams,\n): Eip712TypedData<'ReceiveWithAuthorization'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: RECEIVE_WITH_AUTHORIZATION_TYPES,\n primaryType: 'ReceiveWithAuthorization',\n message: {\n from: params.from,\n to: params.to,\n value: params.value,\n validAfter: params.validAfter,\n validBefore: params.validBefore,\n nonce: params.nonce,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-2612 Permit typed-data.\n *\n * - `chainId`, `token`, `tokenName`, `tokenVersion` form the EIP-712\n * domain (same shape as the EIP-3009 builder).\n * - `owner` is the token holder authorising the allowance — must match\n * the signing wallet.\n * - `spender` is the contract that will pull funds — for Strimz\n * subscriptions this is the StrimzSubscriptions contract.\n * - `value` is the allowance to grant in token base units.\n * `type(uint256).max` produces an unlimited allowance and is the\n * common case for subscription enrolment.\n * - `nonce` is the owner's *current* `nonces(owner)` reading from the\n * token contract. The SDK does not fetch this — the caller is\n * expected to have just queried it. Race-free: the token rejects\n * stale nonces, so a concurrent permit on the same owner just\n * causes one to fail predictably.\n * - `deadline` is the unix-second timestamp after which the permit\n * expires. Strimz default for subscription enrolment is 24h —\n * enough headroom for a slow merchant submit pipeline without\n * leaving an indefinite signature window.\n */\nexport interface PermitParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n owner: `0x${string}`\n spender: `0x${string}`\n value: bigint\n nonce: bigint\n deadline: bigint\n}\n\n/**\n * EIP-712 type definition for `Permit`. Stable across every EIP-2612\n * implementation (USDC, EURC, DAI v2, etc.).\n */\nexport const PERMIT_TYPES = {\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-2612 `Permit` signature.\n * Returns the canonical shape compatible with viem, ethers, Privy,\n * and Reown.\n */\nexport function buildPermitTypedData(params: PermitParams): Eip712TypedData<'Permit'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: PERMIT_TYPES,\n primaryType: 'Permit',\n message: {\n owner: params.owner,\n spender: params.spender,\n value: params.value,\n nonce: params.nonce,\n deadline: params.deadline,\n },\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/eip712/receive-with-authorization.ts","../src/eip712/permit.ts","../src/eip712/pay-intent.ts","../src/eip712/subscription-intent.ts"],"names":[],"mappings":";AA8CO,IAAM,gCAAA,GAAmC;AAAA,EAC9C,wBAAA,EAA0B;AAAA,IACxB,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAU;AAAA,IAChC,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,SAAA,EAAU;AAAA,IAC9B,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,SAAA,EAAU;AAAA,IACtC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 ReceiveWithAuthorization typed-data.\n *\n * - `chainId` is the EVM chain id (Arc Testnet = 5042002).\n * - `token` is the ERC-20 contract whose `receiveWithAuthorization` is\n * being invoked. Usually USDC at `0x36...` on Arc.\n * - `tokenName` and `tokenVersion` form the EIP-712 domain. Real USDC\n * on most chains uses `name=\"USD Coin\"` and `version=\"2\"`; tests\n * use whatever the mock token reports. Always read these from the\n * token contract at runtime to avoid drift.\n * - `from` is the payer. The wallet that produces the signature must\n * match this address.\n * - `to` is the recipient of the funds. For Strimz this is the\n * StrimzPayments contract address (the contract pulls funds into\n * itself, then forwards the fee and net split).\n * - `value` is the gross amount in token base units.\n * - `validAfter` / `validBefore` are unix-second timestamps bounding\n * the signature's validity. Strimz's default checkout window is\n * 5 minutes; integrators may widen this for usage-based billing.\n * - `nonce` is a single-use 32-byte value. Generate with crypto.randomBytes\n * (server) or crypto.getRandomValues (browser). The token contract\n * tracks `(authorizer, nonce) -> used` and rejects replays.\n */\nexport interface ReceiveWithAuthorizationParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n from: `0x${string}`\n to: `0x${string}`\n value: bigint\n validAfter: bigint\n validBefore: bigint\n nonce: `0x${string}`\n}\n\n/**\n * EIP-712 type definition for `ReceiveWithAuthorization`. Stable, and\n * shared by every EIP-3009 implementation (USDC, EURC, etc.).\n *\n * Exported so consumers can introspect or extend with sibling\n * primitive types (e.g. for x402 batched signing schemes that wrap\n * multiple authorizations in one signature).\n */\nexport const RECEIVE_WITH_AUTHORIZATION_TYPES = {\n ReceiveWithAuthorization: [\n { name: 'from', type: 'address' },\n { name: 'to', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'validAfter', type: 'uint256' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-3009\n * `ReceiveWithAuthorization` signature. Returns the canonical shape\n * compatible with viem, ethers, Privy, and Reown.\n *\n * Pass the result to `walletClient.signTypedData(typedData)` (viem)\n * or `signer._signTypedData(domain, types, message)` (ethers). The\n * SDK does not bind to a specific signer.\n */\nexport function buildReceiveWithAuthorizationTypedData(\n params: ReceiveWithAuthorizationParams,\n): Eip712TypedData<'ReceiveWithAuthorization'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: RECEIVE_WITH_AUTHORIZATION_TYPES,\n primaryType: 'ReceiveWithAuthorization',\n message: {\n from: params.from,\n to: params.to,\n value: params.value,\n validAfter: params.validAfter,\n validBefore: params.validBefore,\n nonce: params.nonce,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the EIP-2612 Permit typed-data.\n *\n * - `chainId`, `token`, `tokenName`, `tokenVersion` form the EIP-712\n * domain (same shape as the EIP-3009 builder).\n * - `owner` is the token holder authorising the allowance. Must match\n * the signing wallet.\n * - `spender` is the contract that will pull funds. For Strimz\n * subscriptions this is the StrimzSubscriptions contract.\n * - `value` is the allowance to grant in token base units.\n * `type(uint256).max` produces an unlimited allowance and is the\n * common case for subscription enrolment.\n * - `nonce` is the owner's *current* `nonces(owner)` reading from the\n * token contract. The SDK does not fetch this. The caller is\n * expected to have just queried it. Race-free: the token rejects\n * stale nonces, so a concurrent permit on the same owner causes one\n * to fail predictably.\n * - `deadline` is the unix-second timestamp after which the permit\n * expires. Strimz default for subscription enrolment is 24h. Enough\n * headroom for a slow merchant submit pipeline without leaving an\n * indefinite signature window.\n */\nexport interface PermitParams {\n chainId: number\n token: `0x${string}`\n tokenName: string\n tokenVersion: string\n owner: `0x${string}`\n spender: `0x${string}`\n value: bigint\n nonce: bigint\n deadline: bigint\n}\n\n/**\n * EIP-712 type definition for `Permit`. Stable across every EIP-2612\n * implementation (USDC, EURC, DAI v2, etc.).\n */\nexport const PERMIT_TYPES = {\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n} as const\n\n/**\n * Build the typed-data structure for an EIP-2612 `Permit` signature.\n * Returns the canonical shape compatible with viem, ethers, Privy,\n * and Reown.\n */\nexport function buildPermitTypedData(params: PermitParams): Eip712TypedData<'Permit'> {\n return {\n domain: {\n name: params.tokenName,\n version: params.tokenVersion,\n chainId: params.chainId,\n verifyingContract: params.token,\n },\n types: PERMIT_TYPES,\n primaryType: 'Permit',\n message: {\n owner: params.owner,\n spender: params.spender,\n value: params.value,\n nonce: params.nonce,\n deadline: params.deadline,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the Strimz PayIntent. Payer signs this alongside the\n * EIP-3009 auth. Without it, a valid auth sig can be redirected to\n * pay a different merchant.\n *\n * Every field must match the corresponding argument the API will\n * submit on-chain — the contract compares them via ecrecover.\n */\nexport interface PayIntentParams {\n chainId: number\n verifyingContract: `0x${string}`\n merchantId: bigint\n token: `0x${string}`\n amount: bigint\n nonce: `0x${string}`\n validBefore: bigint\n ref: `0x${string}`\n}\n\n/** Field order matches `PAY_INTENT_TYPEHASH` in `StrimzPayments.sol`. */\nexport const PAY_INTENT_TYPES = {\n PayIntent: [\n { name: 'merchantId', type: 'uint256' },\n { name: 'token', type: 'address' },\n { name: 'amount', type: 'uint256' },\n { name: 'nonce', type: 'bytes32' },\n { name: 'validBefore', type: 'uint256' },\n { name: 'ref', type: 'bytes32' },\n ],\n} as const\n\n/** Domain name + version mirror `EIP712(\"StrimzPayments\", \"1\")`. */\nexport function buildPayIntentTypedData(params: PayIntentParams): Eip712TypedData<'PayIntent'> {\n return {\n domain: {\n name: 'StrimzPayments',\n version: '1',\n chainId: params.chainId,\n verifyingContract: params.verifyingContract,\n },\n types: PAY_INTENT_TYPES,\n primaryType: 'PayIntent',\n message: {\n merchantId: params.merchantId,\n token: params.token,\n amount: params.amount,\n nonce: params.nonce,\n validBefore: params.validBefore,\n ref: params.ref,\n },\n }\n}\n","import type { Eip712TypedData } from './types.js'\n\n/**\n * Inputs for the Strimz SubscriptionIntent. Payer signs this\n * alongside the ERC-2612 permit. Without it, a valid permit can be\n * used to enrol the payer in a plan they never picked.\n *\n * `permitDeadline` ties this intent to the accompanying permit —\n * they expire together.\n */\nexport interface SubscriptionIntentParams {\n chainId: number\n verifyingContract: `0x${string}`\n merchantId: bigint\n token: `0x${string}`\n amount: bigint\n interval: number\n startAt: bigint\n endAt: bigint\n permitDeadline: bigint\n}\n\n/** Field order matches `SUBSCRIPTION_INTENT_TYPEHASH` in the contract. */\nexport const SUBSCRIPTION_INTENT_TYPES = {\n SubscriptionIntent: [\n { name: 'merchantId', type: 'uint256' },\n { name: 'token', type: 'address' },\n { name: 'amount', type: 'uint256' },\n { name: 'interval', type: 'uint32' },\n { name: 'startAt', type: 'uint64' },\n { name: 'endAt', type: 'uint64' },\n { name: 'permitDeadline', type: 'uint256' },\n ],\n} as const\n\n/** Domain mirrors `EIP712(\"StrimzSubscriptions\", \"1\")`. */\nexport function buildSubscriptionIntentTypedData(\n params: SubscriptionIntentParams,\n): Eip712TypedData<'SubscriptionIntent'> {\n return {\n domain: {\n name: 'StrimzSubscriptions',\n version: '1',\n chainId: params.chainId,\n verifyingContract: params.verifyingContract,\n },\n types: SUBSCRIPTION_INTENT_TYPES,\n primaryType: 'SubscriptionIntent',\n message: {\n merchantId: params.merchantId,\n token: params.token,\n amount: params.amount,\n interval: params.interval,\n startAt: params.startAt,\n endAt: params.endAt,\n permitDeadline: params.permitDeadline,\n },\n }\n}\n"]}
|
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;AAsCO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EACrB,IAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA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AI,eAAe,GAAA,EAAK,OAAO,IAAI,qBAAA,CAAsB,MAAM,UAAU,CAAA;AACzE,EAAA,IAAI,eAAe,GAAA,EAAK,OAAO,IAAI,mBAAA,CAAoB,MAAM,UAAU,CAAA;AACvE,EAAA,IAAI,UAAA,KAAe,GAAA,IAAO,IAAA,CAAK,IAAA,KAAS,mBAAA,EAAqB;AAC3D,IAAA,OAAO,IAAI,sBAAA,CAAuB,IAAA,EAAM,UAAU,CAAA;AAAA,EACpD;AACA,EAAA,IAAI,eAAe,GAAA,EAAK,OAAO,IAAI,qBAAA,CAAsB,MAAM,UAAU,CAAA;AACzE,EAAA,IAAI,eAAe,GAAA,EAAK,OAAO,IAAI,oBAAA,CAAqB,IAAA,EAAM,YAAY,YAAY,CAAA;AACtF,EAAA,OAAO,IAAI,WAAA,CAAY,IAAA,EAAM,UAAU,CAAA;AACzC","file":"errors.cjs","sourcesContent":["/**\n * Error hierarchy for the Strimz SDK.\n *\n * Every error thrown by the SDK extends `StrimzError`. The SDK throws\n * on failure rather than resolving to `{ ok: false }` so call sites\n * stay linear and consumers can narrow with `instanceof` on the\n * exported subclasses.\n */\n\nexport type StrimzErrorCode =\n | 'authentication_error'\n | 'permission_denied'\n | 'invalid_request'\n | 'not_found'\n | 'idempotency_error'\n | 'rate_limited'\n | 'mode_mismatch'\n | 'merchant_not_found'\n | 'merchant_inactive'\n | 'token_not_whitelisted'\n | 'compliance_blocked'\n | 'session_expired'\n | 'session_invalid_state'\n | 'webhook_signature_invalid'\n | 'api_error'\n | 'network_error'\n | 'timeout'\n | 'parse_error'\n | 'unknown'\n\nexport interface StrimzErrorBody {\n code: StrimzErrorCode\n message: string\n param?: string\n requestId?: string\n details?: Record<string, unknown>\n}\n\nexport class StrimzError extends Error {\n public readonly code: StrimzErrorCode\n public readonly httpStatus: number | undefined\n public readonly requestId: string | undefined\n public readonly param: string | undefined\n public readonly details: Record<string, unknown> | undefined\n\n constructor(body: StrimzErrorBody, httpStatus?: number) {\n super(body.message)\n this.name = 'StrimzError'\n this.code = body.code\n this.httpStatus = httpStatus\n this.requestId = body.requestId\n this.param = body.param\n this.details = body.details\n }\n}\n\nexport class StrimzAuthenticationError extends StrimzError {\n constructor(body: StrimzErrorBody, httpStatus?: number) {\n super(body, httpStatus)\n this.name = 'StrimzAuthenticationError'\n }\n}\n\nexport class StrimzPermissionError extends StrimzError {\n constructor(body: StrimzErrorBody, httpStatus?: number) {\n super(body, httpStatus)\n this.name = 'StrimzPermissionError'\n }\n}\n\nexport class StrimzValidationError extends StrimzError {\n constructor(body: StrimzErrorBody, httpStatus?: number) {\n super(body, httpStatus)\n this.name = 'StrimzValidationError'\n }\n}\n\nexport class StrimzNotFoundError extends StrimzError {\n constructor(body: StrimzErrorBody, httpStatus?: number) {\n super(body, httpStatus)\n this.name = 'StrimzNotFoundError'\n }\n}\n\nexport class StrimzIdempotencyError extends StrimzError {\n constructor(body: StrimzErrorBody, httpStatus?: number) {\n super(body, httpStatus)\n this.name = 'StrimzIdempotencyError'\n }\n}\n\nexport class StrimzRateLimitError extends StrimzError {\n public readonly retryAfterMs: number | undefined\n constructor(body: StrimzErrorBody, httpStatus?: number, retryAfterMs?: number) {\n super(body, httpStatus)\n this.name = 'StrimzRateLimitError'\n this.retryAfterMs = retryAfterMs\n }\n}\n\nexport class StrimzNetworkError extends StrimzError {\n public override readonly cause: unknown\n constructor(message: string, cause: unknown) {\n super({ code: 'network_error', message })\n this.name = 'StrimzNetworkError'\n this.cause = cause\n }\n}\n\nexport class StrimzTimeoutError extends StrimzError {\n constructor(message: string) {\n super({ code: 'timeout', message })\n this.name = 'StrimzTimeoutError'\n }\n}\n\nexport class StrimzModeMismatchError extends StrimzError {\n constructor(message: string) {\n super({ code: 'mode_mismatch', message })\n this.name = 'StrimzModeMismatchError'\n }\n}\n\n/** Map an HTTP status + body to the right StrimzError subclass. */\nexport function classifyError(\n httpStatus: number,\n body: StrimzErrorBody,\n retryAfterMs?: number,\n): StrimzError {\n if (httpStatus === 401) return new StrimzAuthenticationError(body, httpStatus)\n if (httpStatus === 403) return new StrimzPermissionError(body, httpStatus)\n if (httpStatus === 404) return new StrimzNotFoundError(body, httpStatus)\n if (httpStatus === 409 && body.code === 'idempotency_error') {\n return new StrimzIdempotencyError(body, httpStatus)\n }\n if (httpStatus === 422) return new StrimzValidationError(body, httpStatus)\n if (httpStatus === 429) return new StrimzRateLimitError(body, httpStatus, retryAfterMs)\n return new StrimzError(body, httpStatus)\n}\n"]}
|
package/dist/errors.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error hierarchy for the Strimz SDK.
|
|
3
3
|
*
|
|
4
|
-
* Every error thrown by the SDK extends `StrimzError`. The SDK
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Every error thrown by the SDK extends `StrimzError`. The SDK throws
|
|
5
|
+
* on failure rather than resolving to `{ ok: false }` so call sites
|
|
6
|
+
* stay linear and consumers can narrow with `instanceof` on the
|
|
7
|
+
* exported subclasses.
|
|
7
8
|
*/
|
|
8
9
|
type StrimzErrorCode = 'authentication_error' | 'permission_denied' | 'invalid_request' | 'not_found' | 'idempotency_error' | 'rate_limited' | 'mode_mismatch' | 'merchant_not_found' | 'merchant_inactive' | 'token_not_whitelisted' | 'compliance_blocked' | 'session_expired' | 'session_invalid_state' | 'webhook_signature_invalid' | 'api_error' | 'network_error' | 'timeout' | 'parse_error' | 'unknown';
|
|
9
10
|
interface StrimzErrorBody {
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error hierarchy for the Strimz SDK.
|
|
3
3
|
*
|
|
4
|
-
* Every error thrown by the SDK extends `StrimzError`. The SDK
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Every error thrown by the SDK extends `StrimzError`. The SDK throws
|
|
5
|
+
* on failure rather than resolving to `{ ok: false }` so call sites
|
|
6
|
+
* stay linear and consumers can narrow with `instanceof` on the
|
|
7
|
+
* exported subclasses.
|
|
7
8
|
*/
|
|
8
9
|
type StrimzErrorCode = 'authentication_error' | 'permission_denied' | 'invalid_request' | 'not_found' | 'idempotency_error' | 'rate_limited' | 'mode_mismatch' | 'merchant_not_found' | 'merchant_inactive' | 'token_not_whitelisted' | 'compliance_blocked' | 'session_expired' | 'session_invalid_state' | 'webhook_signature_invalid' | 'api_error' | 'network_error' | 'timeout' | 'parse_error' | 'unknown';
|
|
9
10
|
interface StrimzErrorBody {
|