@strimz/shared-config 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,40 @@
1
1
  # @strimz/shared-config
2
2
 
3
- Single source of truth for the Strimz platform's environment-independent constants. If a value (chain id, token address, fee tier, webhook event name, agent flag, CCTP contract) needs to be referenced by more than one app or package, it lives here.
3
+ > Chain definitions, token registry, fee tiers, webhook events, and agent flags for the Strimz platform.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@strimz/shared-config.svg?color=02C76A)](https://www.npmjs.com/package/@strimz/shared-config)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@strimz/shared-config.svg)](https://www.npmjs.com/package/@strimz/shared-config)
7
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@strimz/shared-config.svg?label=size)](https://bundlephobia.com/package/@strimz/shared-config)
8
+ [![types](https://img.shields.io/npm/types/@strimz/shared-config.svg)](https://www.npmjs.com/package/@strimz/shared-config)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-02C76A.svg)](./LICENSE)
10
+
11
+ The constants every Strimz app and package needs to agree on. Chain
12
+ ids and RPC defaults, token addresses across networks, the platform's
13
+ fee tier table, webhook event names, the CCTP V2 contract registry,
14
+ and the agent capability list. Pure data and pure functions. No
15
+ `process.env` reads, no I/O.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ pnpm add @strimz/shared-config
21
+ # npm install @strimz/shared-config
22
+ # yarn add @strimz/shared-config
23
+ ```
24
+
25
+ ## Quick start
26
+
27
+ ```ts
28
+ import { arcTestnet, getTokenAddress, effectiveFeeBps } from '@strimz/shared-config'
29
+
30
+ const usdcOnTestnet = getTokenAddress('testnet', 'USDC')
31
+ const recurringFeeBps = effectiveFeeBps('growth', 'subscription') // 100 bps
32
+ ```
4
33
 
5
34
  ## Modules
6
35
 
36
+ Every group is also available as a subpath import for tree-shaking.
37
+
7
38
  | Subpath | Exports |
8
39
  | -------------------------------- | ------------------------------------------------------------------------------------- |
9
40
  | `@strimz/shared-config/chains` | `arcTestnet`, `arcMainnet`, `getArcChain`, `isArcChain`, chain id constants |
@@ -16,17 +47,25 @@ Single source of truth for the Strimz platform's environment-independent constan
16
47
 
17
48
  The package root (`@strimz/shared-config`) re-exports everything.
18
49
 
19
- ## Usage
50
+ ## Runtime support
20
51
 
21
- ```ts
22
- import { arcTestnet, getTokenAddress, effectiveFeeBps } from '@strimz/shared-config'
52
+ Pure TypeScript with one runtime dependency on `viem`. Works in Node
53
+ 22+, every modern browser, Vercel Edge, Cloudflare Workers, Deno, and
54
+ Bun.
23
55
 
24
- const usdcOnTestnet = getTokenAddress('testnet', 'USDC')
25
- const recurringFeeBps = effectiveFeeBps('growth', 'subscription') // 100 bps (0.8% + 0.2% premium)
26
- ```
56
+ ## Design notes
57
+
58
+ - **No environment reads.** Apps wire `process.env` values into their own typed config; this package supplies the constants those values key into.
59
+ - **No I/O.** Every export is either a constant or a pure function.
60
+ - **Tree-shakable.** Subpath imports let you pull only the constants you need.
61
+
62
+ ## Links
63
+
64
+ - [Documentation](https://strimz.finance/docs)
65
+ - [Repository](https://github.com/StrimzLab/Strimz/tree/main/packages/shared-config)
66
+ - [Changelog](./CHANGELOG.md)
67
+ - [Issues](https://github.com/StrimzLab/Strimz/issues)
27
68
 
28
- ## Boundaries
69
+ ## License
29
70
 
30
- - **No environment reads.** This package never touches `process.env`. Apps wire env values into typed config; this package supplies the constants those values key into.
31
- - **No I/O.** Pure data and pure functions only.
32
- - **Cross-language sync.** The Go indexer does not consume this package. Constants the indexer needs (chain id, contract addresses) are passed via env. The TS source of truth here is mirrored through deployment configuration, never through duplicated code.
71
+ [MIT](./LICENSE) © Strimz
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";;;AAyBO,IAAM,kBAAA,GAAyE;AAAA,EACpF,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,I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.cjs","sourcesContent":["/**\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"]}
1
+ {"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";;;AAyBO,IAAM,kBAAA,GAAyE;AAAA,EACpF,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,2BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,uBAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,EAAA,EAAI,sBAAA;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA;AAEpB;AAIO,IAAM,sBAAA,GAAsD,CAAC,EAAA,EAAI,EAAA,EAAI,EAAE;AAmBvE,IAAM,cAAA,GAAqC;AAAA,EAChD,QAAA,EAAU;AAAA,IACR,gBAAA,EAAkB,EAAA;AAAA,IAClB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,QAAA,EAAU;AAAA,IACR,aAAA,EAAe,KAAA;AAAA,IACf,kBAAA,EAAoB,QAAA;AAAA,IACpB,kBAAA,EAAoB;AAAA,GACtB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,iCAAA,EAAmC;AAAA;AAAA;AAEvC;AAGO,IAAM,iCAAA,GAAoC","file":"agents.cjs","sourcesContent":["/**\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"]}
package/dist/agents.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Strimz AutoPay Agent — feature flags and defaults.
2
+ * Strimz AutoPay Agent feature flags and defaults.
3
3
  *
4
4
  * The agent is composed of independent capabilities that can be enabled or
5
- * disabled per merchant. Defaults are conservative; merchants opt in to
5
+ * disabled per merchant. Defaults are conservative. Merchants opt in to
6
6
  * value-moving capabilities (recovery retries, treasury auto-convert).
7
7
  */
8
8
  type AgentCapability = 'identity' | 'recovery' | 'routing' | 'cashflow' | 'commerce' | 'pricing_intelligence';
package/dist/agents.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Strimz AutoPay Agent — feature flags and defaults.
2
+ * Strimz AutoPay Agent feature flags and defaults.
3
3
  *
4
4
  * The agent is composed of independent capabilities that can be enabled or
5
- * disabled per merchant. Defaults are conservative; merchants opt in to
5
+ * disabled per merchant. Defaults are conservative. Merchants opt in to
6
6
  * value-moving capabilities (recovery retries, treasury auto-convert).
7
7
  */
8
8
  type AgentCapability = 'identity' | 'recovery' | 'routing' | 'cashflow' | 'commerce' | 'pricing_intelligence';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";AAyBO,IAAM,kBAAA,GAAyE;AAAA,EACpF,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,2BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,uBAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,EAAA,EAAI,sBAAA;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA;AAEpB;AAIO,IAAM,sBAAA,GAAsD,CAAC,EAAA,EAAI,EAAA,EAAI,EAAE;AAmBvE,IAAM,cAAA,GAAqC;AAAA,EAChD,QAAA,EAAU;AAAA,IACR,gBAAA,EAAkB,EAAA;AAAA,IAClB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,QAAA,EAAU;AAAA,IACR,aAAA,EAAe,KAAA;AAAA,IACf,kBAAA,EAAoB,QAAA;AAAA,IACpB,kBAAA,EAAoB;AAAA,GACtB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,iCAAA,EAAmC;AAAA;AAAA;AAEvC;AAGO,IAAM,iCAAA,GAAoC","file":"agents.js","sourcesContent":["/**\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"]}
1
+ {"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";AAyBO,IAAM,kBAAA,GAAyE;AAAA,EACpF,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,2BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,uBAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,EAAA,EAAI,sBAAA;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB;AAAA;AAEpB;AAIO,IAAM,sBAAA,GAAsD,CAAC,EAAA,EAAI,EAAA,EAAI,EAAE;AAmBvE,IAAM,cAAA,GAAqC;AAAA,EAChD,QAAA,EAAU;AAAA,IACR,gBAAA,EAAkB,EAAA;AAAA,IAClB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,QAAA,EAAU;AAAA,IACR,aAAA,EAAe,KAAA;AAAA,IACf,kBAAA,EAAoB,QAAA;AAAA,IACpB,kBAAA,EAAoB;AAAA,GACtB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,iCAAA,EAAmC;AAAA;AAAA;AAEvC;AAGO,IAAM,iCAAA,GAAoC","file":"agents.js","sourcesContent":["/**\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"]}
package/dist/cctp.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/cctp.ts
4
57
  var CCTP_CONTRACTS = {
5
58
  testnet: {
@@ -11,11 +64,11 @@ var CCTP_CONTRACTS = {
11
64
  },
12
65
  mainnet: {
13
66
  // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.
14
- // Mirror testnet as a placeholder so type signatures stay non-null.
15
- tokenMessengerV2: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA",
16
- messageTransmitterV2: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275",
17
- gatewayWallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9",
18
- gatewayMinter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B",
67
+ // Testnet values are mirrored as a placeholder so type signatures stay non-null.
68
+ tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
69
+ messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64",
70
+ gatewayWallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE",
71
+ gatewayMinter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205",
19
72
  domainId: 26
20
73
  }
21
74
  };
@@ -40,7 +93,7 @@ var CCTP_SUPPORTED_SOURCE_CHAINS = [
40
93
  "solana"
41
94
  ];
42
95
  function getCctpContracts(env) {
43
- return CCTP_CONTRACTS[env];
96
+ return CCTP_CONTRACTS[parseArcEnvironment(env)];
44
97
  }
45
98
 
46
99
  exports.CCTP_CONTRACTS = CCTP_CONTRACTS;
package/dist/cctp.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cctp.ts"],"names":[],"mappings":";;;AAqBO,IAAM,cAAA,GAA0D;AAAA,EACrE,OAAA,EAAS;AAAA,IACP,gBAAA,EAAkB,4CAAA;AAAA,IAClB,oBAAA,EAAsB,4CAAA;AAAA,IACtB,aAAA,EAAe,4CAAA;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,eAAe,GAAG,CAAA;AAC3B","file":"cctp.cjs","sourcesContent":["/**\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 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 // Mirror testnet as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\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[env]\n}\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/cctp.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,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;AAEgCA,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,CAA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AAA;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":"cctp.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 * 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/cctp.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/cctp.ts
2
55
  var CCTP_CONTRACTS = {
3
56
  testnet: {
@@ -9,11 +62,11 @@ var CCTP_CONTRACTS = {
9
62
  },
10
63
  mainnet: {
11
64
  // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.
12
- // Mirror testnet as a placeholder so type signatures stay non-null.
13
- tokenMessengerV2: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA",
14
- messageTransmitterV2: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275",
15
- gatewayWallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9",
16
- gatewayMinter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B",
65
+ // Testnet values are mirrored as a placeholder so type signatures stay non-null.
66
+ tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
67
+ messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64",
68
+ gatewayWallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE",
69
+ gatewayMinter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205",
17
70
  domainId: 26
18
71
  }
19
72
  };
@@ -38,7 +91,7 @@ var CCTP_SUPPORTED_SOURCE_CHAINS = [
38
91
  "solana"
39
92
  ];
40
93
  function getCctpContracts(env) {
41
- return CCTP_CONTRACTS[env];
94
+ return CCTP_CONTRACTS[parseArcEnvironment(env)];
42
95
  }
43
96
 
44
97
  export { CCTP_CONTRACTS, CCTP_DOMAIN_IDS, CCTP_SUPPORTED_SOURCE_CHAINS, getCctpContracts };
package/dist/cctp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cctp.ts"],"names":[],"mappings":";AAqBO,IAAM,cAAA,GAA0D;AAAA,EACrE,OAAA,EAAS;AAAA,IACP,gBAAA,EAAkB,4CAAA;AAAA,IAClB,oBAAA,EAAsB,4CAAA;AAAA,IACtB,aAAA,EAAe,4CAAA;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,eAAe,GAAG,CAAA;AAC3B","file":"cctp.js","sourcesContent":["/**\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 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 // Mirror testnet as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\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[env]\n}\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/cctp.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,C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AA,IACtB,aAAA,EAAe,4CAAA;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":"cctp.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 * 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/chains.cjs CHANGED
@@ -4,24 +4,24 @@ var viem = require('viem');
4
4
 
5
5
  // src/chains.ts
6
6
  var ARC_TESTNET_CHAIN_ID = 5042002;
7
- var ARC_MAINNET_CHAIN_ID = 5040001;
7
+ var ARC_MAINNET_CHAIN_ID = 5042;
8
8
  var NATIVE_USDC = {
9
- name: "USD Coin",
9
+ name: "USDC",
10
10
  symbol: "USDC",
11
- decimals: 6
11
+ decimals: 18
12
12
  };
13
13
  var arcTestnet = viem.defineChain({
14
14
  id: ARC_TESTNET_CHAIN_ID,
15
15
  name: "Arc Testnet",
16
16
  nativeCurrency: NATIVE_USDC,
17
17
  rpcUrls: {
18
- default: { http: ["https://rpc.testnet.arc.network"] },
19
- public: { http: ["https://rpc.testnet.arc.network"] }
18
+ default: { http: ["https://rpc.testnet.arc.io"] },
19
+ public: { http: ["https://rpc.testnet.arc.io"] }
20
20
  },
21
21
  blockExplorers: {
22
22
  default: {
23
- name: "ArcScan",
24
- url: "https://testnet.arcscan.app"
23
+ name: "Arc Testnet Explorer",
24
+ url: "https://explorer.testnet.arc.io"
25
25
  }
26
26
  },
27
27
  testnet: true
@@ -31,13 +31,13 @@ var arcMainnet = viem.defineChain({
31
31
  name: "Arc",
32
32
  nativeCurrency: NATIVE_USDC,
33
33
  rpcUrls: {
34
- default: { http: ["https://rpc.arc.network"] },
35
- public: { http: ["https://rpc.arc.network"] }
34
+ default: { http: ["https://rpc.mainnet.arc.io"] },
35
+ public: { http: ["https://rpc.mainnet.arc.io"] }
36
36
  },
37
37
  blockExplorers: {
38
38
  default: {
39
- name: "ArcScan",
40
- url: "https://arcscan.app"
39
+ name: "Arc Explorer",
40
+ url: "https://explorer.arc.io"
41
41
  }
42
42
  },
43
43
  testnet: false
@@ -46,19 +46,61 @@ var ARC_CHAINS = {
46
46
  testnet: arcTestnet,
47
47
  mainnet: arcMainnet
48
48
  };
49
+ var ARC_ENVIRONMENTS = ["testnet", "mainnet"];
50
+ function isArcEnvironment(value) {
51
+ return typeof value === "string" && ARC_ENVIRONMENTS.includes(value);
52
+ }
53
+ function parseArcEnvironment(value) {
54
+ if (isArcEnvironment(value)) return value;
55
+ throw new Error(
56
+ `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(", ")}`
57
+ );
58
+ }
49
59
  function getArcChain(env) {
50
- return ARC_CHAINS[env];
60
+ return ARC_CHAINS[parseArcEnvironment(env)];
61
+ }
62
+ function getArcExplorerUrl(env) {
63
+ const explorer = getArcChain(env).blockExplorers?.default.url;
64
+ if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`);
65
+ return explorer;
66
+ }
67
+ function arcExplorerTxUrl(env, txHash) {
68
+ return `${getArcExplorerUrl(env)}/tx/${txHash}`;
69
+ }
70
+ function arcEnvironmentForChainId(chainId) {
71
+ const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId);
72
+ if (!env) {
73
+ throw new Error(
74
+ `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`
75
+ );
76
+ }
77
+ return env;
78
+ }
79
+ function assertArcChainId(env, rpcChainId) {
80
+ const expected = getArcChain(env).id;
81
+ if (rpcChainId !== expected) {
82
+ throw new Error(
83
+ `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`
84
+ );
85
+ }
51
86
  }
52
87
  function isArcChain(chainId) {
53
88
  return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID;
54
89
  }
55
90
 
56
91
  exports.ARC_CHAINS = ARC_CHAINS;
92
+ exports.ARC_ENVIRONMENTS = ARC_ENVIRONMENTS;
57
93
  exports.ARC_MAINNET_CHAIN_ID = ARC_MAINNET_CHAIN_ID;
58
94
  exports.ARC_TESTNET_CHAIN_ID = ARC_TESTNET_CHAIN_ID;
95
+ exports.arcEnvironmentForChainId = arcEnvironmentForChainId;
96
+ exports.arcExplorerTxUrl = arcExplorerTxUrl;
59
97
  exports.arcMainnet = arcMainnet;
60
98
  exports.arcTestnet = arcTestnet;
99
+ exports.assertArcChainId = assertArcChainId;
61
100
  exports.getArcChain = getArcChain;
101
+ exports.getArcExplorerUrl = getArcExplorerUrl;
62
102
  exports.isArcChain = isArcChain;
103
+ exports.isArcEnvironment = isArcEnvironment;
104
+ exports.parseArcEnvironment = parseArcEnvironment;
63
105
  //# sourceMappingURL=chains.cjs.map
64
106
  //# sourceMappingURL=chains.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chains.ts"],"names":["defineChain"],"mappings":";;;;;AAaO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,oBAAA,GAAuB;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,UAAA;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,iCAAiC,CAAA,EAAE;AAAA,IACrD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,iCAAiC,CAAA;AAAE,GACtD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,SAAA;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,yBAAyB,CAAA,EAAE;AAAA,IAC7C,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,yBAAyB,CAAA;AAAE,GAC9C;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,SAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAIM,IAAM,UAAA,GAA4C;AAAA,EACvD,OAAA,EAAS,UAAA;AAAA,EACT,OAAA,EAAS;AACX;AAEO,SAAS,YAAY,GAAA,EAA4B;AACtD,EAAA,OAAO,WAAW,GAAG,CAAA;AACvB;AAEO,SAAS,WAAW,OAAA,EAA0B;AACnD,EAAA,OAAO,OAAA,KAAY,wBAAwB,OAAA,KAAY,oBAAA;AACzD","file":"chains.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 = 5040001 as const\n\nconst NATIVE_USDC = {\n name: 'USD Coin',\n symbol: 'USDC',\n decimals: 6,\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.network'] },\n public: { http: ['https://rpc.testnet.arc.network'] },\n },\n blockExplorers: {\n default: {\n name: 'ArcScan',\n url: 'https://testnet.arcscan.app',\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.arc.network'] },\n public: { http: ['https://rpc.arc.network'] },\n },\n blockExplorers: {\n default: {\n name: 'ArcScan',\n url: 'https://arcscan.app',\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 function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[env]\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n"]}
1
+ {"version":3,"sources":["../src/chains.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;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AACF;AAEO,SAAS,WAAW,OAAA,EAA0B;AACnD,EAAA,OAAO,OAAA,KAAY,wBAAwB,OAAA,KAAY,oBAAA;AACzD","file":"chains.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"]}
package/dist/chains.d.cts CHANGED
@@ -12,12 +12,19 @@ import { Chain } from 'viem';
12
12
  */
13
13
 
14
14
  declare const ARC_TESTNET_CHAIN_ID: 5042002;
15
- declare const ARC_MAINNET_CHAIN_ID: 5040001;
15
+ declare const ARC_MAINNET_CHAIN_ID: 5042;
16
16
  declare const arcTestnet: Chain;
17
17
  declare const arcMainnet: Chain;
18
18
  type ArcEnvironment = 'testnet' | 'mainnet';
19
19
  declare const ARC_CHAINS: Record<ArcEnvironment, Chain>;
20
+ declare const ARC_ENVIRONMENTS: readonly ArcEnvironment[];
21
+ declare function isArcEnvironment(value: unknown): value is ArcEnvironment;
22
+ declare function parseArcEnvironment(value: unknown): ArcEnvironment;
20
23
  declare function getArcChain(env: ArcEnvironment): Chain;
24
+ declare function getArcExplorerUrl(env: ArcEnvironment): string;
25
+ declare function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string;
26
+ declare function arcEnvironmentForChainId(chainId: number): ArcEnvironment;
27
+ declare function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void;
21
28
  declare function isArcChain(chainId: number): boolean;
22
29
 
23
- export { ARC_CHAINS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, type ArcEnvironment, arcMainnet, arcTestnet, getArcChain, isArcChain };
30
+ export { ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, type ArcEnvironment, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcTestnet, assertArcChainId, getArcChain, getArcExplorerUrl, isArcChain, isArcEnvironment, parseArcEnvironment };
package/dist/chains.d.ts CHANGED
@@ -12,12 +12,19 @@ import { Chain } from 'viem';
12
12
  */
13
13
 
14
14
  declare const ARC_TESTNET_CHAIN_ID: 5042002;
15
- declare const ARC_MAINNET_CHAIN_ID: 5040001;
15
+ declare const ARC_MAINNET_CHAIN_ID: 5042;
16
16
  declare const arcTestnet: Chain;
17
17
  declare const arcMainnet: Chain;
18
18
  type ArcEnvironment = 'testnet' | 'mainnet';
19
19
  declare const ARC_CHAINS: Record<ArcEnvironment, Chain>;
20
+ declare const ARC_ENVIRONMENTS: readonly ArcEnvironment[];
21
+ declare function isArcEnvironment(value: unknown): value is ArcEnvironment;
22
+ declare function parseArcEnvironment(value: unknown): ArcEnvironment;
20
23
  declare function getArcChain(env: ArcEnvironment): Chain;
24
+ declare function getArcExplorerUrl(env: ArcEnvironment): string;
25
+ declare function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string;
26
+ declare function arcEnvironmentForChainId(chainId: number): ArcEnvironment;
27
+ declare function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void;
21
28
  declare function isArcChain(chainId: number): boolean;
22
29
 
23
- export { ARC_CHAINS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, type ArcEnvironment, arcMainnet, arcTestnet, getArcChain, isArcChain };
30
+ export { ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, type ArcEnvironment, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcTestnet, assertArcChainId, getArcChain, getArcExplorerUrl, isArcChain, isArcEnvironment, parseArcEnvironment };