@strimz/shared-config 0.2.0 → 0.4.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 CHANGED
@@ -25,10 +25,11 @@ pnpm add @strimz/shared-config
25
25
  ## Quick start
26
26
 
27
27
  ```ts
28
- import { arcTestnet, getTokenAddress, effectiveFeeBps } from '@strimz/shared-config'
28
+ import { arcTestnet, getTokenAddress, planFeeBps, planForVolume } from '@strimz/shared-config'
29
29
 
30
30
  const usdcOnTestnet = getTokenAddress('testnet', 'USDC')
31
- const recurringFeeBps = effectiveFeeBps('growth', 'subscription') // 100 bps
31
+ const starterFeeBps = planFeeBps('starter') // 50 bps
32
+ const plan = planForVolume({ USDC: 1_000_000_000n, EURC: 0n }) // 'starter'
32
33
  ```
33
34
 
34
35
  ## Modules
@@ -39,7 +40,7 @@ Every group is also available as a subpath import for tree-shaking.
39
40
  | -------------------------------- | ------------------------------------------------------------------------------------- |
40
41
  | `@strimz/shared-config/chains` | `arcTestnet`, `arcMainnet`, `getArcChain`, `isArcChain`, chain id constants |
41
42
  | `@strimz/shared-config/tokens` | `TOKENS`, `TOKEN_ADDRESSES`, `getTokenAddress`, `isPaymentToken`, `PaymentToken` type |
42
- | `@strimz/shared-config/tiers` | `TIERS`, `effectiveFeeBps`, `getTier`, `MerchantTier` type |
43
+ | `@strimz/shared-config/tiers` | `PLANS`, `planFeeBps`, `planForVolume`, `planIncludes`, `MerchantTier` type |
43
44
  | `@strimz/shared-config/webhooks` | `WEBHOOK_EVENTS`, retry schedule, signature header constants |
44
45
  | `@strimz/shared-config/api-keys` | `API_KEY_PREFIXES`, `prefixFor`, `modeFromKey`, `kindFromKey` |
45
46
  | `@strimz/shared-config/agents` | `AGENT_CAPABILITIES`, `AGENT_DEFAULTS`, capability metadata |
package/dist/api-keys.cjs CHANGED
@@ -1,5 +1,58 @@
1
1
  'use strict';
2
2
 
3
+ var viem = require('viem');
4
+
5
+ // src/chains.ts
6
+ var ARC_TESTNET_CHAIN_ID = 5042002;
7
+ var ARC_MAINNET_CHAIN_ID = 5042;
8
+ var NATIVE_USDC = {
9
+ name: "USDC",
10
+ symbol: "USDC",
11
+ decimals: 18
12
+ };
13
+ viem.defineChain({
14
+ id: ARC_TESTNET_CHAIN_ID,
15
+ name: "Arc Testnet",
16
+ nativeCurrency: NATIVE_USDC,
17
+ rpcUrls: {
18
+ default: { http: ["https://rpc.testnet.arc.io"] },
19
+ public: { http: ["https://rpc.testnet.arc.io"] }
20
+ },
21
+ blockExplorers: {
22
+ default: {
23
+ name: "Arc Testnet Explorer",
24
+ url: "https://explorer.testnet.arc.io"
25
+ }
26
+ },
27
+ testnet: true
28
+ });
29
+ viem.defineChain({
30
+ id: ARC_MAINNET_CHAIN_ID,
31
+ name: "Arc",
32
+ nativeCurrency: NATIVE_USDC,
33
+ rpcUrls: {
34
+ default: { http: ["https://rpc.mainnet.arc.io"] },
35
+ public: { http: ["https://rpc.mainnet.arc.io"] }
36
+ },
37
+ blockExplorers: {
38
+ default: {
39
+ name: "Arc Explorer",
40
+ url: "https://explorer.arc.io"
41
+ }
42
+ },
43
+ testnet: false
44
+ });
45
+ var ARC_ENVIRONMENTS = ["testnet", "mainnet"];
46
+ function isArcEnvironment(value) {
47
+ return typeof value === "string" && ARC_ENVIRONMENTS.includes(value);
48
+ }
49
+ function parseArcEnvironment(value) {
50
+ if (isArcEnvironment(value)) return value;
51
+ throw new Error(
52
+ `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(", ")}`
53
+ );
54
+ }
55
+
3
56
  // src/api-keys.ts
4
57
  var API_KEY_PREFIXES = {
5
58
  secret: {
@@ -26,10 +79,18 @@ function kindFromKey(key) {
26
79
  return null;
27
80
  }
28
81
  var API_KEY_PREFIX_DISPLAY_LENGTH = 12;
82
+ var MODE_BY_ENVIRONMENT = {
83
+ testnet: "test",
84
+ mainnet: "live"
85
+ };
86
+ function arcModeFor(env) {
87
+ return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)];
88
+ }
29
89
 
30
90
  exports.API_KEY_PREFIXES = API_KEY_PREFIXES;
31
91
  exports.API_KEY_PREFIX_DISPLAY_LENGTH = API_KEY_PREFIX_DISPLAY_LENGTH;
32
92
  exports.API_KEY_RANDOM_BYTES = API_KEY_RANDOM_BYTES;
93
+ exports.arcModeFor = arcModeFor;
33
94
  exports.kindFromKey = kindFromKey;
34
95
  exports.modeFromKey = modeFromKey;
35
96
  exports.prefixFor = prefixFor;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api-keys.ts"],"names":[],"mappings":";;;AAWO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAGO,IAAM,oBAAA,GAAuB;AAE7B,SAAS,SAAA,CAAU,MAAkB,IAAA,EAA0B;AACpE,EAAA,OAAO,gBAAA,CAAiB,IAAI,CAAA,CAAE,IAAI,CAAA;AACpC;AAEO,SAAS,YAAY,GAAA,EAAgC;AAC1D,EAAA,IAAI,GAAA,CAAI,WAAW,UAAU,CAAA,IAAK,IAAI,UAAA,CAAW,UAAU,GAAG,OAAO,MAAA;AACrE,EAAA,IAAI,GAAA,CAAI,WAAW,UAAU,CAAA,IAAK,IAAI,UAAA,CAAW,UAAU,GAAG,OAAO,MAAA;AACrE,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,YAAY,GAAA,EAAgC;AAC1D,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,EAAG,OAAO,QAAA;AAClC,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,EAAG,OAAO,aAAA;AAClC,EAAA,OAAO,IAAA;AACT;AAGO,IAAM,6BAAA,GAAgC","file":"api-keys.cjs","sourcesContent":["/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/api-keys.ts"],"names":["defineChain"],"mappings":";;;;;AAaO,IAAM,oBAAA,GAAuB,OAAA;AAC7B,IAAM,oBAAA,GAAuB,IAAA;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,MAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAEiCA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAA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A,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAGO,IAAM,oBAAA,GAAuB;AAE7B,SAAS,SAAA,CAAU,MAAkB,IAAA,EAA0B;AACpE,EAAA,OAAO,gBAAA,CAAiB,IAAI,CAAA,CAAE,IAAI,CAAA;AACpC;AAEO,SAAS,YAAY,GAAA,EAAgC;AAC1D,EAAA,IAAI,GAAA,CAAI,WAAW,UAAU,CAAA,IAAK,IAAI,UAAA,CAAW,UAAU,GAAG,OAAO,MAAA;AACrE,EAAA,IAAI,GAAA,CAAI,WAAW,UAAU,CAAA,IAAK,IAAI,UAAA,CAAW,UAAU,GAAG,OAAO,MAAA;AACrE,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,YAAY,GAAA,EAAgC;AAC1D,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,EAAG,OAAO,QAAA;AAClC,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,EAAG,OAAO,aAAA;AAClC,EAAA,OAAO,IAAA;AACT;AAGO,IAAM,6BAAA,GAAgC;AAE7C,IAAM,mBAAA,GAAsB;AAAA,EAC1B,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,WAAW,GAAA,EAAiC;AAC1D,EAAA,OAAO,mBAAA,CAAoB,mBAAA,CAAoB,GAAG,CAAC,CAAA;AACrD","file":"api-keys.cjs","sourcesContent":["/**\n * Arc blockchain definitions.\n *\n * Arc is Circle's stablecoin-native L1 where gas is paid in USDC.\n * - Testnet is live (chain id 5042002).\n * - Mainnet beta is expected in 2026; the mainnet entry is a placeholder\n * until Circle publishes the production chain id and RPC endpoint.\n *\n * @see https://docs.arc.network\n */\n\nimport { defineChain, type Chain } from 'viem'\n\nexport const ARC_TESTNET_CHAIN_ID = 5042002 as const\nexport const ARC_MAINNET_CHAIN_ID = 5042 as const\n\nconst NATIVE_USDC = {\n name: 'USDC',\n symbol: 'USDC',\n decimals: 18,\n} as const\n\nexport const arcTestnet: Chain = defineChain({\n id: ARC_TESTNET_CHAIN_ID,\n name: 'Arc Testnet',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.testnet.arc.io'] },\n public: { http: ['https://rpc.testnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Testnet Explorer',\n url: 'https://explorer.testnet.arc.io',\n },\n },\n testnet: true,\n})\n\nexport const arcMainnet: Chain = defineChain({\n id: ARC_MAINNET_CHAIN_ID,\n name: 'Arc',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.mainnet.arc.io'] },\n public: { http: ['https://rpc.mainnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Explorer',\n url: 'https://explorer.arc.io',\n },\n },\n testnet: false,\n})\n\nexport type ArcEnvironment = 'testnet' | 'mainnet'\n\nexport const ARC_CHAINS: Record<ArcEnvironment, Chain> = {\n testnet: arcTestnet,\n mainnet: arcMainnet,\n}\n\nexport const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const\n\nexport function isArcEnvironment(value: unknown): value is ArcEnvironment {\n return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)\n}\n\nexport function parseArcEnvironment(value: unknown): ArcEnvironment {\n if (isArcEnvironment(value)) return value\n throw new Error(\n `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,\n )\n}\n\nexport function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[parseArcEnvironment(env)]\n}\n\nexport function getArcExplorerUrl(env: ArcEnvironment): string {\n const explorer = getArcChain(env).blockExplorers?.default.url\n if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)\n return explorer\n}\n\nexport function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {\n return `${getArcExplorerUrl(env)}/tx/${txHash}`\n}\n\nexport function arcEnvironmentForChainId(chainId: number): ArcEnvironment {\n const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)\n if (!env) {\n throw new Error(\n `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,\n )\n }\n return env\n}\n\nexport function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {\n const expected = getArcChain(env).id\n if (rpcChainId !== expected) {\n throw new Error(\n `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,\n )\n }\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n"]}
@@ -1,3 +1,6 @@
1
+ import { ArcEnvironment } from './chains.cjs';
2
+ import 'viem';
3
+
1
4
  /**
2
5
  * API key prefix conventions.
3
6
  *
@@ -5,6 +8,7 @@
5
8
  * is safe to expose to the client. Secret keys are server-side only; publishable
6
9
  * keys can ship in browser bundles.
7
10
  */
11
+
8
12
  type ApiKeyMode = 'test' | 'live';
9
13
  type ApiKeyKind = 'secret' | 'publishable';
10
14
  declare const API_KEY_PREFIXES: {
@@ -24,5 +28,6 @@ declare function modeFromKey(key: string): ApiKeyMode | null;
24
28
  declare function kindFromKey(key: string): ApiKeyKind | null;
25
29
  /** Number of leading characters of a key safe to display in dashboards/logs. */
26
30
  declare const API_KEY_PREFIX_DISPLAY_LENGTH = 12;
31
+ declare function arcModeFor(env: ArcEnvironment): ApiKeyMode;
27
32
 
28
- export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, type ApiKeyKind, type ApiKeyMode, kindFromKey, modeFromKey, prefixFor };
33
+ export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, type ApiKeyKind, type ApiKeyMode, arcModeFor, kindFromKey, modeFromKey, prefixFor };
@@ -1,3 +1,6 @@
1
+ import { ArcEnvironment } from './chains.js';
2
+ import 'viem';
3
+
1
4
  /**
2
5
  * API key prefix conventions.
3
6
  *
@@ -5,6 +8,7 @@
5
8
  * is safe to expose to the client. Secret keys are server-side only; publishable
6
9
  * keys can ship in browser bundles.
7
10
  */
11
+
8
12
  type ApiKeyMode = 'test' | 'live';
9
13
  type ApiKeyKind = 'secret' | 'publishable';
10
14
  declare const API_KEY_PREFIXES: {
@@ -24,5 +28,6 @@ declare function modeFromKey(key: string): ApiKeyMode | null;
24
28
  declare function kindFromKey(key: string): ApiKeyKind | null;
25
29
  /** Number of leading characters of a key safe to display in dashboards/logs. */
26
30
  declare const API_KEY_PREFIX_DISPLAY_LENGTH = 12;
31
+ declare function arcModeFor(env: ArcEnvironment): ApiKeyMode;
27
32
 
28
- export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, type ApiKeyKind, type ApiKeyMode, kindFromKey, modeFromKey, prefixFor };
33
+ export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, type ApiKeyKind, type ApiKeyMode, arcModeFor, kindFromKey, modeFromKey, prefixFor };
package/dist/api-keys.js CHANGED
@@ -1,3 +1,56 @@
1
+ import { defineChain } from 'viem';
2
+
3
+ // src/chains.ts
4
+ var ARC_TESTNET_CHAIN_ID = 5042002;
5
+ var ARC_MAINNET_CHAIN_ID = 5042;
6
+ var NATIVE_USDC = {
7
+ name: "USDC",
8
+ symbol: "USDC",
9
+ decimals: 18
10
+ };
11
+ defineChain({
12
+ id: ARC_TESTNET_CHAIN_ID,
13
+ name: "Arc Testnet",
14
+ nativeCurrency: NATIVE_USDC,
15
+ rpcUrls: {
16
+ default: { http: ["https://rpc.testnet.arc.io"] },
17
+ public: { http: ["https://rpc.testnet.arc.io"] }
18
+ },
19
+ blockExplorers: {
20
+ default: {
21
+ name: "Arc Testnet Explorer",
22
+ url: "https://explorer.testnet.arc.io"
23
+ }
24
+ },
25
+ testnet: true
26
+ });
27
+ defineChain({
28
+ id: ARC_MAINNET_CHAIN_ID,
29
+ name: "Arc",
30
+ nativeCurrency: NATIVE_USDC,
31
+ rpcUrls: {
32
+ default: { http: ["https://rpc.mainnet.arc.io"] },
33
+ public: { http: ["https://rpc.mainnet.arc.io"] }
34
+ },
35
+ blockExplorers: {
36
+ default: {
37
+ name: "Arc Explorer",
38
+ url: "https://explorer.arc.io"
39
+ }
40
+ },
41
+ testnet: false
42
+ });
43
+ var ARC_ENVIRONMENTS = ["testnet", "mainnet"];
44
+ function isArcEnvironment(value) {
45
+ return typeof value === "string" && ARC_ENVIRONMENTS.includes(value);
46
+ }
47
+ function parseArcEnvironment(value) {
48
+ if (isArcEnvironment(value)) return value;
49
+ throw new Error(
50
+ `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(", ")}`
51
+ );
52
+ }
53
+
1
54
  // src/api-keys.ts
2
55
  var API_KEY_PREFIXES = {
3
56
  secret: {
@@ -24,7 +77,14 @@ function kindFromKey(key) {
24
77
  return null;
25
78
  }
26
79
  var API_KEY_PREFIX_DISPLAY_LENGTH = 12;
80
+ var MODE_BY_ENVIRONMENT = {
81
+ testnet: "test",
82
+ mainnet: "live"
83
+ };
84
+ function arcModeFor(env) {
85
+ return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)];
86
+ }
27
87
 
28
- export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, kindFromKey, modeFromKey, prefixFor };
88
+ export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, arcModeFor, kindFromKey, modeFromKey, prefixFor };
29
89
  //# sourceMappingURL=api-keys.js.map
30
90
  //# sourceMappingURL=api-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api-keys.ts"],"names":[],"mappings":";AAWO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAGO,IAAM,oBAAA,GAAuB;AAE7B,SAAS,SAAA,CAAU,MAAkB,IAAA,EAA0B;AACpE,EAAA,OAAO,gBAAA,CAAiB,IAAI,CAAA,CAAE,IAAI,CAAA;AACpC;AAEO,SAAS,YAAY,GAAA,EAAgC;AAC1D,EAAA,IAAI,GAAA,CAAI,WAAW,UAAU,CAAA,IAAK,IAAI,UAAA,CAAW,UAAU,GAAG,OAAO,MAAA;AACrE,EAAA,IAAI,GAAA,CAAI,WAAW,UAAU,CAAA,IAAK,IAAI,UAAA,CAAW,UAAU,GAAG,OAAO,MAAA;AACrE,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,YAAY,GAAA,EAAgC;AAC1D,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,EAAG,OAAO,QAAA;AAClC,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,EAAG,OAAO,aAAA;AAClC,EAAA,OAAO,IAAA;AACT;AAGO,IAAM,6BAAA,GAAgC","file":"api-keys.js","sourcesContent":["/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/api-keys.ts"],"names":[],"mappings":";;;AAaO,IAAM,oBAAA,GAAuB,OAAA;AAC7B,IAAM,oBAAA,GAAuB,IAAA;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,MAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAEiC,WAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAEgC,WAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,KAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,cAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,E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O,aAAA;AAClC,EAAA,OAAO,IAAA;AACT;AAGO,IAAM,6BAAA,GAAgC;AAE7C,IAAM,mBAAA,GAAsB;AAAA,EAC1B,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,WAAW,GAAA,EAAiC;AAC1D,EAAA,OAAO,mBAAA,CAAoB,mBAAA,CAAoB,GAAG,CAAC,CAAA;AACrD","file":"api-keys.js","sourcesContent":["/**\n * Arc blockchain definitions.\n *\n * Arc is Circle's stablecoin-native L1 where gas is paid in USDC.\n * - Testnet is live (chain id 5042002).\n * - Mainnet beta is expected in 2026; the mainnet entry is a placeholder\n * until Circle publishes the production chain id and RPC endpoint.\n *\n * @see https://docs.arc.network\n */\n\nimport { defineChain, type Chain } from 'viem'\n\nexport const ARC_TESTNET_CHAIN_ID = 5042002 as const\nexport const ARC_MAINNET_CHAIN_ID = 5042 as const\n\nconst NATIVE_USDC = {\n name: 'USDC',\n symbol: 'USDC',\n decimals: 18,\n} as const\n\nexport const arcTestnet: Chain = defineChain({\n id: ARC_TESTNET_CHAIN_ID,\n name: 'Arc Testnet',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.testnet.arc.io'] },\n public: { http: ['https://rpc.testnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Testnet Explorer',\n url: 'https://explorer.testnet.arc.io',\n },\n },\n testnet: true,\n})\n\nexport const arcMainnet: Chain = defineChain({\n id: ARC_MAINNET_CHAIN_ID,\n name: 'Arc',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.mainnet.arc.io'] },\n public: { http: ['https://rpc.mainnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Explorer',\n url: 'https://explorer.arc.io',\n },\n },\n testnet: false,\n})\n\nexport type ArcEnvironment = 'testnet' | 'mainnet'\n\nexport const ARC_CHAINS: Record<ArcEnvironment, Chain> = {\n testnet: arcTestnet,\n mainnet: arcMainnet,\n}\n\nexport const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const\n\nexport function isArcEnvironment(value: unknown): value is ArcEnvironment {\n return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)\n}\n\nexport function parseArcEnvironment(value: unknown): ArcEnvironment {\n if (isArcEnvironment(value)) return value\n throw new Error(\n `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,\n )\n}\n\nexport function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[parseArcEnvironment(env)]\n}\n\nexport function getArcExplorerUrl(env: ArcEnvironment): string {\n const explorer = getArcChain(env).blockExplorers?.default.url\n if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)\n return explorer\n}\n\nexport function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {\n return `${getArcExplorerUrl(env)}/tx/${txHash}`\n}\n\nexport function arcEnvironmentForChainId(chainId: number): ArcEnvironment {\n const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)\n if (!env) {\n throw new Error(\n `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,\n )\n }\n return env\n}\n\nexport function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {\n const expected = getArcChain(env).id\n if (rpcChainId !== expected) {\n throw new Error(\n `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,\n )\n }\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n"]}
package/dist/index.cjs CHANGED
@@ -142,68 +142,78 @@ function chainIdFor(env) {
142
142
  }
143
143
 
144
144
  // src/tiers.ts
145
- var TIERS = {
145
+ var PAID_FEATURES = [
146
+ "storefront",
147
+ "anomaly_alerts",
148
+ "yield_recommendations"
149
+ ];
150
+ var PLANS = {
146
151
  free: {
147
152
  id: "free",
148
153
  name: "Free",
149
- monthlyFeeUsdCents: 0,
150
- oneShotFeeBps: 150,
151
- // 1.5%
152
- subscriptionPremiumBps: 20,
153
- // +0.2% on recurring => 1.7% effective
154
- monthlyVolumeCapUsdCents: 1e6,
155
- // $10,000
156
- whiteLabelEligible: false,
154
+ feeBps: 0,
155
+ entersAtVolume: 0,
156
+ features: [],
157
157
  prioritySupport: false
158
158
  },
159
+ starter: {
160
+ id: "starter",
161
+ name: "Starter",
162
+ feeBps: 50,
163
+ entersAtVolume: 1e3,
164
+ features: PAID_FEATURES,
165
+ prioritySupport: true
166
+ },
159
167
  growth: {
160
168
  id: "growth",
161
169
  name: "Growth",
162
- monthlyFeeUsdCents: 4900,
163
- // $49
164
- oneShotFeeBps: 80,
165
- // 0.8%
166
- subscriptionPremiumBps: 20,
167
- // 1.0% effective
168
- monthlyVolumeCapUsdCents: 1e7,
169
- // $100,000
170
- whiteLabelEligible: true,
171
- prioritySupport: false
172
- },
173
- business: {
174
- id: "business",
175
- name: "Business",
176
- monthlyFeeUsdCents: 19900,
177
- // $199
178
- oneShotFeeBps: 50,
179
- // 0.5%
180
- subscriptionPremiumBps: 20,
181
- // 0.7% effective
182
- monthlyVolumeCapUsdCents: 1e8,
183
- // $1,000,000
184
- whiteLabelEligible: true,
170
+ feeBps: 40,
171
+ entersAtVolume: 5e4,
172
+ features: PAID_FEATURES,
185
173
  prioritySupport: true
186
174
  },
187
175
  enterprise: {
188
176
  id: "enterprise",
189
177
  name: "Enterprise",
190
- monthlyFeeUsdCents: null,
191
- oneShotFeeBps: null,
192
- subscriptionPremiumBps: null,
193
- monthlyVolumeCapUsdCents: null,
194
- whiteLabelEligible: true,
178
+ feeBps: null,
179
+ entersAtVolume: null,
180
+ features: PAID_FEATURES,
195
181
  prioritySupport: true
196
182
  }
197
183
  };
198
184
  var DEFAULT_TIER = "free";
199
- function getTier(id) {
200
- return TIERS[id];
185
+ var PLAN_ORDER = ["free", "starter", "growth", "enterprise"];
186
+ var VOLUME_PLANS = ["free", "starter", "growth"];
187
+ var PLAN_FEE_CEILING_BPS = Math.max(
188
+ ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0)
189
+ );
190
+ function planFeeBps(plan) {
191
+ return PLANS[plan].feeBps;
192
+ }
193
+ function planIncludes(plan, feature) {
194
+ return PLANS[plan].features.includes(feature);
195
+ }
196
+ function plansWith(feature) {
197
+ return PLAN_ORDER.filter((plan) => planIncludes(plan, feature));
201
198
  }
202
- function effectiveFeeBps(tier, kind) {
203
- const def = TIERS[tier];
204
- if (def.oneShotFeeBps === null) return null;
205
- if (kind === "one_shot") return def.oneShotFeeBps;
206
- return def.oneShotFeeBps + (def.subscriptionPremiumBps ?? 0);
199
+ function lowestPlanWith(feature) {
200
+ const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature));
201
+ if (!plan) throw new Error(`no plan includes ${feature}`);
202
+ return plan;
203
+ }
204
+ function thresholdInBaseUnits(plan, token) {
205
+ const wholeUnits = PLANS[plan].entersAtVolume;
206
+ if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`);
207
+ return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals);
208
+ }
209
+ function planForVolume(volumes) {
210
+ let reached = "free";
211
+ for (const plan of VOLUME_PLANS) {
212
+ if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {
213
+ reached = plan;
214
+ }
215
+ }
216
+ return reached;
207
217
  }
208
218
 
209
219
  // src/webhooks.ts
@@ -294,6 +304,13 @@ function kindFromKey(key) {
294
304
  return null;
295
305
  }
296
306
  var API_KEY_PREFIX_DISPLAY_LENGTH = 12;
307
+ var MODE_BY_ENVIRONMENT = {
308
+ testnet: "test",
309
+ mainnet: "live"
310
+ };
311
+ function arcModeFor(env) {
312
+ return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)];
313
+ }
297
314
 
298
315
  // src/agents.ts
299
316
  var AGENT_CAPABILITIES = {
@@ -411,8 +428,9 @@ exports.CCTP_DOMAIN_IDS = CCTP_DOMAIN_IDS;
411
428
  exports.CCTP_SUPPORTED_SOURCE_CHAINS = CCTP_SUPPORTED_SOURCE_CHAINS;
412
429
  exports.DEFAULT_TIER = DEFAULT_TIER;
413
430
  exports.PAYMENT_TOKENS = PAYMENT_TOKENS;
431
+ exports.PLANS = PLANS;
432
+ exports.PLAN_FEE_CEILING_BPS = PLAN_FEE_CEILING_BPS;
414
433
  exports.RECOVERY_GRACE_PERIODS = RECOVERY_GRACE_PERIODS;
415
- exports.TIERS = TIERS;
416
434
  exports.TOKENS = TOKENS;
417
435
  exports.TOKEN_ADDRESSES = TOKEN_ADDRESSES;
418
436
  exports.WEBHOOK_DELIVERY_ID_HEADER = WEBHOOK_DELIVERY_ID_HEADER;
@@ -424,22 +442,26 @@ exports.WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = WEBHOOK_SIGNATURE_TOLERANCE_SECOND
424
442
  exports.arcEnvironmentForChainId = arcEnvironmentForChainId;
425
443
  exports.arcExplorerTxUrl = arcExplorerTxUrl;
426
444
  exports.arcMainnet = arcMainnet;
445
+ exports.arcModeFor = arcModeFor;
427
446
  exports.arcTestnet = arcTestnet;
428
447
  exports.assertArcChainId = assertArcChainId;
429
448
  exports.chainIdFor = chainIdFor;
430
- exports.effectiveFeeBps = effectiveFeeBps;
431
449
  exports.getArcChain = getArcChain;
432
450
  exports.getArcExplorerUrl = getArcExplorerUrl;
433
451
  exports.getCctpContracts = getCctpContracts;
434
- exports.getTier = getTier;
435
452
  exports.getTokenAddress = getTokenAddress;
436
453
  exports.getTokenBySymbol = getTokenBySymbol;
437
454
  exports.isArcChain = isArcChain;
438
455
  exports.isArcEnvironment = isArcEnvironment;
439
456
  exports.isPaymentToken = isPaymentToken;
440
457
  exports.kindFromKey = kindFromKey;
458
+ exports.lowestPlanWith = lowestPlanWith;
441
459
  exports.modeFromKey = modeFromKey;
442
460
  exports.parseArcEnvironment = parseArcEnvironment;
461
+ exports.planFeeBps = planFeeBps;
462
+ exports.planForVolume = planForVolume;
463
+ exports.planIncludes = planIncludes;
464
+ exports.plansWith = plansWith;
443
465
  exports.prefixFor = prefixFor;
444
466
  //# sourceMappingURL=index.cjs.map
445
467
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chains.ts","../src/tokens.ts","../src/tiers.ts","../src/webhooks.ts","../src/api-keys.ts","../src/agents.ts","../src/cctp.ts"],"names":["defineChain"],"mappings":";;;;;AAaO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,oBAAA,GAAuB;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,MAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAEO,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAEM,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,KAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,cAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAIM,IAAM,UAAA,GAA4C;AAAA,EACvD,OAAA,EAAS,UAAA;AAA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AAA;AAAA,IAClB,oBAAA,EAAsB,4CAAA;AAAA,IACtB,aAAA,EAAe,4CAAA;AAAA,IACf,aAAA,EAAe,4CAAA;AAAA,IACf,QAAA,EAAU;AAAA;AAEd;AAGO,IAAM,eAAA,GAAkB;AAAA,EAC7B,QAAA,EAAU,CAAA;AAAA,EACV,SAAA,EAAW,CAAA;AAAA,EACX,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU,CAAA;AAAA,EACV,KAAA,EAAO,CAAA;AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,IAAA,EAAM,CAAA;AAAA,EACN,OAAA,EAAS,CAAA;AAAA,EACT,GAAA,EAAK;AACP;AAIO,IAAM,4BAAA,GAA2D;AAAA,EACtE,UAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AAEO,SAAS,iBAAiB,GAAA,EAAsC;AACrE,EAAA,OAAO,cAAA,CAAe,mBAAA,CAAoB,GAAG,CAAC,CAAA;AAChD","file":"index.cjs","sourcesContent":["/**\n * Arc blockchain definitions.\n *\n * Arc is Circle's stablecoin-native L1 where gas is paid in USDC.\n * - Testnet is live (chain id 5042002).\n * - Mainnet beta is expected in 2026; the mainnet entry is a placeholder\n * until Circle publishes the production chain id and RPC endpoint.\n *\n * @see https://docs.arc.network\n */\n\nimport { defineChain, type Chain } from 'viem'\n\nexport const ARC_TESTNET_CHAIN_ID = 5042002 as const\nexport const ARC_MAINNET_CHAIN_ID = 5042 as const\n\nconst NATIVE_USDC = {\n name: 'USDC',\n symbol: 'USDC',\n decimals: 18,\n} as const\n\nexport const arcTestnet: Chain = defineChain({\n id: ARC_TESTNET_CHAIN_ID,\n name: 'Arc Testnet',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.testnet.arc.io'] },\n public: { http: ['https://rpc.testnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Testnet Explorer',\n url: 'https://explorer.testnet.arc.io',\n },\n },\n testnet: true,\n})\n\nexport const arcMainnet: Chain = defineChain({\n id: ARC_MAINNET_CHAIN_ID,\n name: 'Arc',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.mainnet.arc.io'] },\n public: { http: ['https://rpc.mainnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Explorer',\n url: 'https://explorer.arc.io',\n },\n },\n testnet: false,\n})\n\nexport type ArcEnvironment = 'testnet' | 'mainnet'\n\nexport const ARC_CHAINS: Record<ArcEnvironment, Chain> = {\n testnet: arcTestnet,\n mainnet: arcMainnet,\n}\n\nexport const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const\n\nexport function isArcEnvironment(value: unknown): value is ArcEnvironment {\n return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)\n}\n\nexport function parseArcEnvironment(value: unknown): ArcEnvironment {\n if (isArcEnvironment(value)) return value\n throw new Error(\n `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,\n )\n}\n\nexport function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[parseArcEnvironment(env)]\n}\n\nexport function getArcExplorerUrl(env: ArcEnvironment): string {\n const explorer = getArcChain(env).blockExplorers?.default.url\n if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)\n return explorer\n}\n\nexport function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {\n return `${getArcExplorerUrl(env)}/tx/${txHash}`\n}\n\nexport function arcEnvironmentForChainId(chainId: number): ArcEnvironment {\n const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)\n if (!env) {\n throw new Error(\n `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,\n )\n }\n return env\n}\n\nexport function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {\n const expected = getArcChain(env).id\n if (rpcChainId !== expected) {\n throw new Error(\n `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,\n )\n }\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n","/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nexport type MerchantTier = 'free' | 'growth' | 'business' | 'enterprise'\n\nexport interface TierDefinition {\n id: MerchantTier\n name: string\n /** Monthly fee in USD cents (0 for free, null for custom enterprise). */\n monthlyFeeUsdCents: number | null\n /** Per-transaction fee on one-shot payments, in basis points. */\n oneShotFeeBps: number | null\n /** Per-transaction premium added on subscription payments, in basis points. */\n subscriptionPremiumBps: number | null\n /** Monthly transaction volume cap in USD cents. `null` for unlimited. */\n monthlyVolumeCapUsdCents: number | null\n /** Whether the \"Powered by Strimz\" badge can be removed from checkout. */\n whiteLabelEligible: boolean\n /** Whether the tier includes priority support. */\n prioritySupport: boolean\n}\n\nexport const TIERS: Record<MerchantTier, TierDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n monthlyFeeUsdCents: 0,\n oneShotFeeBps: 150, // 1.5%\n subscriptionPremiumBps: 20, // +0.2% on recurring => 1.7% effective\n monthlyVolumeCapUsdCents: 1_000_000, // $10,000\n whiteLabelEligible: false,\n prioritySupport: false,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n monthlyFeeUsdCents: 4_900, // $49\n oneShotFeeBps: 80, // 0.8%\n subscriptionPremiumBps: 20, // 1.0% effective\n monthlyVolumeCapUsdCents: 10_000_000, // $100,000\n whiteLabelEligible: true,\n prioritySupport: false,\n },\n business: {\n id: 'business',\n name: 'Business',\n monthlyFeeUsdCents: 19_900, // $199\n oneShotFeeBps: 50, // 0.5%\n subscriptionPremiumBps: 20, // 0.7% effective\n monthlyVolumeCapUsdCents: 100_000_000, // $1,000,000\n whiteLabelEligible: true,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n monthlyFeeUsdCents: null,\n oneShotFeeBps: null,\n subscriptionPremiumBps: null,\n monthlyVolumeCapUsdCents: null,\n whiteLabelEligible: true,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nexport function getTier(id: MerchantTier): TierDefinition {\n return TIERS[id]\n}\n\n/**\n * Effective fee in bps for a given tier and payment kind.\n * Returns `null` for the enterprise tier (custom-priced).\n */\nexport function effectiveFeeBps(\n tier: MerchantTier,\n kind: 'one_shot' | 'subscription',\n): number | null {\n const def = TIERS[tier]\n if (def.oneShotFeeBps === null) return null\n if (kind === 'one_shot') return def.oneShotFeeBps\n return def.oneShotFeeBps + (def.subscriptionPremiumBps ?? 0)\n}\n","/**\n * Webhook event names.\n *\n * Wire format is `<resource>.<action>`. Every event payload is versioned at\n * the envelope level so additive changes do not break consumers.\n */\n\nexport const WEBHOOK_EVENTS = {\n payment: {\n created: 'payment.created',\n completed: 'payment.completed',\n failed: 'payment.failed',\n },\n subscription: {\n created: 'subscription.created',\n charged: 'subscription.charged',\n chargeFailed: 'subscription.charge_failed',\n recoveryAttempt: 'subscription.recovery_attempt',\n recoveryOutcome: 'subscription.recovery_outcome',\n cancelled: 'subscription.cancelled',\n lapsed: 'subscription.lapsed',\n },\n refund: {\n created: 'refund.created',\n completed: 'refund.completed',\n failed: 'refund.failed',\n },\n invoice: {\n created: 'invoice.created',\n paid: 'invoice.paid',\n overdue: 'invoice.overdue',\n },\n agent: {\n actionExecuted: 'agent.action_executed',\n jobProposed: 'agent.job_proposed',\n jobCompleted: 'agent.job_completed',\n jobDisputed: 'agent.job_disputed',\n },\n compliance: {\n walletFlagged: 'compliance.wallet_flagged',\n walletBlocked: 'compliance.wallet_blocked',\n },\n} as const\n\nexport type WebhookEventName =\n | (typeof WEBHOOK_EVENTS.payment)[keyof typeof WEBHOOK_EVENTS.payment]\n | (typeof WEBHOOK_EVENTS.subscription)[keyof typeof WEBHOOK_EVENTS.subscription]\n | (typeof WEBHOOK_EVENTS.refund)[keyof typeof WEBHOOK_EVENTS.refund]\n | (typeof WEBHOOK_EVENTS.invoice)[keyof typeof WEBHOOK_EVENTS.invoice]\n | (typeof WEBHOOK_EVENTS.agent)[keyof typeof WEBHOOK_EVENTS.agent]\n | (typeof WEBHOOK_EVENTS.compliance)[keyof typeof WEBHOOK_EVENTS.compliance]\n\nexport const ALL_WEBHOOK_EVENTS: readonly WebhookEventName[] = [\n ...Object.values(WEBHOOK_EVENTS.payment),\n ...Object.values(WEBHOOK_EVENTS.subscription),\n ...Object.values(WEBHOOK_EVENTS.refund),\n ...Object.values(WEBHOOK_EVENTS.invoice),\n ...Object.values(WEBHOOK_EVENTS.agent),\n ...Object.values(WEBHOOK_EVENTS.compliance),\n] as const\n\n/** Exponential backoff schedule for webhook delivery, in seconds. */\nexport const WEBHOOK_RETRY_SCHEDULE_SECONDS: readonly number[] = [\n 60, // 1 minute\n 300, // 5 minutes\n 1_800, // 30 minutes\n 7_200, // 2 hours\n 86_400, // 24 hours\n] as const\n\nexport const WEBHOOK_MAX_ATTEMPTS = WEBHOOK_RETRY_SCHEDULE_SECONDS.length + 1\n\n/** Webhook signatures older than this are rejected to prevent replay. */\nexport const WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = 300\n\n/** HTTP header carrying the HMAC signature. */\nexport const WEBHOOK_SIGNATURE_HEADER = 'strimz-signature'\n\n/** HTTP header carrying the unique delivery id (idempotency key for the receiver). */\nexport const WEBHOOK_DELIVERY_ID_HEADER = 'strimz-delivery-id'\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n","/**\n * Strimz AutoPay Agent feature flags and defaults.\n *\n * The agent is composed of independent capabilities that can be enabled or\n * disabled per merchant. Defaults are conservative. Merchants opt in to\n * value-moving capabilities (recovery retries, treasury auto-convert).\n */\n\nexport type AgentCapability =\n | 'identity'\n | 'recovery'\n | 'routing'\n | 'cashflow'\n | 'commerce'\n | 'pricing_intelligence'\n\nexport interface AgentCapabilityDescriptor {\n id: AgentCapability\n name: string\n /** Whether the capability moves money or signs transactions. */\n valueMoving: boolean\n /** Default enabled state for a newly created merchant. */\n defaultEnabled: boolean\n}\n\nexport const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor> = {\n identity: {\n id: 'identity',\n name: 'Agent Identity (ERC-8004)',\n valueMoving: false,\n defaultEnabled: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n },\n}\n\nexport type GracePeriodHours = 24 | 48 | 72\n\nexport const RECOVERY_GRACE_PERIODS: readonly GracePeriodHours[] = [24, 48, 72] as const\n\nexport type RecoveryRetryStrategy = 'once' | 'twice' | 'until_grace_ends'\n\nexport interface AgentDefaultConfig {\n recovery: {\n gracePeriodHours: GracePeriodHours\n strategy: RecoveryRetryStrategy\n }\n cashflow: {\n digestEnabled: boolean\n anomalySensitivity: 'low' | 'medium' | 'high'\n autoConvertToYield: boolean\n }\n commerce: {\n requireHumanApprovalAboveUsdCents: number\n }\n}\n\nexport const AGENT_DEFAULTS: AgentDefaultConfig = {\n recovery: {\n gracePeriodHours: 48,\n strategy: 'twice',\n },\n cashflow: {\n digestEnabled: false,\n anomalySensitivity: 'medium',\n autoConvertToYield: false,\n },\n commerce: {\n requireHumanApprovalAboveUsdCents: 100_000, // $1,000\n },\n}\n\n/** Time-to-live for the agent activity log, in days. */\nexport const AGENT_ACTIVITY_LOG_RETENTION_DAYS = 90\n","/**\n * Circle CCTP V2 contract addresses for Arc.\n *\n * CCTP lets a payer hold USDC on any supported chain (Ethereum, Base, Polygon,\n * Arbitrum, Solana, etc.) and pay a Strimz merchant who receives Arc USDC.\n *\n * @see https://developers.circle.com/stablecoins/cctp-getting-started\n */\n\nimport type { Address } from 'viem'\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport interface CCTPContractSet {\n tokenMessengerV2: Address\n messageTransmitterV2: Address\n gatewayWallet: Address\n gatewayMinter: Address\n /** CCTP domain identifier for the destination chain. */\n domainId: number\n}\n\nexport const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {\n testnet: {\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\n domainId: 26,\n },\n mainnet: {\n // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.\n // Testnet values are mirrored as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',\n messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',\n gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',\n gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',\n domainId: 26,\n },\n}\n\n/** CCTP domain ids for source chains a payer can bridge from. */\nexport const CCTP_DOMAIN_IDS = {\n ethereum: 0,\n avalanche: 1,\n optimism: 2,\n arbitrum: 3,\n noble: 4,\n solana: 5,\n base: 6,\n polygon: 7,\n arc: 26,\n} as const\n\nexport type CCTPSourceChain = keyof typeof CCTP_DOMAIN_IDS\n\nexport const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [\n 'ethereum',\n 'avalanche',\n 'optimism',\n 'arbitrum',\n 'base',\n 'polygon',\n 'solana',\n] as const\n\nexport function getCctpContracts(env: ArcEnvironment): CCTPContractSet {\n return CCTP_CONTRACTS[parseArcEnvironment(env)]\n}\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/tokens.ts","../src/tiers.ts","../src/webhooks.ts","../src/api-keys.ts","../src/agents.ts","../src/cctp.ts"],"names":["defineChain"],"mappings":";;;;;AAaO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,oBAAA,GAAuB;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,MAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAEO,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAEM,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,KAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM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;AAAA,IACf,aAAA,EAAe,4CAAA;AAAA,IACf,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,OAAA,EAAS;AAAA;AAAA;AAAA,IAGP,gBAAA,EAAkB,4CAAA;AAAA,IAClB,oBAAA,EAAsB,4CAAA;AAAA,IACtB,aAAA,EAAe,4CAAA;AAAA,IACf,aAAA,EAAe,4CAAA;AAAA,IACf,QAAA,EAAU;AAAA;AAEd;AAGO,IAAM,eAAA,GAAkB;AAAA,EAC7B,QAAA,EAAU,CAAA;AAAA,EACV,SAAA,EAAW,CAAA;AAAA,EACX,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU,CAAA;AAAA,EACV,KAAA,EAAO,CAAA;AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,IAAA,EAAM,CAAA;AAAA,EACN,OAAA,EAAS,CAAA;AAAA,EACT,GAAA,EAAK;AACP;AAIO,IAAM,4BAAA,GAA2D;AAAA,EACtE,UAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AAEO,SAAS,iBAAiB,GAAA,EAAsC;AACrE,EAAA,OAAO,cAAA,CAAe,mBAAA,CAAoB,GAAG,CAAC,CAAA;AAChD","file":"index.cjs","sourcesContent":["/**\n * Arc blockchain definitions.\n *\n * Arc is Circle's stablecoin-native L1 where gas is paid in USDC.\n * - Testnet is live (chain id 5042002).\n * - Mainnet beta is expected in 2026; the mainnet entry is a placeholder\n * until Circle publishes the production chain id and RPC endpoint.\n *\n * @see https://docs.arc.network\n */\n\nimport { defineChain, type Chain } from 'viem'\n\nexport const ARC_TESTNET_CHAIN_ID = 5042002 as const\nexport const ARC_MAINNET_CHAIN_ID = 5042 as const\n\nconst NATIVE_USDC = {\n name: 'USDC',\n symbol: 'USDC',\n decimals: 18,\n} as const\n\nexport const arcTestnet: Chain = defineChain({\n id: ARC_TESTNET_CHAIN_ID,\n name: 'Arc Testnet',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.testnet.arc.io'] },\n public: { http: ['https://rpc.testnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Testnet Explorer',\n url: 'https://explorer.testnet.arc.io',\n },\n },\n testnet: true,\n})\n\nexport const arcMainnet: Chain = defineChain({\n id: ARC_MAINNET_CHAIN_ID,\n name: 'Arc',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.mainnet.arc.io'] },\n public: { http: ['https://rpc.mainnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Explorer',\n url: 'https://explorer.arc.io',\n },\n },\n testnet: false,\n})\n\nexport type ArcEnvironment = 'testnet' | 'mainnet'\n\nexport const ARC_CHAINS: Record<ArcEnvironment, Chain> = {\n testnet: arcTestnet,\n mainnet: arcMainnet,\n}\n\nexport const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const\n\nexport function isArcEnvironment(value: unknown): value is ArcEnvironment {\n return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)\n}\n\nexport function parseArcEnvironment(value: unknown): ArcEnvironment {\n if (isArcEnvironment(value)) return value\n throw new Error(\n `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,\n )\n}\n\nexport function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[parseArcEnvironment(env)]\n}\n\nexport function getArcExplorerUrl(env: ArcEnvironment): string {\n const explorer = getArcChain(env).blockExplorers?.default.url\n if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)\n return explorer\n}\n\nexport function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {\n return `${getArcExplorerUrl(env)}/tx/${txHash}`\n}\n\nexport function arcEnvironmentForChainId(chainId: number): ArcEnvironment {\n const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)\n if (!env) {\n throw new Error(\n `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,\n )\n }\n return env\n}\n\nexport function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {\n const expected = getArcChain(env).id\n if (rpcChainId !== expected) {\n throw new Error(\n `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,\n )\n }\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n","/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n","/**\n * Webhook event names.\n *\n * Wire format is `<resource>.<action>`. Every event payload is versioned at\n * the envelope level so additive changes do not break consumers.\n */\n\nexport const WEBHOOK_EVENTS = {\n payment: {\n created: 'payment.created',\n completed: 'payment.completed',\n failed: 'payment.failed',\n },\n subscription: {\n created: 'subscription.created',\n charged: 'subscription.charged',\n chargeFailed: 'subscription.charge_failed',\n recoveryAttempt: 'subscription.recovery_attempt',\n recoveryOutcome: 'subscription.recovery_outcome',\n cancelled: 'subscription.cancelled',\n lapsed: 'subscription.lapsed',\n },\n refund: {\n created: 'refund.created',\n completed: 'refund.completed',\n failed: 'refund.failed',\n },\n invoice: {\n created: 'invoice.created',\n paid: 'invoice.paid',\n overdue: 'invoice.overdue',\n },\n agent: {\n actionExecuted: 'agent.action_executed',\n jobProposed: 'agent.job_proposed',\n jobCompleted: 'agent.job_completed',\n jobDisputed: 'agent.job_disputed',\n },\n compliance: {\n walletFlagged: 'compliance.wallet_flagged',\n walletBlocked: 'compliance.wallet_blocked',\n },\n} as const\n\nexport type WebhookEventName =\n | (typeof WEBHOOK_EVENTS.payment)[keyof typeof WEBHOOK_EVENTS.payment]\n | (typeof WEBHOOK_EVENTS.subscription)[keyof typeof WEBHOOK_EVENTS.subscription]\n | (typeof WEBHOOK_EVENTS.refund)[keyof typeof WEBHOOK_EVENTS.refund]\n | (typeof WEBHOOK_EVENTS.invoice)[keyof typeof WEBHOOK_EVENTS.invoice]\n | (typeof WEBHOOK_EVENTS.agent)[keyof typeof WEBHOOK_EVENTS.agent]\n | (typeof WEBHOOK_EVENTS.compliance)[keyof typeof WEBHOOK_EVENTS.compliance]\n\nexport const ALL_WEBHOOK_EVENTS: readonly WebhookEventName[] = [\n ...Object.values(WEBHOOK_EVENTS.payment),\n ...Object.values(WEBHOOK_EVENTS.subscription),\n ...Object.values(WEBHOOK_EVENTS.refund),\n ...Object.values(WEBHOOK_EVENTS.invoice),\n ...Object.values(WEBHOOK_EVENTS.agent),\n ...Object.values(WEBHOOK_EVENTS.compliance),\n] as const\n\n/** Exponential backoff schedule for webhook delivery, in seconds. */\nexport const WEBHOOK_RETRY_SCHEDULE_SECONDS: readonly number[] = [\n 60, // 1 minute\n 300, // 5 minutes\n 1_800, // 30 minutes\n 7_200, // 2 hours\n 86_400, // 24 hours\n] as const\n\nexport const WEBHOOK_MAX_ATTEMPTS = WEBHOOK_RETRY_SCHEDULE_SECONDS.length + 1\n\n/** Webhook signatures older than this are rejected to prevent replay. */\nexport const WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = 300\n\n/** HTTP header carrying the HMAC signature. */\nexport const WEBHOOK_SIGNATURE_HEADER = 'strimz-signature'\n\n/** HTTP header carrying the unique delivery id (idempotency key for the receiver). */\nexport const WEBHOOK_DELIVERY_ID_HEADER = 'strimz-delivery-id'\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n","/**\n * Strimz AutoPay Agent feature flags and defaults.\n *\n * The agent is composed of independent capabilities that can be enabled or\n * disabled per merchant. Defaults are conservative. Merchants opt in to\n * value-moving capabilities (recovery retries, treasury auto-convert).\n */\n\nexport type AgentCapability =\n | 'identity'\n | 'recovery'\n | 'routing'\n | 'cashflow'\n | 'commerce'\n | 'pricing_intelligence'\n\nexport interface AgentCapabilityDescriptor {\n id: AgentCapability\n name: string\n /** Whether the capability moves money or signs transactions. */\n valueMoving: boolean\n /** Default enabled state for a newly created merchant. */\n defaultEnabled: boolean\n}\n\nexport const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor> = {\n identity: {\n id: 'identity',\n name: 'Agent Identity (ERC-8004)',\n valueMoving: false,\n defaultEnabled: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n },\n}\n\nexport type GracePeriodHours = 24 | 48 | 72\n\nexport const RECOVERY_GRACE_PERIODS: readonly GracePeriodHours[] = [24, 48, 72] as const\n\nexport type RecoveryRetryStrategy = 'once' | 'twice' | 'until_grace_ends'\n\nexport interface AgentDefaultConfig {\n recovery: {\n gracePeriodHours: GracePeriodHours\n strategy: RecoveryRetryStrategy\n }\n cashflow: {\n digestEnabled: boolean\n anomalySensitivity: 'low' | 'medium' | 'high'\n autoConvertToYield: boolean\n }\n commerce: {\n requireHumanApprovalAboveUsdCents: number\n }\n}\n\nexport const AGENT_DEFAULTS: AgentDefaultConfig = {\n recovery: {\n gracePeriodHours: 48,\n strategy: 'twice',\n },\n cashflow: {\n digestEnabled: false,\n anomalySensitivity: 'medium',\n autoConvertToYield: false,\n },\n commerce: {\n requireHumanApprovalAboveUsdCents: 100_000, // $1,000\n },\n}\n\n/** Time-to-live for the agent activity log, in days. */\nexport const AGENT_ACTIVITY_LOG_RETENTION_DAYS = 90\n","/**\n * Circle CCTP V2 contract addresses for Arc.\n *\n * CCTP lets a payer hold USDC on any supported chain (Ethereum, Base, Polygon,\n * Arbitrum, Solana, etc.) and pay a Strimz merchant who receives Arc USDC.\n *\n * @see https://developers.circle.com/stablecoins/cctp-getting-started\n */\n\nimport type { Address } from 'viem'\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport interface CCTPContractSet {\n tokenMessengerV2: Address\n messageTransmitterV2: Address\n gatewayWallet: Address\n gatewayMinter: Address\n /** CCTP domain identifier for the destination chain. */\n domainId: number\n}\n\nexport const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {\n testnet: {\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\n domainId: 26,\n },\n mainnet: {\n // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.\n // Testnet values are mirrored as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',\n messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',\n gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',\n gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',\n domainId: 26,\n },\n}\n\n/** CCTP domain ids for source chains a payer can bridge from. */\nexport const CCTP_DOMAIN_IDS = {\n ethereum: 0,\n avalanche: 1,\n optimism: 2,\n arbitrum: 3,\n noble: 4,\n solana: 5,\n base: 6,\n polygon: 7,\n arc: 26,\n} as const\n\nexport type CCTPSourceChain = keyof typeof CCTP_DOMAIN_IDS\n\nexport const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [\n 'ethereum',\n 'avalanche',\n 'optimism',\n 'arbitrum',\n 'base',\n 'polygon',\n 'solana',\n] as const\n\nexport function getCctpContracts(env: ArcEnvironment): CCTPContractSet {\n return CCTP_CONTRACTS[parseArcEnvironment(env)]\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, ArcEnvironment, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcTestnet, assertArcChainId, getArcChain, getArcExplorerUrl, isArcChain, isArcEnvironment, parseArcEnvironment } from './chains.cjs';
2
2
  export { PAYMENT_TOKENS, PaymentToken, TOKENS, TOKEN_ADDRESSES, TokenAddress, TokenDescriptor, TokenSymbol, chainIdFor, getTokenAddress, getTokenBySymbol, isPaymentToken } from './tokens.cjs';
3
- export { DEFAULT_TIER, MerchantTier, TIERS, TierDefinition, effectiveFeeBps, getTier } from './tiers.cjs';
3
+ export { DEFAULT_TIER, MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, PaymentVolumes, PlanDefinition, PlanFeature, VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith } from './tiers.cjs';
4
4
  export { ALL_WEBHOOK_EVENTS, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENTS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_SCHEDULE_SECONDS, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WebhookEventName } from './webhooks.cjs';
5
- export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ApiKeyKind, ApiKeyMode, kindFromKey, modeFromKey, prefixFor } from './api-keys.cjs';
5
+ export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ApiKeyKind, ApiKeyMode, arcModeFor, kindFromKey, modeFromKey, prefixFor } from './api-keys.cjs';
6
6
  export { AGENT_ACTIVITY_LOG_RETENTION_DAYS, AGENT_CAPABILITIES, AGENT_DEFAULTS, AgentCapability, AgentCapabilityDescriptor, AgentDefaultConfig, GracePeriodHours, RECOVERY_GRACE_PERIODS, RecoveryRetryStrategy } from './agents.cjs';
7
7
  export { CCTPContractSet, CCTPSourceChain, CCTP_CONTRACTS, CCTP_DOMAIN_IDS, CCTP_SUPPORTED_SOURCE_CHAINS, getCctpContracts } from './cctp.cjs';
8
8
  import 'viem';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, ArcEnvironment, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcTestnet, assertArcChainId, getArcChain, getArcExplorerUrl, isArcChain, isArcEnvironment, parseArcEnvironment } from './chains.js';
2
2
  export { PAYMENT_TOKENS, PaymentToken, TOKENS, TOKEN_ADDRESSES, TokenAddress, TokenDescriptor, TokenSymbol, chainIdFor, getTokenAddress, getTokenBySymbol, isPaymentToken } from './tokens.js';
3
- export { DEFAULT_TIER, MerchantTier, TIERS, TierDefinition, effectiveFeeBps, getTier } from './tiers.js';
3
+ export { DEFAULT_TIER, MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, PaymentVolumes, PlanDefinition, PlanFeature, VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith } from './tiers.js';
4
4
  export { ALL_WEBHOOK_EVENTS, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENTS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_SCHEDULE_SECONDS, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WebhookEventName } from './webhooks.js';
5
- export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ApiKeyKind, ApiKeyMode, kindFromKey, modeFromKey, prefixFor } from './api-keys.js';
5
+ export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ApiKeyKind, ApiKeyMode, arcModeFor, kindFromKey, modeFromKey, prefixFor } from './api-keys.js';
6
6
  export { AGENT_ACTIVITY_LOG_RETENTION_DAYS, AGENT_CAPABILITIES, AGENT_DEFAULTS, AgentCapability, AgentCapabilityDescriptor, AgentDefaultConfig, GracePeriodHours, RECOVERY_GRACE_PERIODS, RecoveryRetryStrategy } from './agents.js';
7
7
  export { CCTPContractSet, CCTPSourceChain, CCTP_CONTRACTS, CCTP_DOMAIN_IDS, CCTP_SUPPORTED_SOURCE_CHAINS, getCctpContracts } from './cctp.js';
8
8
  import 'viem';