@strimz/shared-config 0.1.1 → 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/dist/tokens.cjs CHANGED
@@ -4,44 +4,61 @@ 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
- viem.defineChain({
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
28
28
  });
29
- viem.defineChain({
29
+ var arcMainnet = viem.defineChain({
30
30
  id: ARC_MAINNET_CHAIN_ID,
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
44
44
  });
45
+ var ARC_CHAINS = {
46
+ testnet: arcTestnet,
47
+ mainnet: arcMainnet
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
+ }
59
+ function getArcChain(env) {
60
+ return ARC_CHAINS[parseArcEnvironment(env)];
61
+ }
45
62
 
46
63
  // src/tokens.ts
47
64
  var PAYMENT_TOKENS = ["USDC", "EURC"];
@@ -79,12 +96,12 @@ var TOKEN_ADDRESSES = {
79
96
  // testnet for now and must be replaced when Circle publishes the canonical
80
97
  // mainnet token registry.
81
98
  USDC: "0x3600000000000000000000000000000000000000",
82
- EURC: "0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a",
83
- USYC: "0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C"
99
+ EURC: "0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1",
100
+ USYC: "0x8a5D989Bbb96929F689B0200f435f53dA42bF490"
84
101
  }
85
102
  };
86
103
  function getTokenAddress(env, symbol) {
87
- return TOKEN_ADDRESSES[env][symbol];
104
+ return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol];
88
105
  }
89
106
  function getTokenBySymbol(symbol) {
90
107
  return TOKENS[symbol];
@@ -93,7 +110,7 @@ function isPaymentToken(symbol) {
93
110
  return PAYMENT_TOKENS.includes(symbol);
94
111
  }
95
112
  function chainIdFor(env) {
96
- return env === "testnet" ? ARC_TESTNET_CHAIN_ID : ARC_MAINNET_CHAIN_ID;
113
+ return getArcChain(env).id;
97
114
  }
98
115
 
99
116
  exports.PAYMENT_TOKENS = PAYMENT_TOKENS;
@@ -1 +1 @@
1
- {"version":3,"s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MAAA;AAAA,IACR,IAAA,EAAM,UAAA;AAAA,IACN,QAAA,EAAU,CAAA;AAAA,IACV,eAAA,EAAiB,IAAA;AAAA,IACjB,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EAAM,WAAA;AAAA,IACN,QAAA,EAAU,CAAA;AAAA,IACV,eAAA,EAAiB,IAAA;AAAA,IACjB,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EAAM,eAAA;AAAA,IACN,QAAA,EAAU,CAAA;AAAA,IACV,eAAA,EAAiB,KAAA;AAAA,IACjB,YAAA,EAAc;AAAA;AAElB;AAOO,IAAM,eAAA,GAAwE;AAAA,EACnF,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,IAIP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAEO,SAAS,eAAA,CAAgB,KAAqB,MAAA,EAA8B;AACjF,EAAA,OAAO,eAAA,CAAgB,GAAG,CAAA,CAAE,MAAM,CAAA;AACpC;AAEO,SAAS,iBAAiB,MAAA,EAA6C;AAC5E,EAAA,OAAQ,OAA2C,MAAM,CAAA;AAC3D;AAEO,SAAS,eAAe,MAAA,EAAwC;AACrE,EAAA,OAAO,cAAA,CAAe,SAAS,MAAsB,CAAA;AACvD;AAEO,SAAS,WAAW,GAAA,EAA6B;AACtD,EAAA,OAAO,GAAA,KAAQ,YAAY,oBAAA,GAAuB,oBAAA;AACpD","file":"tokens.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","/**\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 { ARC_TESTNET_CHAIN_ID, ARC_MAINNET_CHAIN_ID, 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: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[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 env === 'testnet' ? ARC_TESTNET_CHAIN_ID : ARC_MAINNET_CHAIN_ID\n}\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/tokens.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;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,CAAA;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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AAAA,IACV,eAAA,EAAiB,IAAA;AAAA,IACjB,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EAAM,eAAA;AAAA,IACN,QAAA,EAAU,CAAA;AAAA,IACV,eAAA,EAAiB,KAAA;AAAA,IACjB,YAAA,EAAc;AAAA;AAElB;AAOO,IAAM,eAAA,GAAwE;AAAA,EACnF,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,IAIP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAEO,SAAS,eAAA,CAAgB,KAAqB,MAAA,EAA8B;AACjF,EAAA,OAAO,eAAA,CAAgB,mBAAA,CAAoB,GAAG,CAAC,EAAE,MAAM,CAAA;AACzD;AAEO,SAAS,iBAAiB,MAAA,EAA6C;AAC5E,EAAA,OAAQ,OAA2C,MAAM,CAAA;AAC3D;AAEO,SAAS,eAAe,MAAA,EAAwC;AACrE,EAAA,OAAO,cAAA,CAAe,SAAS,MAAsB,CAAA;AACvD;AAEO,SAAS,WAAW,GAAA,EAA6B;AACtD,EAAA,OAAO,WAAA,CAAY,GAAG,CAAA,CAAE,EAAA;AAC1B","file":"tokens.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"]}
package/dist/tokens.js CHANGED
@@ -2,44 +2,61 @@ import { defineChain } from 'viem';
2
2
 
3
3
  // src/chains.ts
4
4
  var ARC_TESTNET_CHAIN_ID = 5042002;
5
- var ARC_MAINNET_CHAIN_ID = 5040001;
5
+ var ARC_MAINNET_CHAIN_ID = 5042;
6
6
  var NATIVE_USDC = {
7
- name: "USD Coin",
7
+ name: "USDC",
8
8
  symbol: "USDC",
9
- decimals: 6
9
+ decimals: 18
10
10
  };
11
- defineChain({
11
+ var arcTestnet = defineChain({
12
12
  id: ARC_TESTNET_CHAIN_ID,
13
13
  name: "Arc Testnet",
14
14
  nativeCurrency: NATIVE_USDC,
15
15
  rpcUrls: {
16
- default: { http: ["https://rpc.testnet.arc.network"] },
17
- public: { http: ["https://rpc.testnet.arc.network"] }
16
+ default: { http: ["https://rpc.testnet.arc.io"] },
17
+ public: { http: ["https://rpc.testnet.arc.io"] }
18
18
  },
19
19
  blockExplorers: {
20
20
  default: {
21
- name: "ArcScan",
22
- url: "https://testnet.arcscan.app"
21
+ name: "Arc Testnet Explorer",
22
+ url: "https://explorer.testnet.arc.io"
23
23
  }
24
24
  },
25
25
  testnet: true
26
26
  });
27
- defineChain({
27
+ var arcMainnet = defineChain({
28
28
  id: ARC_MAINNET_CHAIN_ID,
29
29
  name: "Arc",
30
30
  nativeCurrency: NATIVE_USDC,
31
31
  rpcUrls: {
32
- default: { http: ["https://rpc.arc.network"] },
33
- public: { http: ["https://rpc.arc.network"] }
32
+ default: { http: ["https://rpc.mainnet.arc.io"] },
33
+ public: { http: ["https://rpc.mainnet.arc.io"] }
34
34
  },
35
35
  blockExplorers: {
36
36
  default: {
37
- name: "ArcScan",
38
- url: "https://arcscan.app"
37
+ name: "Arc Explorer",
38
+ url: "https://explorer.arc.io"
39
39
  }
40
40
  },
41
41
  testnet: false
42
42
  });
43
+ var ARC_CHAINS = {
44
+ testnet: arcTestnet,
45
+ mainnet: arcMainnet
46
+ };
47
+ var ARC_ENVIRONMENTS = ["testnet", "mainnet"];
48
+ function isArcEnvironment(value) {
49
+ return typeof value === "string" && ARC_ENVIRONMENTS.includes(value);
50
+ }
51
+ function parseArcEnvironment(value) {
52
+ if (isArcEnvironment(value)) return value;
53
+ throw new Error(
54
+ `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(", ")}`
55
+ );
56
+ }
57
+ function getArcChain(env) {
58
+ return ARC_CHAINS[parseArcEnvironment(env)];
59
+ }
43
60
 
44
61
  // src/tokens.ts
45
62
  var PAYMENT_TOKENS = ["USDC", "EURC"];
@@ -77,12 +94,12 @@ var TOKEN_ADDRESSES = {
77
94
  // testnet for now and must be replaced when Circle publishes the canonical
78
95
  // mainnet token registry.
79
96
  USDC: "0x3600000000000000000000000000000000000000",
80
- EURC: "0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a",
81
- USYC: "0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C"
97
+ EURC: "0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1",
98
+ USYC: "0x8a5D989Bbb96929F689B0200f435f53dA42bF490"
82
99
  }
83
100
  };
84
101
  function getTokenAddress(env, symbol) {
85
- return TOKEN_ADDRESSES[env][symbol];
102
+ return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol];
86
103
  }
87
104
  function getTokenBySymbol(symbol) {
88
105
  return TOKENS[symbol];
@@ -91,7 +108,7 @@ function isPaymentToken(symbol) {
91
108
  return PAYMENT_TOKENS.includes(symbol);
92
109
  }
93
110
  function chainIdFor(env) {
94
- return env === "testnet" ? ARC_TESTNET_CHAIN_ID : ARC_MAINNET_CHAIN_ID;
111
+ return getArcChain(env).id;
95
112
  }
96
113
 
97
114
  export { PAYMENT_TOKENS, TOKENS, TOKEN_ADDRESSES, chainIdFor, getTokenAddress, getTokenBySymbol, isPaymentToken };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chains.ts","../src/tokens.ts"],"names":[],"mappings":";;;AAaO,IAAM,oBAAA,GAAuB,OAAA;AAC7B,IAAM,oBAAA,GAAuB,OAAA;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,UAAA;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,EAA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A,EAAM,eAAA;AAAA,IACN,QAAA,EAAU,CAAA;AAAA,IACV,eAAA,EAAiB,KAAA;AAAA,IACjB,YAAA,EAAc;AAAA;AAElB;AAOO,IAAM,eAAA,GAAwE;AAAA,EACnF,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,IAIP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAEO,SAAS,eAAA,CAAgB,KAAqB,MAAA,EAA8B;AACjF,EAAA,OAAO,eAAA,CAAgB,GAAG,CAAA,CAAE,MAAM,CAAA;AACpC;AAEO,SAAS,iBAAiB,MAAA,EAA6C;AAC5E,EAAA,OAAQ,OAA2C,MAAM,CAAA;AAC3D;AAEO,SAAS,eAAe,MAAA,EAAwC;AACrE,EAAA,OAAO,cAAA,CAAe,SAAS,MAAsB,CAAA;AACvD;AAEO,SAAS,WAAW,GAAA,EAA6B;AACtD,EAAA,OAAO,GAAA,KAAQ,YAAY,oBAAA,GAAuB,oBAAA;AACpD","file":"tokens.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 = 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","/**\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 { ARC_TESTNET_CHAIN_ID, ARC_MAINNET_CHAIN_ID, 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: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[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 env === 'testnet' ? ARC_TESTNET_CHAIN_ID : ARC_MAINNET_CHAIN_ID\n}\n"]}
1
+ {"version":3,"sources":["../src/chains.ts","../src/tokens.ts"],"names":[],"mappings":";;;AAaO,IAAM,oBAAA,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,EACA,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,IAIP,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAEV;AAEO,SAAS,eAAA,CAAgB,KAAqB,MAAA,EAA8B;AACjF,EAAA,OAAO,eAAA,CAAgB,mBAAA,CAAoB,GAAG,CAAC,EAAE,MAAM,CAAA;AACzD;AAEO,SAAS,iBAAiB,MAAA,EAA6C;AAC5E,EAAA,OAAQ,OAA2C,MAAM,CAAA;AAC3D;AAEO,SAAS,eAAe,MAAA,EAAwC;AACrE,EAAA,OAAO,cAAA,CAAe,SAAS,MAAsB,CAAA;AACvD;AAEO,SAAS,WAAW,GAAA,EAA6B;AACtD,EAAA,OAAO,WAAA,CAAY,GAAG,CAAA,CAAE,EAAA;AAC1B","file":"tokens.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 * 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strimz/shared-config",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Single source of truth for chain definitions, token registry, fee tiers, webhook events, and agent flags.",
5
5
  "license": "MIT",
6
6
  "author": "Strimz <hello@strimz.finance>",
@@ -83,14 +83,16 @@
83
83
  "eslint": "^9.18.0",
84
84
  "tsup": "^8.3.5",
85
85
  "typescript": "^5.7.3",
86
+ "vitest": "^2.1.8",
86
87
  "@strimz/eslint-config": "0.0.0",
87
88
  "@strimz/tsconfig": "0.0.0"
88
89
  },
89
90
  "scripts": {
90
91
  "build": "tsup",
91
92
  "dev": "tsup --watch",
92
- "lint": "eslint .",
93
+ "lint": "eslint . --max-warnings 0",
93
94
  "typecheck": "tsc --noEmit",
95
+ "test": "vitest run",
94
96
  "clean": "rm -rf dist .turbo *.tsbuildinfo"
95
97
  }
96
98
  }
package/src/cctp.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import type { Address } from 'viem'
11
- import type { ArcEnvironment } from './chains.js'
11
+ import { parseArcEnvironment, type ArcEnvironment } from './chains.js'
12
12
 
13
13
  export interface CCTPContractSet {
14
14
  tokenMessengerV2: Address
@@ -30,10 +30,10 @@ export const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {
30
30
  mainnet: {
31
31
  // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.
32
32
  // Testnet values are mirrored as a placeholder so type signatures stay non-null.
33
- tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
34
- messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
35
- gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',
36
- gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',
33
+ tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
34
+ messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
35
+ gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',
36
+ gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',
37
37
  domainId: 26,
38
38
  },
39
39
  }
@@ -64,5 +64,5 @@ export const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [
64
64
  ] as const
65
65
 
66
66
  export function getCctpContracts(env: ArcEnvironment): CCTPContractSet {
67
- return CCTP_CONTRACTS[env]
67
+ return CCTP_CONTRACTS[parseArcEnvironment(env)]
68
68
  }
package/src/chains.ts CHANGED
@@ -12,12 +12,12 @@
12
12
  import { defineChain, type Chain } from 'viem'
13
13
 
14
14
  export const ARC_TESTNET_CHAIN_ID = 5042002 as const
15
- export const ARC_MAINNET_CHAIN_ID = 5040001 as const
15
+ export const ARC_MAINNET_CHAIN_ID = 5042 as const
16
16
 
17
17
  const NATIVE_USDC = {
18
- name: 'USD Coin',
18
+ name: 'USDC',
19
19
  symbol: 'USDC',
20
- decimals: 6,
20
+ decimals: 18,
21
21
  } as const
22
22
 
23
23
  export const arcTestnet: Chain = defineChain({
@@ -25,13 +25,13 @@ export const arcTestnet: Chain = defineChain({
25
25
  name: 'Arc Testnet',
26
26
  nativeCurrency: NATIVE_USDC,
27
27
  rpcUrls: {
28
- default: { http: ['https://rpc.testnet.arc.network'] },
29
- public: { http: ['https://rpc.testnet.arc.network'] },
28
+ default: { http: ['https://rpc.testnet.arc.io'] },
29
+ public: { http: ['https://rpc.testnet.arc.io'] },
30
30
  },
31
31
  blockExplorers: {
32
32
  default: {
33
- name: 'ArcScan',
34
- url: 'https://testnet.arcscan.app',
33
+ name: 'Arc Testnet Explorer',
34
+ url: 'https://explorer.testnet.arc.io',
35
35
  },
36
36
  },
37
37
  testnet: true,
@@ -42,13 +42,13 @@ export const arcMainnet: Chain = defineChain({
42
42
  name: 'Arc',
43
43
  nativeCurrency: NATIVE_USDC,
44
44
  rpcUrls: {
45
- default: { http: ['https://rpc.arc.network'] },
46
- public: { http: ['https://rpc.arc.network'] },
45
+ default: { http: ['https://rpc.mainnet.arc.io'] },
46
+ public: { http: ['https://rpc.mainnet.arc.io'] },
47
47
  },
48
48
  blockExplorers: {
49
49
  default: {
50
- name: 'ArcScan',
51
- url: 'https://arcscan.app',
50
+ name: 'Arc Explorer',
51
+ url: 'https://explorer.arc.io',
52
52
  },
53
53
  },
54
54
  testnet: false,
@@ -61,8 +61,50 @@ export const ARC_CHAINS: Record<ArcEnvironment, Chain> = {
61
61
  mainnet: arcMainnet,
62
62
  }
63
63
 
64
+ export const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const
65
+
66
+ export function isArcEnvironment(value: unknown): value is ArcEnvironment {
67
+ return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)
68
+ }
69
+
70
+ export function parseArcEnvironment(value: unknown): ArcEnvironment {
71
+ if (isArcEnvironment(value)) return value
72
+ throw new Error(
73
+ `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,
74
+ )
75
+ }
76
+
64
77
  export function getArcChain(env: ArcEnvironment): Chain {
65
- return ARC_CHAINS[env]
78
+ return ARC_CHAINS[parseArcEnvironment(env)]
79
+ }
80
+
81
+ export function getArcExplorerUrl(env: ArcEnvironment): string {
82
+ const explorer = getArcChain(env).blockExplorers?.default.url
83
+ if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)
84
+ return explorer
85
+ }
86
+
87
+ export function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {
88
+ return `${getArcExplorerUrl(env)}/tx/${txHash}`
89
+ }
90
+
91
+ export function arcEnvironmentForChainId(chainId: number): ArcEnvironment {
92
+ const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)
93
+ if (!env) {
94
+ throw new Error(
95
+ `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,
96
+ )
97
+ }
98
+ return env
99
+ }
100
+
101
+ export function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {
102
+ const expected = getArcChain(env).id
103
+ if (rpcChainId !== expected) {
104
+ throw new Error(
105
+ `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,
106
+ )
107
+ }
66
108
  }
67
109
 
68
110
  export function isArcChain(chainId: number): boolean {
package/src/tokens.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type { Address } from 'viem'
12
- import { ARC_TESTNET_CHAIN_ID, ARC_MAINNET_CHAIN_ID, type ArcEnvironment } from './chains.js'
12
+ import { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'
13
13
 
14
14
  export type TokenSymbol = 'USDC' | 'EURC' | 'USYC'
15
15
 
@@ -74,13 +74,13 @@ export const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address
74
74
  // testnet for now and must be replaced when Circle publishes the canonical
75
75
  // mainnet token registry.
76
76
  USDC: '0x3600000000000000000000000000000000000000',
77
- EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
78
- USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',
77
+ EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',
78
+ USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',
79
79
  },
80
80
  }
81
81
 
82
82
  export function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {
83
- return TOKEN_ADDRESSES[env][symbol]
83
+ return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]
84
84
  }
85
85
 
86
86
  export function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {
@@ -92,5 +92,5 @@ export function isPaymentToken(symbol: string): symbol is PaymentToken {
92
92
  }
93
93
 
94
94
  export function chainIdFor(env: ArcEnvironment): number {
95
- return env === 'testnet' ? ARC_TESTNET_CHAIN_ID : ARC_MAINNET_CHAIN_ID
95
+ return getArcChain(env).id
96
96
  }