@strimz/sdk 0.1.0 → 0.1.1

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 (41) hide show
  1. package/README.md +109 -23
  2. package/dist/{browser-client-DlZg0Aae.d.cts → browser-client-D6VUs85b.d.cts} +24 -25
  3. package/dist/{browser-client-DlZg0Aae.d.ts → browser-client-D6VUs85b.d.ts} +24 -25
  4. package/dist/browser-client.cjs +6 -6
  5. package/dist/browser-client.cjs.map +1 -1
  6. package/dist/browser-client.d.cts +1 -1
  7. package/dist/browser-client.d.ts +1 -1
  8. package/dist/browser-client.js +6 -6
  9. package/dist/browser-client.js.map +1 -1
  10. package/dist/eip712.cjs.map +1 -1
  11. package/dist/eip712.d.cts +19 -18
  12. package/dist/eip712.d.ts +19 -18
  13. package/dist/eip712.js.map +1 -1
  14. package/dist/errors.cjs.map +1 -1
  15. package/dist/errors.d.cts +4 -3
  16. package/dist/errors.d.ts +4 -3
  17. package/dist/errors.js.map +1 -1
  18. package/dist/index.cjs +7 -7
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +8 -9
  21. package/dist/index.d.ts +8 -9
  22. package/dist/index.js +7 -7
  23. package/dist/index.js.map +1 -1
  24. package/dist/webhooks.cjs.map +1 -1
  25. package/dist/webhooks.d.cts +3 -3
  26. package/dist/webhooks.d.ts +3 -3
  27. package/dist/webhooks.js.map +1 -1
  28. package/package.json +4 -4
  29. package/src/browser-client.ts +11 -11
  30. package/src/client.ts +4 -4
  31. package/src/eip712/index.ts +2 -2
  32. package/src/eip712/permit.ts +8 -8
  33. package/src/eip712/receive-with-authorization.ts +6 -6
  34. package/src/eip712/types.ts +5 -4
  35. package/src/errors.ts +4 -3
  36. package/src/http/fetcher.ts +3 -3
  37. package/src/http/headers.ts +4 -4
  38. package/src/idempotency.ts +2 -3
  39. package/src/resources/checkout.ts +3 -3
  40. package/src/resources/tokens.ts +10 -11
  41. package/src/webhooks.ts +3 -3
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
- * — so the SDK can produce typed-data without binding to a specific
10
- * wallet client. Consumers pipe the result into whichever signer they
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; wallet libs handle the conversion
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 — usually USDC at `0x36...` on Arc.
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; the wallet that produces the signature must
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 — for Strimz this is the
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 + net split).
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) — the
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 — must match
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 — for Strimz
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 — the caller is
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 just
135
- * causes one to fail predictably.
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
- * enough headroom for a slow merchant submit pipeline without
139
- * leaving an indefinite signature window.
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;
@@ -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,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,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.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"],"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,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.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 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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;AAqCO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EACrB,IAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EAEhB,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAClB,IAAA,IAAA,CAAK,YAAY,IAAA,CAAK,SAAA;AACtB,IAAA,IAAA,CAAK,QAAQ,IAAA,CAAK,KAAA;AAClB,IAAA,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AAAA,EACtB;AACF;AAEO,IAAM,yBAAA,GAAN,cAAwC,WAAA,CAAY;AAAA,EACzD,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,MAAM,UAAU,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AAAA,EACd;AACF;AAEO,IAAM,qBAAA,GAAN,cAAoC,WAAA,CAAY;AAAA,EACrD,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,MAAM,UAAU,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,uBAAA;AAAA,EACd;AACF;AAEO,IAAM,qBAAA,GAAN,cAAoC,WAAA,CAAY;AAAA,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AAA,IAAA,CAAK,IAAA,GAAO,oBAAA;AAAA,EACd;AACF;AAEO,IAAM,uBAAA,GAAN,cAAsC,WAAA,CAAY;AAAA,EACvD,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,eAAA,EAAiB,OAAA,EAAS,CAAA;AACxC,IAAA,IAAA,CAAK,IAAA,GAAO,yBAAA;AAAA,EACd;AACF;AAGO,SAAS,aAAA,CACd,UAAA,EACA,IAAA,EACA,YAAA,EACa;AACb,EAAA,IAAI,eAAe,GAAA,EAAK,OAAO,IAAI,yBAAA,CAA0B,MAAM,UAAU,CAAA;AAC7E,EAAA,IAAI,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 never\n * resolves to `{ ok: false }` — it throws. This matches the Stripe / GitHub\n * SDK convention and keeps call sites linear.\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"]}
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,OAAA;AAAA,EAEhB,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAClB,IAAA,IAAA,CAAK,YAAY,IAAA,CAAK,SAAA;AACtB,IAAA,IAAA,CAAK,QAAQ,IAAA,CAAK,KAAA;AAClB,IAAA,IAAA,CAAK,UAAU,IAAA,CAAK,OAA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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 never
5
- * resolves to `{ ok: false }` — it throws. This matches the Stripe / GitHub
6
- * SDK convention and keeps call sites linear.
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 never
5
- * resolves to `{ ok: false }` — it throws. This matches the Stripe / GitHub
6
- * SDK convention and keeps call sites linear.
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 {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";AAqCO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EACrB,IAAA;AAAA,EACA,UAAA;AAAA,EACA,SAA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,UAAU,CAAA;AAC7E,EAAA,IAAI,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.js","sourcesContent":["/**\n * Error hierarchy for the Strimz SDK.\n *\n * Every error thrown by the SDK extends `StrimzError`. The SDK never\n * resolves to `{ ok: false }` — it throws. This matches the Stripe / GitHub\n * SDK convention and keeps call sites linear.\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"]}
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,OAAA;AAAA,EAEhB,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAClB,IAAA,IAAA,CAAK,YAAY,IAAA,CAAK,SAAA;AACtB,IAAA,IAAA,CAAK,QAAQ,IAAA,CAAK,KAAA;AAClB,IAAA,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AAAA,EACtB;AACF;AAEO,IAAM,yBAAA,GAAN,cAAwC,WAAA,CAAY;AAAA,EACzD,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,MAAM,UAAU,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AAAA,EACd;AACF;AAEO,IAAM,qBAAA,GAAN,cAAoC,WAAA,CAAY;AAAA,EACrD,WAAA,CAAY,MAAuB,UAAA,EAAqB;AACtD,IAAA,KAAA,CAAM,MAAM,UAAU,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,uBAAA;AAA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,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,CAAA;AAClC,IAAA,IAAA,CAAK,IAAA,GAAO,oBAAA;AAAA,EACd;AACF;AAEO,IAAM,uBAAA,GAAN,cAAsC,WAAA,CAAY;AAAA,EACvD,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,eAAA,EAAiB,OAAA,EAAS,CAAA;AACxC,IAAA,IAAA,CAAK,IAAA,GAAO,yBAAA;AAAA,EACd;AACF;AAGO,SAAS,aAAA,CACd,UAAA,EACA,IAAA,EACA,YAAA,EACa;AACb,EAAA,IAAI,eAAe,GAAA,EAAK,OAAO,IAAI,yBAAA,CAA0B,MAAM,UAAU,CAAA;AAC7E,EAAA,IAAI,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.js","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/index.cjs CHANGED
@@ -648,7 +648,7 @@ var AgentsResource = class extends BaseResource {
648
648
  // src/client.ts
649
649
  var DEFAULT_BASE_URL = "https://api.strimz.io";
650
650
  var StrimzClient = class {
651
- /** Resolved mode — `test` or `live`. Derived from the API key prefix. */
651
+ /** Resolved mode, either `test` or `live`. Derived from the API key prefix. */
652
652
  mode;
653
653
  merchants;
654
654
  apiKeys;
@@ -720,11 +720,11 @@ function detectRuntime() {
720
720
  return "unknown";
721
721
  }
722
722
  var CheckoutResource = class extends BaseResource {
723
- /** Load a payment session by id (public — no merchant scoping). */
723
+ /** Load a payment session by id (public, no merchant scoping). */
724
724
  session(id) {
725
725
  return this.get(`/v1/checkout/sessions/${encodeURIComponent(id)}`, sharedTypes.paymentSessionSchema);
726
726
  }
727
- /** Load a subscription plan by id (public — no merchant scoping). */
727
+ /** Load a subscription plan by id (public, no merchant scoping). */
728
728
  plan(id) {
729
729
  return this.get(`/v1/checkout/plans/${encodeURIComponent(id)}`, sharedTypes.subscriptionPlanSchema);
730
730
  }
@@ -732,14 +732,14 @@ var CheckoutResource = class extends BaseResource {
732
732
  var TokensResource = class extends BaseResource {
733
733
  /**
734
734
  * Fetch full metadata for a token. Throws via the underlying fetcher
735
- * (404 → `StrimzNotFoundError`) if the token isn't whitelisted.
735
+ * (404 maps to `StrimzNotFoundError`) if the token isn't whitelisted.
736
736
  */
737
737
  retrieve(address) {
738
738
  return this.get(`/v1/tokens/${encodeURIComponent(address.toLowerCase())}`, sharedTypes.tokenMetadataSchema);
739
739
  }
740
740
  /**
741
741
  * Read an owner's current EIP-2612 permit nonce. Call this
742
- * immediately before signing a Permit — the token contract rejects
742
+ * immediately before signing a Permit. The token contract rejects
743
743
  * stale nonces, and the value advances on every successful permit.
744
744
  */
745
745
  permitNonce(address, owner) {
@@ -756,12 +756,12 @@ var DEFAULT_BASE_URL2 = "https://api.strimz.io";
756
756
  var StrimzBrowserClient = class {
757
757
  mode;
758
758
  /**
759
- * Public hosted-checkout reads — payment sessions and subscription
759
+ * Public hosted-checkout reads. Payment sessions and subscription
760
760
  * plans by id. Backed by the `/v1/checkout/*` namespace on the API,
761
761
  * which is intentionally unauthenticated.
762
762
  */
763
763
  checkout;
764
- /** Token metadata + EIP-2612 permit nonce lookup. */
764
+ /** Token metadata and EIP-2612 permit nonce lookup. */
765
765
  tokens;
766
766
  constructor(options) {
767
767
  const key = options.publishableKey;