@strimz/shared-config 0.4.0 → 0.6.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/agents.cjs +12 -6
- package/dist/agents.cjs.map +1 -1
- package/dist/agents.d.cts +1 -0
- package/dist/agents.d.ts +1 -0
- package/dist/agents.js +12 -6
- package/dist/agents.js.map +1 -1
- package/dist/index.cjs +18 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/tiers.cjs +6 -0
- package/dist/tiers.cjs.map +1 -1
- package/dist/tiers.d.cts +2 -1
- package/dist/tiers.d.ts +2 -1
- package/dist/tiers.js +6 -1
- package/dist/tiers.js.map +1 -1
- package/package.json +1 -1
- package/src/agents.ts +7 -0
- package/src/tiers.ts +6 -0
package/dist/agents.cjs
CHANGED
|
@@ -6,37 +6,43 @@ var AGENT_CAPABILITIES = {
|
|
|
6
6
|
id: "identity",
|
|
7
7
|
name: "Agent Identity (ERC-8004)",
|
|
8
8
|
valueMoving: false,
|
|
9
|
-
defaultEnabled: true
|
|
9
|
+
defaultEnabled: true,
|
|
10
|
+
available: true
|
|
10
11
|
},
|
|
11
12
|
recovery: {
|
|
12
13
|
id: "recovery",
|
|
13
14
|
name: "Subscription Recovery",
|
|
14
15
|
valueMoving: true,
|
|
15
|
-
defaultEnabled: false
|
|
16
|
+
defaultEnabled: false,
|
|
17
|
+
available: true
|
|
16
18
|
},
|
|
17
19
|
routing: {
|
|
18
20
|
id: "routing",
|
|
19
21
|
name: "Cross-Chain Payment Routing",
|
|
20
22
|
valueMoving: true,
|
|
21
|
-
defaultEnabled: false
|
|
23
|
+
defaultEnabled: false,
|
|
24
|
+
available: true
|
|
22
25
|
},
|
|
23
26
|
cashflow: {
|
|
24
27
|
id: "cashflow",
|
|
25
28
|
name: "Treasury Cash Flow Insights",
|
|
26
29
|
valueMoving: false,
|
|
27
|
-
defaultEnabled: false
|
|
30
|
+
defaultEnabled: false,
|
|
31
|
+
available: true
|
|
28
32
|
},
|
|
29
33
|
commerce: {
|
|
30
34
|
id: "commerce",
|
|
31
35
|
name: "Agentic B2B Commerce (ERC-8183)",
|
|
32
36
|
valueMoving: true,
|
|
33
|
-
defaultEnabled: false
|
|
37
|
+
defaultEnabled: false,
|
|
38
|
+
available: false
|
|
34
39
|
},
|
|
35
40
|
pricing_intelligence: {
|
|
36
41
|
id: "pricing_intelligence",
|
|
37
42
|
name: "Subscription Pricing Intelligence",
|
|
38
43
|
valueMoving: false,
|
|
39
|
-
defaultEnabled: false
|
|
44
|
+
defaultEnabled: false,
|
|
45
|
+
available: true
|
|
40
46
|
}
|
|
41
47
|
};
|
|
42
48
|
var RECOVERY_GRACE_PERIODS = [24, 48, 72];
|
package/dist/agents.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";;;AA0BO,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,IAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,uBAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,EAAA,EAAI,sBAAA;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA;AAEf;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 available: 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 available: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n available: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\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
|
@@ -13,6 +13,7 @@ interface AgentCapabilityDescriptor {
|
|
|
13
13
|
valueMoving: boolean;
|
|
14
14
|
/** Default enabled state for a newly created merchant. */
|
|
15
15
|
defaultEnabled: boolean;
|
|
16
|
+
available: boolean;
|
|
16
17
|
}
|
|
17
18
|
declare const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor>;
|
|
18
19
|
type GracePeriodHours = 24 | 48 | 72;
|
package/dist/agents.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ interface AgentCapabilityDescriptor {
|
|
|
13
13
|
valueMoving: boolean;
|
|
14
14
|
/** Default enabled state for a newly created merchant. */
|
|
15
15
|
defaultEnabled: boolean;
|
|
16
|
+
available: boolean;
|
|
16
17
|
}
|
|
17
18
|
declare const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor>;
|
|
18
19
|
type GracePeriodHours = 24 | 48 | 72;
|
package/dist/agents.js
CHANGED
|
@@ -4,37 +4,43 @@ var AGENT_CAPABILITIES = {
|
|
|
4
4
|
id: "identity",
|
|
5
5
|
name: "Agent Identity (ERC-8004)",
|
|
6
6
|
valueMoving: false,
|
|
7
|
-
defaultEnabled: true
|
|
7
|
+
defaultEnabled: true,
|
|
8
|
+
available: true
|
|
8
9
|
},
|
|
9
10
|
recovery: {
|
|
10
11
|
id: "recovery",
|
|
11
12
|
name: "Subscription Recovery",
|
|
12
13
|
valueMoving: true,
|
|
13
|
-
defaultEnabled: false
|
|
14
|
+
defaultEnabled: false,
|
|
15
|
+
available: true
|
|
14
16
|
},
|
|
15
17
|
routing: {
|
|
16
18
|
id: "routing",
|
|
17
19
|
name: "Cross-Chain Payment Routing",
|
|
18
20
|
valueMoving: true,
|
|
19
|
-
defaultEnabled: false
|
|
21
|
+
defaultEnabled: false,
|
|
22
|
+
available: true
|
|
20
23
|
},
|
|
21
24
|
cashflow: {
|
|
22
25
|
id: "cashflow",
|
|
23
26
|
name: "Treasury Cash Flow Insights",
|
|
24
27
|
valueMoving: false,
|
|
25
|
-
defaultEnabled: false
|
|
28
|
+
defaultEnabled: false,
|
|
29
|
+
available: true
|
|
26
30
|
},
|
|
27
31
|
commerce: {
|
|
28
32
|
id: "commerce",
|
|
29
33
|
name: "Agentic B2B Commerce (ERC-8183)",
|
|
30
34
|
valueMoving: true,
|
|
31
|
-
defaultEnabled: false
|
|
35
|
+
defaultEnabled: false,
|
|
36
|
+
available: false
|
|
32
37
|
},
|
|
33
38
|
pricing_intelligence: {
|
|
34
39
|
id: "pricing_intelligence",
|
|
35
40
|
name: "Subscription Pricing Intelligence",
|
|
36
41
|
valueMoving: false,
|
|
37
|
-
defaultEnabled: false
|
|
42
|
+
defaultEnabled: false,
|
|
43
|
+
available: true
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
46
|
var RECOVERY_GRACE_PERIODS = [24, 48, 72];
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/agents.ts"],"names":[],"mappings":";AA0BO,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,IAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,uBAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAa,IAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACb;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,EAAA,EAAI,sBAAA;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,WAAA,EAAa,KAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,SAAA,EAAW;AAAA;AAEf;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 available: 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 available: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n available: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\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/index.cjs
CHANGED
|
@@ -215,6 +215,11 @@ function planForVolume(volumes) {
|
|
|
215
215
|
}
|
|
216
216
|
return reached;
|
|
217
217
|
}
|
|
218
|
+
function planUpgradeFor(current, volumes) {
|
|
219
|
+
if (current === "enterprise") return null;
|
|
220
|
+
const earned = planForVolume(volumes);
|
|
221
|
+
return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null;
|
|
222
|
+
}
|
|
218
223
|
|
|
219
224
|
// src/webhooks.ts
|
|
220
225
|
var WEBHOOK_EVENTS = {
|
|
@@ -318,37 +323,43 @@ var AGENT_CAPABILITIES = {
|
|
|
318
323
|
id: "identity",
|
|
319
324
|
name: "Agent Identity (ERC-8004)",
|
|
320
325
|
valueMoving: false,
|
|
321
|
-
defaultEnabled: true
|
|
326
|
+
defaultEnabled: true,
|
|
327
|
+
available: true
|
|
322
328
|
},
|
|
323
329
|
recovery: {
|
|
324
330
|
id: "recovery",
|
|
325
331
|
name: "Subscription Recovery",
|
|
326
332
|
valueMoving: true,
|
|
327
|
-
defaultEnabled: false
|
|
333
|
+
defaultEnabled: false,
|
|
334
|
+
available: true
|
|
328
335
|
},
|
|
329
336
|
routing: {
|
|
330
337
|
id: "routing",
|
|
331
338
|
name: "Cross-Chain Payment Routing",
|
|
332
339
|
valueMoving: true,
|
|
333
|
-
defaultEnabled: false
|
|
340
|
+
defaultEnabled: false,
|
|
341
|
+
available: true
|
|
334
342
|
},
|
|
335
343
|
cashflow: {
|
|
336
344
|
id: "cashflow",
|
|
337
345
|
name: "Treasury Cash Flow Insights",
|
|
338
346
|
valueMoving: false,
|
|
339
|
-
defaultEnabled: false
|
|
347
|
+
defaultEnabled: false,
|
|
348
|
+
available: true
|
|
340
349
|
},
|
|
341
350
|
commerce: {
|
|
342
351
|
id: "commerce",
|
|
343
352
|
name: "Agentic B2B Commerce (ERC-8183)",
|
|
344
353
|
valueMoving: true,
|
|
345
|
-
defaultEnabled: false
|
|
354
|
+
defaultEnabled: false,
|
|
355
|
+
available: false
|
|
346
356
|
},
|
|
347
357
|
pricing_intelligence: {
|
|
348
358
|
id: "pricing_intelligence",
|
|
349
359
|
name: "Subscription Pricing Intelligence",
|
|
350
360
|
valueMoving: false,
|
|
351
|
-
defaultEnabled: false
|
|
361
|
+
defaultEnabled: false,
|
|
362
|
+
available: true
|
|
352
363
|
}
|
|
353
364
|
};
|
|
354
365
|
var RECOVERY_GRACE_PERIODS = [24, 48, 72];
|
|
@@ -461,6 +472,7 @@ exports.parseArcEnvironment = parseArcEnvironment;
|
|
|
461
472
|
exports.planFeeBps = planFeeBps;
|
|
462
473
|
exports.planForVolume = planForVolume;
|
|
463
474
|
exports.planIncludes = planIncludes;
|
|
475
|
+
exports.planUpgradeFor = planUpgradeFor;
|
|
464
476
|
exports.plansWith = plansWith;
|
|
465
477
|
exports.prefixFor = prefixFor;
|
|
466
478
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chains.ts","../src/tokens.ts","../src/tiers.ts","../src/webhooks.ts","../src/api-keys.ts","../src/agents.ts","../src/cctp.ts"],"names":["defineChain"],"mappings":";;;;;AAaO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,oBAAA,GAAuB;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,MAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAEO,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,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G,CAAC,CAAA;AAChD","file":"index.cjs","sourcesContent":["/**\n * Arc blockchain definitions.\n *\n * Arc is Circle's stablecoin-native L1 where gas is paid in USDC.\n * - Testnet is live (chain id 5042002).\n * - Mainnet beta is expected in 2026; the mainnet entry is a placeholder\n * until Circle publishes the production chain id and RPC endpoint.\n *\n * @see https://docs.arc.network\n */\n\nimport { defineChain, type Chain } from 'viem'\n\nexport const ARC_TESTNET_CHAIN_ID = 5042002 as const\nexport const ARC_MAINNET_CHAIN_ID = 5042 as const\n\nconst NATIVE_USDC = {\n name: 'USDC',\n symbol: 'USDC',\n decimals: 18,\n} as const\n\nexport const arcTestnet: Chain = defineChain({\n id: ARC_TESTNET_CHAIN_ID,\n name: 'Arc Testnet',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.testnet.arc.io'] },\n public: { http: ['https://rpc.testnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Testnet Explorer',\n url: 'https://explorer.testnet.arc.io',\n },\n },\n testnet: true,\n})\n\nexport const arcMainnet: Chain = defineChain({\n id: ARC_MAINNET_CHAIN_ID,\n name: 'Arc',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.mainnet.arc.io'] },\n public: { http: ['https://rpc.mainnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Explorer',\n url: 'https://explorer.arc.io',\n },\n },\n testnet: false,\n})\n\nexport type ArcEnvironment = 'testnet' | 'mainnet'\n\nexport const ARC_CHAINS: Record<ArcEnvironment, Chain> = {\n testnet: arcTestnet,\n mainnet: arcMainnet,\n}\n\nexport const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const\n\nexport function isArcEnvironment(value: unknown): value is ArcEnvironment {\n return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)\n}\n\nexport function parseArcEnvironment(value: unknown): ArcEnvironment {\n if (isArcEnvironment(value)) return value\n throw new Error(\n `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,\n )\n}\n\nexport function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[parseArcEnvironment(env)]\n}\n\nexport function getArcExplorerUrl(env: ArcEnvironment): string {\n const explorer = getArcChain(env).blockExplorers?.default.url\n if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)\n return explorer\n}\n\nexport function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {\n return `${getArcExplorerUrl(env)}/tx/${txHash}`\n}\n\nexport function arcEnvironmentForChainId(chainId: number): ArcEnvironment {\n const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)\n if (!env) {\n throw new Error(\n `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,\n )\n }\n return env\n}\n\nexport function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {\n const expected = getArcChain(env).id\n if (rpcChainId !== expected) {\n throw new Error(\n `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,\n )\n }\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n","/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n","/**\n * Webhook event names.\n *\n * Wire format is `<resource>.<action>`. Every event payload is versioned at\n * the envelope level so additive changes do not break consumers.\n */\n\nexport const WEBHOOK_EVENTS = {\n payment: {\n created: 'payment.created',\n completed: 'payment.completed',\n failed: 'payment.failed',\n },\n subscription: {\n created: 'subscription.created',\n charged: 'subscription.charged',\n chargeFailed: 'subscription.charge_failed',\n recoveryAttempt: 'subscription.recovery_attempt',\n recoveryOutcome: 'subscription.recovery_outcome',\n cancelled: 'subscription.cancelled',\n lapsed: 'subscription.lapsed',\n },\n refund: {\n created: 'refund.created',\n completed: 'refund.completed',\n failed: 'refund.failed',\n },\n invoice: {\n created: 'invoice.created',\n paid: 'invoice.paid',\n overdue: 'invoice.overdue',\n },\n agent: {\n actionExecuted: 'agent.action_executed',\n jobProposed: 'agent.job_proposed',\n jobCompleted: 'agent.job_completed',\n jobDisputed: 'agent.job_disputed',\n },\n compliance: {\n walletFlagged: 'compliance.wallet_flagged',\n walletBlocked: 'compliance.wallet_blocked',\n },\n} as const\n\nexport type WebhookEventName =\n | (typeof WEBHOOK_EVENTS.payment)[keyof typeof WEBHOOK_EVENTS.payment]\n | (typeof WEBHOOK_EVENTS.subscription)[keyof typeof WEBHOOK_EVENTS.subscription]\n | (typeof WEBHOOK_EVENTS.refund)[keyof typeof WEBHOOK_EVENTS.refund]\n | (typeof WEBHOOK_EVENTS.invoice)[keyof typeof WEBHOOK_EVENTS.invoice]\n | (typeof WEBHOOK_EVENTS.agent)[keyof typeof WEBHOOK_EVENTS.agent]\n | (typeof WEBHOOK_EVENTS.compliance)[keyof typeof WEBHOOK_EVENTS.compliance]\n\nexport const ALL_WEBHOOK_EVENTS: readonly WebhookEventName[] = [\n ...Object.values(WEBHOOK_EVENTS.payment),\n ...Object.values(WEBHOOK_EVENTS.subscription),\n ...Object.values(WEBHOOK_EVENTS.refund),\n ...Object.values(WEBHOOK_EVENTS.invoice),\n ...Object.values(WEBHOOK_EVENTS.agent),\n ...Object.values(WEBHOOK_EVENTS.compliance),\n] as const\n\n/** Exponential backoff schedule for webhook delivery, in seconds. */\nexport const WEBHOOK_RETRY_SCHEDULE_SECONDS: readonly number[] = [\n 60, // 1 minute\n 300, // 5 minutes\n 1_800, // 30 minutes\n 7_200, // 2 hours\n 86_400, // 24 hours\n] as const\n\nexport const WEBHOOK_MAX_ATTEMPTS = WEBHOOK_RETRY_SCHEDULE_SECONDS.length + 1\n\n/** Webhook signatures older than this are rejected to prevent replay. */\nexport const WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = 300\n\n/** HTTP header carrying the HMAC signature. */\nexport const WEBHOOK_SIGNATURE_HEADER = 'strimz-signature'\n\n/** HTTP header carrying the unique delivery id (idempotency key for the receiver). */\nexport const WEBHOOK_DELIVERY_ID_HEADER = 'strimz-delivery-id'\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n","/**\n * Strimz AutoPay Agent feature flags and defaults.\n *\n * The agent is composed of independent capabilities that can be enabled or\n * disabled per merchant. Defaults are conservative. Merchants opt in to\n * value-moving capabilities (recovery retries, treasury auto-convert).\n */\n\nexport type AgentCapability =\n | 'identity'\n | 'recovery'\n | 'routing'\n | 'cashflow'\n | 'commerce'\n | 'pricing_intelligence'\n\nexport interface AgentCapabilityDescriptor {\n id: AgentCapability\n name: string\n /** Whether the capability moves money or signs transactions. */\n valueMoving: boolean\n /** Default enabled state for a newly created merchant. */\n defaultEnabled: boolean\n}\n\nexport const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor> = {\n identity: {\n id: 'identity',\n name: 'Agent Identity (ERC-8004)',\n valueMoving: false,\n defaultEnabled: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n },\n}\n\nexport type GracePeriodHours = 24 | 48 | 72\n\nexport const RECOVERY_GRACE_PERIODS: readonly GracePeriodHours[] = [24, 48, 72] as const\n\nexport type RecoveryRetryStrategy = 'once' | 'twice' | 'until_grace_ends'\n\nexport interface AgentDefaultConfig {\n recovery: {\n gracePeriodHours: GracePeriodHours\n strategy: RecoveryRetryStrategy\n }\n cashflow: {\n digestEnabled: boolean\n anomalySensitivity: 'low' | 'medium' | 'high'\n autoConvertToYield: boolean\n }\n commerce: {\n requireHumanApprovalAboveUsdCents: number\n }\n}\n\nexport const AGENT_DEFAULTS: AgentDefaultConfig = {\n recovery: {\n gracePeriodHours: 48,\n strategy: 'twice',\n },\n cashflow: {\n digestEnabled: false,\n anomalySensitivity: 'medium',\n autoConvertToYield: false,\n },\n commerce: {\n requireHumanApprovalAboveUsdCents: 100_000, // $1,000\n },\n}\n\n/** Time-to-live for the agent activity log, in days. */\nexport const AGENT_ACTIVITY_LOG_RETENTION_DAYS = 90\n","/**\n * Circle CCTP V2 contract addresses for Arc.\n *\n * CCTP lets a payer hold USDC on any supported chain (Ethereum, Base, Polygon,\n * Arbitrum, Solana, etc.) and pay a Strimz merchant who receives Arc USDC.\n *\n * @see https://developers.circle.com/stablecoins/cctp-getting-started\n */\n\nimport type { Address } from 'viem'\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport interface CCTPContractSet {\n tokenMessengerV2: Address\n messageTransmitterV2: Address\n gatewayWallet: Address\n gatewayMinter: Address\n /** CCTP domain identifier for the destination chain. */\n domainId: number\n}\n\nexport const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {\n testnet: {\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\n domainId: 26,\n },\n mainnet: {\n // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.\n // Testnet values are mirrored as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',\n messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',\n gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',\n gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',\n domainId: 26,\n },\n}\n\n/** CCTP domain ids for source chains a payer can bridge from. */\nexport const CCTP_DOMAIN_IDS = {\n ethereum: 0,\n avalanche: 1,\n optimism: 2,\n arbitrum: 3,\n noble: 4,\n solana: 5,\n base: 6,\n polygon: 7,\n arc: 26,\n} as const\n\nexport type CCTPSourceChain = keyof typeof CCTP_DOMAIN_IDS\n\nexport const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [\n 'ethereum',\n 'avalanche',\n 'optimism',\n 'arbitrum',\n 'base',\n 'polygon',\n 'solana',\n] as const\n\nexport function getCctpContracts(env: ArcEnvironment): CCTPContractSet {\n return CCTP_CONTRACTS[parseArcEnvironment(env)]\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/chains.ts","../src/tokens.ts","../src/tiers.ts","../src/webhooks.ts","../src/api-keys.ts","../src/agents.ts","../src/cctp.ts"],"names":["defineChain"],"mappings":";;;;;AAaO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,oBAAA,GAAuB;AAEpC,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,MAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAEO,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAEM,IAAM,aAAoBA,gBAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,KAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,cAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,C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GACtB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,iCAAA,EAAmC;AAAA;AAAA;AAEvC;AAGO,IAAM,iCAAA,GAAoC;;;ACvF1C,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,cAAA,CAAe,mBAAA,CAAoB,GAAG,CAAC,CAAA;AAChD","file":"index.cjs","sourcesContent":["/**\n * Arc blockchain definitions.\n *\n * Arc is Circle's stablecoin-native L1 where gas is paid in USDC.\n * - Testnet is live (chain id 5042002).\n * - Mainnet beta is expected in 2026; the mainnet entry is a placeholder\n * until Circle publishes the production chain id and RPC endpoint.\n *\n * @see https://docs.arc.network\n */\n\nimport { defineChain, type Chain } from 'viem'\n\nexport const ARC_TESTNET_CHAIN_ID = 5042002 as const\nexport const ARC_MAINNET_CHAIN_ID = 5042 as const\n\nconst NATIVE_USDC = {\n name: 'USDC',\n symbol: 'USDC',\n decimals: 18,\n} as const\n\nexport const arcTestnet: Chain = defineChain({\n id: ARC_TESTNET_CHAIN_ID,\n name: 'Arc Testnet',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.testnet.arc.io'] },\n public: { http: ['https://rpc.testnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Testnet Explorer',\n url: 'https://explorer.testnet.arc.io',\n },\n },\n testnet: true,\n})\n\nexport const arcMainnet: Chain = defineChain({\n id: ARC_MAINNET_CHAIN_ID,\n name: 'Arc',\n nativeCurrency: NATIVE_USDC,\n rpcUrls: {\n default: { http: ['https://rpc.mainnet.arc.io'] },\n public: { http: ['https://rpc.mainnet.arc.io'] },\n },\n blockExplorers: {\n default: {\n name: 'Arc Explorer',\n url: 'https://explorer.arc.io',\n },\n },\n testnet: false,\n})\n\nexport type ArcEnvironment = 'testnet' | 'mainnet'\n\nexport const ARC_CHAINS: Record<ArcEnvironment, Chain> = {\n testnet: arcTestnet,\n mainnet: arcMainnet,\n}\n\nexport const ARC_ENVIRONMENTS: readonly ArcEnvironment[] = ['testnet', 'mainnet'] as const\n\nexport function isArcEnvironment(value: unknown): value is ArcEnvironment {\n return typeof value === 'string' && (ARC_ENVIRONMENTS as readonly string[]).includes(value)\n}\n\nexport function parseArcEnvironment(value: unknown): ArcEnvironment {\n if (isArcEnvironment(value)) return value\n throw new Error(\n `unknown Arc environment ${JSON.stringify(value)}: expected one of ${ARC_ENVIRONMENTS.join(', ')}`,\n )\n}\n\nexport function getArcChain(env: ArcEnvironment): Chain {\n return ARC_CHAINS[parseArcEnvironment(env)]\n}\n\nexport function getArcExplorerUrl(env: ArcEnvironment): string {\n const explorer = getArcChain(env).blockExplorers?.default.url\n if (!explorer) throw new Error(`Arc ${env} has no block explorer configured`)\n return explorer\n}\n\nexport function arcExplorerTxUrl(env: ArcEnvironment, txHash: string): string {\n return `${getArcExplorerUrl(env)}/tx/${txHash}`\n}\n\nexport function arcEnvironmentForChainId(chainId: number): ArcEnvironment {\n const env = ARC_ENVIRONMENTS.find((candidate) => ARC_CHAINS[candidate].id === chainId)\n if (!env) {\n throw new Error(\n `chain id ${chainId} is not an Arc chain: expected ${ARC_TESTNET_CHAIN_ID} (testnet) or ${ARC_MAINNET_CHAIN_ID} (mainnet)`,\n )\n }\n return env\n}\n\nexport function assertArcChainId(env: ArcEnvironment, rpcChainId: number): void {\n const expected = getArcChain(env).id\n if (rpcChainId !== expected) {\n throw new Error(\n `ARC_RPC_URL serves chain id ${rpcChainId}, but ARC_ENVIRONMENT=${env} expects chain id ${expected}`,\n )\n }\n}\n\nexport function isArcChain(chainId: number): boolean {\n return chainId === ARC_TESTNET_CHAIN_ID || chainId === ARC_MAINNET_CHAIN_ID\n}\n","/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n\nexport function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null {\n if (current === 'enterprise') return null\n const earned = planForVolume(volumes)\n return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null\n}\n","/**\n * Webhook event names.\n *\n * Wire format is `<resource>.<action>`. Every event payload is versioned at\n * the envelope level so additive changes do not break consumers.\n */\n\nexport const WEBHOOK_EVENTS = {\n payment: {\n created: 'payment.created',\n completed: 'payment.completed',\n failed: 'payment.failed',\n },\n subscription: {\n created: 'subscription.created',\n charged: 'subscription.charged',\n chargeFailed: 'subscription.charge_failed',\n recoveryAttempt: 'subscription.recovery_attempt',\n recoveryOutcome: 'subscription.recovery_outcome',\n cancelled: 'subscription.cancelled',\n lapsed: 'subscription.lapsed',\n },\n refund: {\n created: 'refund.created',\n completed: 'refund.completed',\n failed: 'refund.failed',\n },\n invoice: {\n created: 'invoice.created',\n paid: 'invoice.paid',\n overdue: 'invoice.overdue',\n },\n agent: {\n actionExecuted: 'agent.action_executed',\n jobProposed: 'agent.job_proposed',\n jobCompleted: 'agent.job_completed',\n jobDisputed: 'agent.job_disputed',\n },\n compliance: {\n walletFlagged: 'compliance.wallet_flagged',\n walletBlocked: 'compliance.wallet_blocked',\n },\n} as const\n\nexport type WebhookEventName =\n | (typeof WEBHOOK_EVENTS.payment)[keyof typeof WEBHOOK_EVENTS.payment]\n | (typeof WEBHOOK_EVENTS.subscription)[keyof typeof WEBHOOK_EVENTS.subscription]\n | (typeof WEBHOOK_EVENTS.refund)[keyof typeof WEBHOOK_EVENTS.refund]\n | (typeof WEBHOOK_EVENTS.invoice)[keyof typeof WEBHOOK_EVENTS.invoice]\n | (typeof WEBHOOK_EVENTS.agent)[keyof typeof WEBHOOK_EVENTS.agent]\n | (typeof WEBHOOK_EVENTS.compliance)[keyof typeof WEBHOOK_EVENTS.compliance]\n\nexport const ALL_WEBHOOK_EVENTS: readonly WebhookEventName[] = [\n ...Object.values(WEBHOOK_EVENTS.payment),\n ...Object.values(WEBHOOK_EVENTS.subscription),\n ...Object.values(WEBHOOK_EVENTS.refund),\n ...Object.values(WEBHOOK_EVENTS.invoice),\n ...Object.values(WEBHOOK_EVENTS.agent),\n ...Object.values(WEBHOOK_EVENTS.compliance),\n] as const\n\n/** Exponential backoff schedule for webhook delivery, in seconds. */\nexport const WEBHOOK_RETRY_SCHEDULE_SECONDS: readonly number[] = [\n 60, // 1 minute\n 300, // 5 minutes\n 1_800, // 30 minutes\n 7_200, // 2 hours\n 86_400, // 24 hours\n] as const\n\nexport const WEBHOOK_MAX_ATTEMPTS = WEBHOOK_RETRY_SCHEDULE_SECONDS.length + 1\n\n/** Webhook signatures older than this are rejected to prevent replay. */\nexport const WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = 300\n\n/** HTTP header carrying the HMAC signature. */\nexport const WEBHOOK_SIGNATURE_HEADER = 'strimz-signature'\n\n/** HTTP header carrying the unique delivery id (idempotency key for the receiver). */\nexport const WEBHOOK_DELIVERY_ID_HEADER = 'strimz-delivery-id'\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n","/**\n * Strimz AutoPay Agent feature flags and defaults.\n *\n * The agent is composed of independent capabilities that can be enabled or\n * disabled per merchant. Defaults are conservative. Merchants opt in to\n * value-moving capabilities (recovery retries, treasury auto-convert).\n */\n\nexport type AgentCapability =\n | 'identity'\n | 'recovery'\n | 'routing'\n | 'cashflow'\n | 'commerce'\n | 'pricing_intelligence'\n\nexport interface AgentCapabilityDescriptor {\n id: AgentCapability\n name: string\n /** Whether the capability moves money or signs transactions. */\n valueMoving: boolean\n /** Default enabled state for a newly created merchant. */\n defaultEnabled: boolean\n available: 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 available: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n available: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\n },\n}\n\nexport type GracePeriodHours = 24 | 48 | 72\n\nexport const RECOVERY_GRACE_PERIODS: readonly GracePeriodHours[] = [24, 48, 72] as const\n\nexport type RecoveryRetryStrategy = 'once' | 'twice' | 'until_grace_ends'\n\nexport interface AgentDefaultConfig {\n recovery: {\n gracePeriodHours: GracePeriodHours\n strategy: RecoveryRetryStrategy\n }\n cashflow: {\n digestEnabled: boolean\n anomalySensitivity: 'low' | 'medium' | 'high'\n autoConvertToYield: boolean\n }\n commerce: {\n requireHumanApprovalAboveUsdCents: number\n }\n}\n\nexport const AGENT_DEFAULTS: AgentDefaultConfig = {\n recovery: {\n gracePeriodHours: 48,\n strategy: 'twice',\n },\n cashflow: {\n digestEnabled: false,\n anomalySensitivity: 'medium',\n autoConvertToYield: false,\n },\n commerce: {\n requireHumanApprovalAboveUsdCents: 100_000, // $1,000\n },\n}\n\n/** Time-to-live for the agent activity log, in days. */\nexport const AGENT_ACTIVITY_LOG_RETENTION_DAYS = 90\n","/**\n * Circle CCTP V2 contract addresses for Arc.\n *\n * CCTP lets a payer hold USDC on any supported chain (Ethereum, Base, Polygon,\n * Arbitrum, Solana, etc.) and pay a Strimz merchant who receives Arc USDC.\n *\n * @see https://developers.circle.com/stablecoins/cctp-getting-started\n */\n\nimport type { Address } from 'viem'\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport interface CCTPContractSet {\n tokenMessengerV2: Address\n messageTransmitterV2: Address\n gatewayWallet: Address\n gatewayMinter: Address\n /** CCTP domain identifier for the destination chain. */\n domainId: number\n}\n\nexport const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {\n testnet: {\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\n domainId: 26,\n },\n mainnet: {\n // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.\n // Testnet values are mirrored as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',\n messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',\n gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',\n gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',\n domainId: 26,\n },\n}\n\n/** CCTP domain ids for source chains a payer can bridge from. */\nexport const CCTP_DOMAIN_IDS = {\n ethereum: 0,\n avalanche: 1,\n optimism: 2,\n arbitrum: 3,\n noble: 4,\n solana: 5,\n base: 6,\n polygon: 7,\n arc: 26,\n} as const\n\nexport type CCTPSourceChain = keyof typeof CCTP_DOMAIN_IDS\n\nexport const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [\n 'ethereum',\n 'avalanche',\n 'optimism',\n 'arbitrum',\n 'base',\n 'polygon',\n 'solana',\n] as const\n\nexport function getCctpContracts(env: ArcEnvironment): CCTPContractSet {\n return CCTP_CONTRACTS[parseArcEnvironment(env)]\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, ArcEnvironment, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcTestnet, assertArcChainId, getArcChain, getArcExplorerUrl, isArcChain, isArcEnvironment, parseArcEnvironment } from './chains.cjs';
|
|
2
2
|
export { PAYMENT_TOKENS, PaymentToken, TOKENS, TOKEN_ADDRESSES, TokenAddress, TokenDescriptor, TokenSymbol, chainIdFor, getTokenAddress, getTokenBySymbol, isPaymentToken } from './tokens.cjs';
|
|
3
|
-
export { DEFAULT_TIER, MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, PaymentVolumes, PlanDefinition, PlanFeature, VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith } from './tiers.cjs';
|
|
3
|
+
export { DEFAULT_TIER, MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, PaymentVolumes, PlanDefinition, PlanFeature, VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, planUpgradeFor, plansWith } from './tiers.cjs';
|
|
4
4
|
export { ALL_WEBHOOK_EVENTS, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENTS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_SCHEDULE_SECONDS, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WebhookEventName } from './webhooks.cjs';
|
|
5
5
|
export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ApiKeyKind, ApiKeyMode, arcModeFor, kindFromKey, modeFromKey, prefixFor } from './api-keys.cjs';
|
|
6
6
|
export { AGENT_ACTIVITY_LOG_RETENTION_DAYS, AGENT_CAPABILITIES, AGENT_DEFAULTS, AgentCapability, AgentCapabilityDescriptor, AgentDefaultConfig, GracePeriodHours, RECOVERY_GRACE_PERIODS, RecoveryRetryStrategy } from './agents.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, ArcEnvironment, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcTestnet, assertArcChainId, getArcChain, getArcExplorerUrl, isArcChain, isArcEnvironment, parseArcEnvironment } from './chains.js';
|
|
2
2
|
export { PAYMENT_TOKENS, PaymentToken, TOKENS, TOKEN_ADDRESSES, TokenAddress, TokenDescriptor, TokenSymbol, chainIdFor, getTokenAddress, getTokenBySymbol, isPaymentToken } from './tokens.js';
|
|
3
|
-
export { DEFAULT_TIER, MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, PaymentVolumes, PlanDefinition, PlanFeature, VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith } from './tiers.js';
|
|
3
|
+
export { DEFAULT_TIER, MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, PaymentVolumes, PlanDefinition, PlanFeature, VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, planUpgradeFor, plansWith } from './tiers.js';
|
|
4
4
|
export { ALL_WEBHOOK_EVENTS, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENTS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_SCHEDULE_SECONDS, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WebhookEventName } from './webhooks.js';
|
|
5
5
|
export { API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ApiKeyKind, ApiKeyMode, arcModeFor, kindFromKey, modeFromKey, prefixFor } from './api-keys.js';
|
|
6
6
|
export { AGENT_ACTIVITY_LOG_RETENTION_DAYS, AGENT_CAPABILITIES, AGENT_DEFAULTS, AgentCapability, AgentCapabilityDescriptor, AgentDefaultConfig, GracePeriodHours, RECOVERY_GRACE_PERIODS, RecoveryRetryStrategy } from './agents.js';
|
package/dist/index.js
CHANGED
|
@@ -213,6 +213,11 @@ function planForVolume(volumes) {
|
|
|
213
213
|
}
|
|
214
214
|
return reached;
|
|
215
215
|
}
|
|
216
|
+
function planUpgradeFor(current, volumes) {
|
|
217
|
+
if (current === "enterprise") return null;
|
|
218
|
+
const earned = planForVolume(volumes);
|
|
219
|
+
return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null;
|
|
220
|
+
}
|
|
216
221
|
|
|
217
222
|
// src/webhooks.ts
|
|
218
223
|
var WEBHOOK_EVENTS = {
|
|
@@ -316,37 +321,43 @@ var AGENT_CAPABILITIES = {
|
|
|
316
321
|
id: "identity",
|
|
317
322
|
name: "Agent Identity (ERC-8004)",
|
|
318
323
|
valueMoving: false,
|
|
319
|
-
defaultEnabled: true
|
|
324
|
+
defaultEnabled: true,
|
|
325
|
+
available: true
|
|
320
326
|
},
|
|
321
327
|
recovery: {
|
|
322
328
|
id: "recovery",
|
|
323
329
|
name: "Subscription Recovery",
|
|
324
330
|
valueMoving: true,
|
|
325
|
-
defaultEnabled: false
|
|
331
|
+
defaultEnabled: false,
|
|
332
|
+
available: true
|
|
326
333
|
},
|
|
327
334
|
routing: {
|
|
328
335
|
id: "routing",
|
|
329
336
|
name: "Cross-Chain Payment Routing",
|
|
330
337
|
valueMoving: true,
|
|
331
|
-
defaultEnabled: false
|
|
338
|
+
defaultEnabled: false,
|
|
339
|
+
available: true
|
|
332
340
|
},
|
|
333
341
|
cashflow: {
|
|
334
342
|
id: "cashflow",
|
|
335
343
|
name: "Treasury Cash Flow Insights",
|
|
336
344
|
valueMoving: false,
|
|
337
|
-
defaultEnabled: false
|
|
345
|
+
defaultEnabled: false,
|
|
346
|
+
available: true
|
|
338
347
|
},
|
|
339
348
|
commerce: {
|
|
340
349
|
id: "commerce",
|
|
341
350
|
name: "Agentic B2B Commerce (ERC-8183)",
|
|
342
351
|
valueMoving: true,
|
|
343
|
-
defaultEnabled: false
|
|
352
|
+
defaultEnabled: false,
|
|
353
|
+
available: false
|
|
344
354
|
},
|
|
345
355
|
pricing_intelligence: {
|
|
346
356
|
id: "pricing_intelligence",
|
|
347
357
|
name: "Subscription Pricing Intelligence",
|
|
348
358
|
valueMoving: false,
|
|
349
|
-
defaultEnabled: false
|
|
359
|
+
defaultEnabled: false,
|
|
360
|
+
available: true
|
|
350
361
|
}
|
|
351
362
|
};
|
|
352
363
|
var RECOVERY_GRACE_PERIODS = [24, 48, 72];
|
|
@@ -410,6 +421,6 @@ function getCctpContracts(env) {
|
|
|
410
421
|
return CCTP_CONTRACTS[parseArcEnvironment(env)];
|
|
411
422
|
}
|
|
412
423
|
|
|
413
|
-
export { AGENT_ACTIVITY_LOG_RETENTION_DAYS, AGENT_CAPABILITIES, AGENT_DEFAULTS, ALL_WEBHOOK_EVENTS, API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, CCTP_CONTRACTS, CCTP_DOMAIN_IDS, CCTP_SUPPORTED_SOURCE_CHAINS, DEFAULT_TIER, PAYMENT_TOKENS, PLANS, PLAN_FEE_CEILING_BPS, RECOVERY_GRACE_PERIODS, TOKENS, TOKEN_ADDRESSES, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENTS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_SCHEDULE_SECONDS, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcModeFor, arcTestnet, assertArcChainId, chainIdFor, getArcChain, getArcExplorerUrl, getCctpContracts, getTokenAddress, getTokenBySymbol, isArcChain, isArcEnvironment, isPaymentToken, kindFromKey, lowestPlanWith, modeFromKey, parseArcEnvironment, planFeeBps, planForVolume, planIncludes, plansWith, prefixFor };
|
|
424
|
+
export { AGENT_ACTIVITY_LOG_RETENTION_DAYS, AGENT_CAPABILITIES, AGENT_DEFAULTS, ALL_WEBHOOK_EVENTS, API_KEY_PREFIXES, API_KEY_PREFIX_DISPLAY_LENGTH, API_KEY_RANDOM_BYTES, ARC_CHAINS, ARC_ENVIRONMENTS, ARC_MAINNET_CHAIN_ID, ARC_TESTNET_CHAIN_ID, CCTP_CONTRACTS, CCTP_DOMAIN_IDS, CCTP_SUPPORTED_SOURCE_CHAINS, DEFAULT_TIER, PAYMENT_TOKENS, PLANS, PLAN_FEE_CEILING_BPS, RECOVERY_GRACE_PERIODS, TOKENS, TOKEN_ADDRESSES, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENTS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_SCHEDULE_SECONDS, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, arcEnvironmentForChainId, arcExplorerTxUrl, arcMainnet, arcModeFor, arcTestnet, assertArcChainId, chainIdFor, getArcChain, getArcExplorerUrl, getCctpContracts, getTokenAddress, getTokenBySymbol, isArcChain, isArcEnvironment, isPaymentToken, kindFromKey, lowestPlanWith, modeFromKey, parseArcEnvironment, planFeeBps, planForVolume, planIncludes, planUpgradeFor, plansWith, prefixFor };
|
|
414
425
|
//# sourceMappingURL=index.js.map
|
|
415
426
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chains.ts","../src/tokens.ts","../src/tiers.ts","../src/webhooks.ts","../src/api-keys.ts","../src/agents.ts","../src/cctp.ts"],"names":[],"mappings":";;;AAaO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,oBAAA,GAAuB;AAEpC,IAAM,WAAA,GAA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AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,IAAA,EAAM,CAAA;AAAA,EACN,OAAA,EAAS,CAAA;AAAA,EACT,GAAA,EAAK;AACP;AAIO,IAAM,4BAAA,GAA2D;AAAA,EACtE,UAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AAEO,SAAS,iBAAiB,GAAA,EAAsC;AACrE,EAAA,OAAO,cAAA,CAAe,mBAAA,CAAoB,GAAG,CAAC,CAAA;AAChD","file":"index.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","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n","/**\n * Webhook event names.\n *\n * Wire format is `<resource>.<action>`. Every event payload is versioned at\n * the envelope level so additive changes do not break consumers.\n */\n\nexport const WEBHOOK_EVENTS = {\n payment: {\n created: 'payment.created',\n completed: 'payment.completed',\n failed: 'payment.failed',\n },\n subscription: {\n created: 'subscription.created',\n charged: 'subscription.charged',\n chargeFailed: 'subscription.charge_failed',\n recoveryAttempt: 'subscription.recovery_attempt',\n recoveryOutcome: 'subscription.recovery_outcome',\n cancelled: 'subscription.cancelled',\n lapsed: 'subscription.lapsed',\n },\n refund: {\n created: 'refund.created',\n completed: 'refund.completed',\n failed: 'refund.failed',\n },\n invoice: {\n created: 'invoice.created',\n paid: 'invoice.paid',\n overdue: 'invoice.overdue',\n },\n agent: {\n actionExecuted: 'agent.action_executed',\n jobProposed: 'agent.job_proposed',\n jobCompleted: 'agent.job_completed',\n jobDisputed: 'agent.job_disputed',\n },\n compliance: {\n walletFlagged: 'compliance.wallet_flagged',\n walletBlocked: 'compliance.wallet_blocked',\n },\n} as const\n\nexport type WebhookEventName =\n | (typeof WEBHOOK_EVENTS.payment)[keyof typeof WEBHOOK_EVENTS.payment]\n | (typeof WEBHOOK_EVENTS.subscription)[keyof typeof WEBHOOK_EVENTS.subscription]\n | (typeof WEBHOOK_EVENTS.refund)[keyof typeof WEBHOOK_EVENTS.refund]\n | (typeof WEBHOOK_EVENTS.invoice)[keyof typeof WEBHOOK_EVENTS.invoice]\n | (typeof WEBHOOK_EVENTS.agent)[keyof typeof WEBHOOK_EVENTS.agent]\n | (typeof WEBHOOK_EVENTS.compliance)[keyof typeof WEBHOOK_EVENTS.compliance]\n\nexport const ALL_WEBHOOK_EVENTS: readonly WebhookEventName[] = [\n ...Object.values(WEBHOOK_EVENTS.payment),\n ...Object.values(WEBHOOK_EVENTS.subscription),\n ...Object.values(WEBHOOK_EVENTS.refund),\n ...Object.values(WEBHOOK_EVENTS.invoice),\n ...Object.values(WEBHOOK_EVENTS.agent),\n ...Object.values(WEBHOOK_EVENTS.compliance),\n] as const\n\n/** Exponential backoff schedule for webhook delivery, in seconds. */\nexport const WEBHOOK_RETRY_SCHEDULE_SECONDS: readonly number[] = [\n 60, // 1 minute\n 300, // 5 minutes\n 1_800, // 30 minutes\n 7_200, // 2 hours\n 86_400, // 24 hours\n] as const\n\nexport const WEBHOOK_MAX_ATTEMPTS = WEBHOOK_RETRY_SCHEDULE_SECONDS.length + 1\n\n/** Webhook signatures older than this are rejected to prevent replay. */\nexport const WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = 300\n\n/** HTTP header carrying the HMAC signature. */\nexport const WEBHOOK_SIGNATURE_HEADER = 'strimz-signature'\n\n/** HTTP header carrying the unique delivery id (idempotency key for the receiver). */\nexport const WEBHOOK_DELIVERY_ID_HEADER = 'strimz-delivery-id'\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n","/**\n * Strimz AutoPay Agent feature flags and defaults.\n *\n * The agent is composed of independent capabilities that can be enabled or\n * disabled per merchant. Defaults are conservative. Merchants opt in to\n * value-moving capabilities (recovery retries, treasury auto-convert).\n */\n\nexport type AgentCapability =\n | 'identity'\n | 'recovery'\n | 'routing'\n | 'cashflow'\n | 'commerce'\n | 'pricing_intelligence'\n\nexport interface AgentCapabilityDescriptor {\n id: AgentCapability\n name: string\n /** Whether the capability moves money or signs transactions. */\n valueMoving: boolean\n /** Default enabled state for a newly created merchant. */\n defaultEnabled: boolean\n}\n\nexport const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor> = {\n identity: {\n id: 'identity',\n name: 'Agent Identity (ERC-8004)',\n valueMoving: false,\n defaultEnabled: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n },\n}\n\nexport type GracePeriodHours = 24 | 48 | 72\n\nexport const RECOVERY_GRACE_PERIODS: readonly GracePeriodHours[] = [24, 48, 72] as const\n\nexport type RecoveryRetryStrategy = 'once' | 'twice' | 'until_grace_ends'\n\nexport interface AgentDefaultConfig {\n recovery: {\n gracePeriodHours: GracePeriodHours\n strategy: RecoveryRetryStrategy\n }\n cashflow: {\n digestEnabled: boolean\n anomalySensitivity: 'low' | 'medium' | 'high'\n autoConvertToYield: boolean\n }\n commerce: {\n requireHumanApprovalAboveUsdCents: number\n }\n}\n\nexport const AGENT_DEFAULTS: AgentDefaultConfig = {\n recovery: {\n gracePeriodHours: 48,\n strategy: 'twice',\n },\n cashflow: {\n digestEnabled: false,\n anomalySensitivity: 'medium',\n autoConvertToYield: false,\n },\n commerce: {\n requireHumanApprovalAboveUsdCents: 100_000, // $1,000\n },\n}\n\n/** Time-to-live for the agent activity log, in days. */\nexport const AGENT_ACTIVITY_LOG_RETENTION_DAYS = 90\n","/**\n * Circle CCTP V2 contract addresses for Arc.\n *\n * CCTP lets a payer hold USDC on any supported chain (Ethereum, Base, Polygon,\n * Arbitrum, Solana, etc.) and pay a Strimz merchant who receives Arc USDC.\n *\n * @see https://developers.circle.com/stablecoins/cctp-getting-started\n */\n\nimport type { Address } from 'viem'\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport interface CCTPContractSet {\n tokenMessengerV2: Address\n messageTransmitterV2: Address\n gatewayWallet: Address\n gatewayMinter: Address\n /** CCTP domain identifier for the destination chain. */\n domainId: number\n}\n\nexport const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {\n testnet: {\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\n domainId: 26,\n },\n mainnet: {\n // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.\n // Testnet values are mirrored as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',\n messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',\n gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',\n gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',\n domainId: 26,\n },\n}\n\n/** CCTP domain ids for source chains a payer can bridge from. */\nexport const CCTP_DOMAIN_IDS = {\n ethereum: 0,\n avalanche: 1,\n optimism: 2,\n arbitrum: 3,\n noble: 4,\n solana: 5,\n base: 6,\n polygon: 7,\n arc: 26,\n} as const\n\nexport type CCTPSourceChain = keyof typeof CCTP_DOMAIN_IDS\n\nexport const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [\n 'ethereum',\n 'avalanche',\n 'optimism',\n 'arbitrum',\n 'base',\n 'polygon',\n 'solana',\n] as const\n\nexport function getCctpContracts(env: ArcEnvironment): CCTPContractSet {\n return CCTP_CONTRACTS[parseArcEnvironment(env)]\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/chains.ts","../src/tokens.ts","../src/tiers.ts","../src/webhooks.ts","../src/api-keys.ts","../src/agents.ts","../src/cctp.ts"],"names":[],"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,aAAoB,WAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,aAAA;AAAA,EACN,cAAA,EAAgB,WAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA,EAAE;AAAA,IAChD,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAC,4BAA4B,CAAA;AAAE,GACjD;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,OAAA,EAAS;AACX,CAAC;AAEM,IAAM,aAAoB,WAAA,CAAY;AAAA,EAC3C,EAAA,EAAI,oBAAA;AAAA,EACJ,IAAA,EAAM,KAAA;AAAA,EACN,cAA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A,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AAEO,SAAS,iBAAiB,GAAA,EAAsC;AACrE,EAAA,OAAO,cAAA,CAAe,mBAAA,CAAoB,GAAG,CAAC,CAAA;AAChD","file":"index.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","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n\nexport function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null {\n if (current === 'enterprise') return null\n const earned = planForVolume(volumes)\n return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null\n}\n","/**\n * Webhook event names.\n *\n * Wire format is `<resource>.<action>`. Every event payload is versioned at\n * the envelope level so additive changes do not break consumers.\n */\n\nexport const WEBHOOK_EVENTS = {\n payment: {\n created: 'payment.created',\n completed: 'payment.completed',\n failed: 'payment.failed',\n },\n subscription: {\n created: 'subscription.created',\n charged: 'subscription.charged',\n chargeFailed: 'subscription.charge_failed',\n recoveryAttempt: 'subscription.recovery_attempt',\n recoveryOutcome: 'subscription.recovery_outcome',\n cancelled: 'subscription.cancelled',\n lapsed: 'subscription.lapsed',\n },\n refund: {\n created: 'refund.created',\n completed: 'refund.completed',\n failed: 'refund.failed',\n },\n invoice: {\n created: 'invoice.created',\n paid: 'invoice.paid',\n overdue: 'invoice.overdue',\n },\n agent: {\n actionExecuted: 'agent.action_executed',\n jobProposed: 'agent.job_proposed',\n jobCompleted: 'agent.job_completed',\n jobDisputed: 'agent.job_disputed',\n },\n compliance: {\n walletFlagged: 'compliance.wallet_flagged',\n walletBlocked: 'compliance.wallet_blocked',\n },\n} as const\n\nexport type WebhookEventName =\n | (typeof WEBHOOK_EVENTS.payment)[keyof typeof WEBHOOK_EVENTS.payment]\n | (typeof WEBHOOK_EVENTS.subscription)[keyof typeof WEBHOOK_EVENTS.subscription]\n | (typeof WEBHOOK_EVENTS.refund)[keyof typeof WEBHOOK_EVENTS.refund]\n | (typeof WEBHOOK_EVENTS.invoice)[keyof typeof WEBHOOK_EVENTS.invoice]\n | (typeof WEBHOOK_EVENTS.agent)[keyof typeof WEBHOOK_EVENTS.agent]\n | (typeof WEBHOOK_EVENTS.compliance)[keyof typeof WEBHOOK_EVENTS.compliance]\n\nexport const ALL_WEBHOOK_EVENTS: readonly WebhookEventName[] = [\n ...Object.values(WEBHOOK_EVENTS.payment),\n ...Object.values(WEBHOOK_EVENTS.subscription),\n ...Object.values(WEBHOOK_EVENTS.refund),\n ...Object.values(WEBHOOK_EVENTS.invoice),\n ...Object.values(WEBHOOK_EVENTS.agent),\n ...Object.values(WEBHOOK_EVENTS.compliance),\n] as const\n\n/** Exponential backoff schedule for webhook delivery, in seconds. */\nexport const WEBHOOK_RETRY_SCHEDULE_SECONDS: readonly number[] = [\n 60, // 1 minute\n 300, // 5 minutes\n 1_800, // 30 minutes\n 7_200, // 2 hours\n 86_400, // 24 hours\n] as const\n\nexport const WEBHOOK_MAX_ATTEMPTS = WEBHOOK_RETRY_SCHEDULE_SECONDS.length + 1\n\n/** Webhook signatures older than this are rejected to prevent replay. */\nexport const WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = 300\n\n/** HTTP header carrying the HMAC signature. */\nexport const WEBHOOK_SIGNATURE_HEADER = 'strimz-signature'\n\n/** HTTP header carrying the unique delivery id (idempotency key for the receiver). */\nexport const WEBHOOK_DELIVERY_ID_HEADER = 'strimz-delivery-id'\n","/**\n * API key prefix conventions.\n *\n * Prefix tells you immediately which environment a key targets and whether it\n * is safe to expose to the client. Secret keys are server-side only; publishable\n * keys can ship in browser bundles.\n */\n\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type ApiKeyMode = 'test' | 'live'\nexport type ApiKeyKind = 'secret' | 'publishable'\n\nexport const API_KEY_PREFIXES = {\n secret: {\n test: 'sk_test_',\n live: 'sk_live_',\n },\n publishable: {\n test: 'pk_test_',\n live: 'pk_live_',\n },\n} as const satisfies Record<ApiKeyKind, Record<ApiKeyMode, string>>\n\n/** Length of the random portion of a key, before prefix. Base62, 256 bits of entropy. */\nexport const API_KEY_RANDOM_BYTES = 32\n\nexport function prefixFor(kind: ApiKeyKind, mode: ApiKeyMode): string {\n return API_KEY_PREFIXES[kind][mode]\n}\n\nexport function modeFromKey(key: string): ApiKeyMode | null {\n if (key.startsWith('sk_test_') || key.startsWith('pk_test_')) return 'test'\n if (key.startsWith('sk_live_') || key.startsWith('pk_live_')) return 'live'\n return null\n}\n\nexport function kindFromKey(key: string): ApiKeyKind | null {\n if (key.startsWith('sk_')) return 'secret'\n if (key.startsWith('pk_')) return 'publishable'\n return null\n}\n\n/** Number of leading characters of a key safe to display in dashboards/logs. */\nexport const API_KEY_PREFIX_DISPLAY_LENGTH = 12\n\nconst MODE_BY_ENVIRONMENT = {\n testnet: 'test',\n mainnet: 'live',\n} as const satisfies Record<ArcEnvironment, ApiKeyMode>\n\nexport function arcModeFor(env: ArcEnvironment): ApiKeyMode {\n return MODE_BY_ENVIRONMENT[parseArcEnvironment(env)]\n}\n","/**\n * Strimz AutoPay Agent feature flags and defaults.\n *\n * The agent is composed of independent capabilities that can be enabled or\n * disabled per merchant. Defaults are conservative. Merchants opt in to\n * value-moving capabilities (recovery retries, treasury auto-convert).\n */\n\nexport type AgentCapability =\n | 'identity'\n | 'recovery'\n | 'routing'\n | 'cashflow'\n | 'commerce'\n | 'pricing_intelligence'\n\nexport interface AgentCapabilityDescriptor {\n id: AgentCapability\n name: string\n /** Whether the capability moves money or signs transactions. */\n valueMoving: boolean\n /** Default enabled state for a newly created merchant. */\n defaultEnabled: boolean\n available: 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 available: true,\n },\n recovery: {\n id: 'recovery',\n name: 'Subscription Recovery',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n routing: {\n id: 'routing',\n name: 'Cross-Chain Payment Routing',\n valueMoving: true,\n defaultEnabled: false,\n available: true,\n },\n cashflow: {\n id: 'cashflow',\n name: 'Treasury Cash Flow Insights',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\n },\n commerce: {\n id: 'commerce',\n name: 'Agentic B2B Commerce (ERC-8183)',\n valueMoving: true,\n defaultEnabled: false,\n available: false,\n },\n pricing_intelligence: {\n id: 'pricing_intelligence',\n name: 'Subscription Pricing Intelligence',\n valueMoving: false,\n defaultEnabled: false,\n available: true,\n },\n}\n\nexport type GracePeriodHours = 24 | 48 | 72\n\nexport const RECOVERY_GRACE_PERIODS: readonly GracePeriodHours[] = [24, 48, 72] as const\n\nexport type RecoveryRetryStrategy = 'once' | 'twice' | 'until_grace_ends'\n\nexport interface AgentDefaultConfig {\n recovery: {\n gracePeriodHours: GracePeriodHours\n strategy: RecoveryRetryStrategy\n }\n cashflow: {\n digestEnabled: boolean\n anomalySensitivity: 'low' | 'medium' | 'high'\n autoConvertToYield: boolean\n }\n commerce: {\n requireHumanApprovalAboveUsdCents: number\n }\n}\n\nexport const AGENT_DEFAULTS: AgentDefaultConfig = {\n recovery: {\n gracePeriodHours: 48,\n strategy: 'twice',\n },\n cashflow: {\n digestEnabled: false,\n anomalySensitivity: 'medium',\n autoConvertToYield: false,\n },\n commerce: {\n requireHumanApprovalAboveUsdCents: 100_000, // $1,000\n },\n}\n\n/** Time-to-live for the agent activity log, in days. */\nexport const AGENT_ACTIVITY_LOG_RETENTION_DAYS = 90\n","/**\n * Circle CCTP V2 contract addresses for Arc.\n *\n * CCTP lets a payer hold USDC on any supported chain (Ethereum, Base, Polygon,\n * Arbitrum, Solana, etc.) and pay a Strimz merchant who receives Arc USDC.\n *\n * @see https://developers.circle.com/stablecoins/cctp-getting-started\n */\n\nimport type { Address } from 'viem'\nimport { parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport interface CCTPContractSet {\n tokenMessengerV2: Address\n messageTransmitterV2: Address\n gatewayWallet: Address\n gatewayMinter: Address\n /** CCTP domain identifier for the destination chain. */\n domainId: number\n}\n\nexport const CCTP_CONTRACTS: Record<ArcEnvironment, CCTPContractSet> = {\n testnet: {\n tokenMessengerV2: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',\n messageTransmitterV2: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',\n gatewayWallet: '0x0077777d7EBA4688BDeF3E311b846F25870A19B9',\n gatewayMinter: '0x0022222ABE238Cc2C7Bb1f21003F0a260052475B',\n domainId: 26,\n },\n mainnet: {\n // Pending Circle's mainnet publication of CCTP V2 addresses for Arc.\n // Testnet values are mirrored as a placeholder so type signatures stay non-null.\n tokenMessengerV2: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',\n messageTransmitterV2: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',\n gatewayWallet: '0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE',\n gatewayMinter: '0x2222222d7164433c4C09B0b0D809a9b52C04C205',\n domainId: 26,\n },\n}\n\n/** CCTP domain ids for source chains a payer can bridge from. */\nexport const CCTP_DOMAIN_IDS = {\n ethereum: 0,\n avalanche: 1,\n optimism: 2,\n arbitrum: 3,\n noble: 4,\n solana: 5,\n base: 6,\n polygon: 7,\n arc: 26,\n} as const\n\nexport type CCTPSourceChain = keyof typeof CCTP_DOMAIN_IDS\n\nexport const CCTP_SUPPORTED_SOURCE_CHAINS: readonly CCTPSourceChain[] = [\n 'ethereum',\n 'avalanche',\n 'optimism',\n 'arbitrum',\n 'base',\n 'polygon',\n 'solana',\n] as const\n\nexport function getCctpContracts(env: ArcEnvironment): CCTPContractSet {\n return CCTP_CONTRACTS[parseArcEnvironment(env)]\n}\n"]}
|
package/dist/tiers.cjs
CHANGED
|
@@ -100,6 +100,11 @@ function planForVolume(volumes) {
|
|
|
100
100
|
}
|
|
101
101
|
return reached;
|
|
102
102
|
}
|
|
103
|
+
function planUpgradeFor(current, volumes) {
|
|
104
|
+
if (current === "enterprise") return null;
|
|
105
|
+
const earned = planForVolume(volumes);
|
|
106
|
+
return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null;
|
|
107
|
+
}
|
|
103
108
|
|
|
104
109
|
exports.DEFAULT_TIER = DEFAULT_TIER;
|
|
105
110
|
exports.PLANS = PLANS;
|
|
@@ -108,6 +113,7 @@ exports.lowestPlanWith = lowestPlanWith;
|
|
|
108
113
|
exports.planFeeBps = planFeeBps;
|
|
109
114
|
exports.planForVolume = planForVolume;
|
|
110
115
|
exports.planIncludes = planIncludes;
|
|
116
|
+
exports.planUpgradeFor = planUpgradeFor;
|
|
111
117
|
exports.plansWith = plansWith;
|
|
112
118
|
//# sourceMappingURL=tiers.cjs.map
|
|
113
119
|
//# sourceMappingURL=tiers.cjs.map
|
package/dist/tiers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tokens.ts","../src/tiers.ts"],"names":[],"mappings":";;;AAkBO,IAAM,cAAA,GAA0C,CAAC,MAAA,EAAQ,MAAM,CAAA;AAkB/D,IAAM,MAAA,GAA+C;AAAA,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AC3E,EAAA,MAAM,UAAA,GAAa,KAAA,CAAM,IAAI,CAAA,CAAE,cAAA;AAC/B,EAAA,IAAI,eAAe,IAAA,EAAM,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,IAAI,CAAA,wBAAA,CAA0B,CAAA;AAC1E,EAAA,OAAO,MAAA,CAAO,UAAU,CAAA,GAAI,GAAA,IAAO,OAAO,MAAA,CAAO,KAAK,EAAE,QAAQ,CAAA;AAClE;AAEO,SAAS,cAAc,OAAA,EAAqC;AACjE,EAAA,IAAI,OAAA,GAAsB,MAAA;AAC1B,EAAA,KAAA,MAAW,QAAQ,YAAA,EAAc;AAC/B,IAAA,IAAI,cAAA,CAAe,IAAA,CAAK,CAAC,KAAA,KAAU,OAAA,CAAQ,KAAK,CAAA,IAAK,oBAAA,CAAqB,IAAA,EAAM,KAAK,CAAC,CAAA,EAAG;AACvF,MAAA,OAAA,GAAU,IAAA;AAAA,IACZ;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"tiers.cjs","sourcesContent":["/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tokens.ts","../src/tiers.ts"],"names":[],"mappings":";;;AAkBO,IAAM,cAAA,GAA0C,CAAC,MAAA,EAAQ,MAAM,CAAA;AAkB/D,IAAM,MAAA,GAA+C;AAAA,EAC1D,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,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,CAAA;;;ACjCA,IAAM,aAAA,GAAwC;AAAA,EAC5C,YAAA;AAAA,EACA,gBAAA;AA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AO,OAAA;AACT;AAEO,SAAS,cAAA,CAAe,SAAuB,OAAA,EAA4C;AAChG,EAAA,IAAI,OAAA,KAAY,cAAc,OAAO,IAAA;AACrC,EAAA,MAAM,MAAA,GAAS,cAAc,OAAO,CAAA;AACpC,EAAA,OAAO,UAAA,CAAW,QAAQ,MAAM,CAAA,GAAI,WAAW,OAAA,CAAQ,OAAO,IAAI,MAAA,GAAS,IAAA;AAC7E","file":"tiers.cjs","sourcesContent":["/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n\nexport function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null {\n if (current === 'enterprise') return null\n const earned = planForVolume(volumes)\n return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null\n}\n"]}
|
package/dist/tiers.d.cts
CHANGED
|
@@ -30,5 +30,6 @@ declare function plansWith(feature: PlanFeature): MerchantTier[];
|
|
|
30
30
|
declare function lowestPlanWith(feature: PlanFeature): MerchantTier;
|
|
31
31
|
type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>;
|
|
32
32
|
declare function planForVolume(volumes: PaymentVolumes): VolumePlan;
|
|
33
|
+
declare function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null;
|
|
33
34
|
|
|
34
|
-
export { DEFAULT_TIER, type MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, type PaymentVolumes, type PlanDefinition, type PlanFeature, type VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith };
|
|
35
|
+
export { DEFAULT_TIER, type MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, type PaymentVolumes, type PlanDefinition, type PlanFeature, type VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, planUpgradeFor, plansWith };
|
package/dist/tiers.d.ts
CHANGED
|
@@ -30,5 +30,6 @@ declare function plansWith(feature: PlanFeature): MerchantTier[];
|
|
|
30
30
|
declare function lowestPlanWith(feature: PlanFeature): MerchantTier;
|
|
31
31
|
type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>;
|
|
32
32
|
declare function planForVolume(volumes: PaymentVolumes): VolumePlan;
|
|
33
|
+
declare function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null;
|
|
33
34
|
|
|
34
|
-
export { DEFAULT_TIER, type MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, type PaymentVolumes, type PlanDefinition, type PlanFeature, type VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith };
|
|
35
|
+
export { DEFAULT_TIER, type MerchantTier, PLANS, PLAN_FEE_CEILING_BPS, type PaymentVolumes, type PlanDefinition, type PlanFeature, type VolumePlan, lowestPlanWith, planFeeBps, planForVolume, planIncludes, planUpgradeFor, plansWith };
|
package/dist/tiers.js
CHANGED
|
@@ -98,7 +98,12 @@ function planForVolume(volumes) {
|
|
|
98
98
|
}
|
|
99
99
|
return reached;
|
|
100
100
|
}
|
|
101
|
+
function planUpgradeFor(current, volumes) {
|
|
102
|
+
if (current === "enterprise") return null;
|
|
103
|
+
const earned = planForVolume(volumes);
|
|
104
|
+
return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null;
|
|
105
|
+
}
|
|
101
106
|
|
|
102
|
-
export { DEFAULT_TIER, PLANS, PLAN_FEE_CEILING_BPS, lowestPlanWith, planFeeBps, planForVolume, planIncludes, plansWith };
|
|
107
|
+
export { DEFAULT_TIER, PLANS, PLAN_FEE_CEILING_BPS, lowestPlanWith, planFeeBps, planForVolume, planIncludes, planUpgradeFor, plansWith };
|
|
103
108
|
//# sourceMappingURL=tiers.js.map
|
|
104
109
|
//# sourceMappingURL=tiers.js.map
|
package/dist/tiers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tokens.ts","../src/tiers.ts"],"names":[],"mappings":";AAkBO,IAAM,cAAA,GAA0C,CAAC,MAAA,EAAQ,MAAM,CAAA;AAkB/D,IAAM,MAAA,GAA+C;AAAA,EAC1D,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,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;AAA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O,UAAU,CAAA,GAAI,GAAA,IAAO,OAAO,MAAA,CAAO,KAAK,EAAE,QAAQ,CAAA;AAClE;AAEO,SAAS,cAAc,OAAA,EAAqC;AACjE,EAAA,IAAI,OAAA,GAAsB,MAAA;AAC1B,EAAA,KAAA,MAAW,QAAQ,YAAA,EAAc;AAC/B,IAAA,IAAI,cAAA,CAAe,IAAA,CAAK,CAAC,KAAA,KAAU,OAAA,CAAQ,KAAK,CAAA,IAAK,oBAAA,CAAqB,IAAA,EAAM,KAAK,CAAC,CAAA,EAAG;AACvF,MAAA,OAAA,GAAU,IAAA;AAAA,IACZ;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"tiers.js","sourcesContent":["/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tokens.ts","../src/tiers.ts"],"names":[],"mappings":";AAkBO,IAAM,cAAA,GAA0C,CAAC,MAAA,EAAQ,MAAM,CAAA;AAkB/D,IAAM,MAAA,GAA+C;AAAA,EAC1D,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ,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,CAAA;;;ACjCA,IAAM,aAAA,GAAwC;AAAA,EAC5C,YAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,KAAA,GAA8C;AAAA,EACzD,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,MAAA;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,CAAA;AAAA,IACR,cAAA,EAAgB,CAAA;AAAA,IAChB,UAAU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AAI,WAAW,OAAA,CAAQ,OAAO,IAAI,MAAA,GAAS,IAAA;AAC7E","file":"tiers.js","sourcesContent":["/**\n * Token registry for Arc.\n *\n * USDC and EURC are first-class payment tokens. They can be requested in a\n * payment session and used as a subscription currency.\n *\n * USYC is yield-bearing and is treated as a treasury asset only. Merchants\n * can hold it and earn yield, but a payer cannot pay in USYC.\n */\n\nimport type { Address } from 'viem'\nimport { getArcChain, parseArcEnvironment, type ArcEnvironment } from './chains.js'\n\nexport type TokenSymbol = 'USDC' | 'EURC' | 'USYC'\n\n/** Tokens accepted as direct payment by Strimz. USYC is excluded by design. */\nexport type PaymentToken = Extract<TokenSymbol, 'USDC' | 'EURC'>\n\nexport const PAYMENT_TOKENS: readonly PaymentToken[] = ['USDC', 'EURC'] as const\n\nexport interface TokenDescriptor {\n symbol: TokenSymbol\n name: string\n decimals: number\n /** Whether the token is accepted as direct payment. */\n paymentEligible: boolean\n /** Whether the token is yield-bearing. */\n yieldBearing: boolean\n}\n\nexport interface TokenAddress {\n symbol: TokenSymbol\n address: Address\n chainId: number\n}\n\nexport const TOKENS: Record<TokenSymbol, TokenDescriptor> = {\n USDC: {\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n EURC: {\n symbol: 'EURC',\n name: 'Euro Coin',\n decimals: 6,\n paymentEligible: true,\n yieldBearing: false,\n },\n USYC: {\n symbol: 'USYC',\n name: 'US Yield Coin',\n decimals: 6,\n paymentEligible: false,\n yieldBearing: true,\n },\n}\n\n/**\n * Native, Circle-issued addresses on Arc.\n * The same address is reused across testnet and mainnet for native tokens\n * since Arc preserves canonical addresses across environments where possible.\n */\nexport const TOKEN_ADDRESSES: Record<ArcEnvironment, Record<TokenSymbol, Address>> = {\n testnet: {\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',\n USYC: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C',\n },\n mainnet: {\n // Mainnet addresses pending Arc mainnet beta launch; placeholders mirror\n // testnet for now and must be replaced when Circle publishes the canonical\n // mainnet token registry.\n USDC: '0x3600000000000000000000000000000000000000',\n EURC: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',\n USYC: '0x8a5D989Bbb96929F689B0200f435f53dA42bF490',\n },\n}\n\nexport function getTokenAddress(env: ArcEnvironment, symbol: TokenSymbol): Address {\n return TOKEN_ADDRESSES[parseArcEnvironment(env)][symbol]\n}\n\nexport function getTokenBySymbol(symbol: string): TokenDescriptor | undefined {\n return (TOKENS as Record<string, TokenDescriptor>)[symbol]\n}\n\nexport function isPaymentToken(symbol: string): symbol is PaymentToken {\n return PAYMENT_TOKENS.includes(symbol as PaymentToken)\n}\n\nexport function chainIdFor(env: ArcEnvironment): number {\n return getArcChain(env).id\n}\n","/**\n * Strimz pricing tiers.\n *\n * Fees are expressed in basis points (bps): 100 bps = 1%.\n * The subscription premium is added to the per-transaction rate when the\n * payment is recurring (i.e. originated from a SubscriptionPlan).\n */\n\nimport { PAYMENT_TOKENS, TOKENS, type PaymentToken } from './tokens.js'\n\nexport type MerchantTier = 'free' | 'starter' | 'growth' | 'enterprise'\n\nexport type VolumePlan = Exclude<MerchantTier, 'enterprise'>\n\nexport type PlanFeature = 'storefront' | 'anomaly_alerts' | 'yield_recommendations'\n\nexport interface PlanDefinition {\n id: MerchantTier\n name: string\n feeBps: number | null\n entersAtVolume: number | null\n features: readonly PlanFeature[]\n prioritySupport: boolean\n}\n\nconst PAID_FEATURES: readonly PlanFeature[] = [\n 'storefront',\n 'anomaly_alerts',\n 'yield_recommendations',\n]\n\nexport const PLANS: Record<MerchantTier, PlanDefinition> = {\n free: {\n id: 'free',\n name: 'Free',\n feeBps: 0,\n entersAtVolume: 0,\n features: [],\n prioritySupport: false,\n },\n starter: {\n id: 'starter',\n name: 'Starter',\n feeBps: 50,\n entersAtVolume: 1_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n growth: {\n id: 'growth',\n name: 'Growth',\n feeBps: 40,\n entersAtVolume: 50_000,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n feeBps: null,\n entersAtVolume: null,\n features: PAID_FEATURES,\n prioritySupport: true,\n },\n}\n\nexport const DEFAULT_TIER: MerchantTier = 'free'\n\nconst PLAN_ORDER: readonly MerchantTier[] = ['free', 'starter', 'growth', 'enterprise']\n\nconst VOLUME_PLANS: readonly VolumePlan[] = ['free', 'starter', 'growth']\n\nexport const PLAN_FEE_CEILING_BPS: number = Math.max(\n ...VOLUME_PLANS.map((plan) => PLANS[plan].feeBps ?? 0),\n)\n\nexport function planFeeBps(plan: MerchantTier): number | null {\n return PLANS[plan].feeBps\n}\n\nexport function planIncludes(plan: MerchantTier, feature: PlanFeature): boolean {\n return PLANS[plan].features.includes(feature)\n}\n\nexport function plansWith(feature: PlanFeature): MerchantTier[] {\n return PLAN_ORDER.filter((plan) => planIncludes(plan, feature))\n}\n\nexport function lowestPlanWith(feature: PlanFeature): MerchantTier {\n const plan = PLAN_ORDER.find((candidate) => planIncludes(candidate, feature))\n if (!plan) throw new Error(`no plan includes ${feature}`)\n return plan\n}\n\nexport type PaymentVolumes = Readonly<Record<PaymentToken, bigint>>\n\nfunction thresholdInBaseUnits(plan: VolumePlan, token: PaymentToken): bigint {\n const wholeUnits = PLANS[plan].entersAtVolume\n if (wholeUnits === null) throw new Error(`${plan} has no volume threshold`)\n return BigInt(wholeUnits) * 10n ** BigInt(TOKENS[token].decimals)\n}\n\nexport function planForVolume(volumes: PaymentVolumes): VolumePlan {\n let reached: VolumePlan = 'free'\n for (const plan of VOLUME_PLANS) {\n if (PAYMENT_TOKENS.some((token) => volumes[token] >= thresholdInBaseUnits(plan, token))) {\n reached = plan\n }\n }\n return reached\n}\n\nexport function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null {\n if (current === 'enterprise') return null\n const earned = planForVolume(volumes)\n return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strimz/shared-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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>",
|
package/src/agents.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface AgentCapabilityDescriptor {
|
|
|
21
21
|
valueMoving: boolean
|
|
22
22
|
/** Default enabled state for a newly created merchant. */
|
|
23
23
|
defaultEnabled: boolean
|
|
24
|
+
available: boolean
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescriptor> = {
|
|
@@ -29,36 +30,42 @@ export const AGENT_CAPABILITIES: Record<AgentCapability, AgentCapabilityDescript
|
|
|
29
30
|
name: 'Agent Identity (ERC-8004)',
|
|
30
31
|
valueMoving: false,
|
|
31
32
|
defaultEnabled: true,
|
|
33
|
+
available: true,
|
|
32
34
|
},
|
|
33
35
|
recovery: {
|
|
34
36
|
id: 'recovery',
|
|
35
37
|
name: 'Subscription Recovery',
|
|
36
38
|
valueMoving: true,
|
|
37
39
|
defaultEnabled: false,
|
|
40
|
+
available: true,
|
|
38
41
|
},
|
|
39
42
|
routing: {
|
|
40
43
|
id: 'routing',
|
|
41
44
|
name: 'Cross-Chain Payment Routing',
|
|
42
45
|
valueMoving: true,
|
|
43
46
|
defaultEnabled: false,
|
|
47
|
+
available: true,
|
|
44
48
|
},
|
|
45
49
|
cashflow: {
|
|
46
50
|
id: 'cashflow',
|
|
47
51
|
name: 'Treasury Cash Flow Insights',
|
|
48
52
|
valueMoving: false,
|
|
49
53
|
defaultEnabled: false,
|
|
54
|
+
available: true,
|
|
50
55
|
},
|
|
51
56
|
commerce: {
|
|
52
57
|
id: 'commerce',
|
|
53
58
|
name: 'Agentic B2B Commerce (ERC-8183)',
|
|
54
59
|
valueMoving: true,
|
|
55
60
|
defaultEnabled: false,
|
|
61
|
+
available: false,
|
|
56
62
|
},
|
|
57
63
|
pricing_intelligence: {
|
|
58
64
|
id: 'pricing_intelligence',
|
|
59
65
|
name: 'Subscription Pricing Intelligence',
|
|
60
66
|
valueMoving: false,
|
|
61
67
|
defaultEnabled: false,
|
|
68
|
+
available: true,
|
|
62
69
|
},
|
|
63
70
|
}
|
|
64
71
|
|
package/src/tiers.ts
CHANGED
|
@@ -109,3 +109,9 @@ export function planForVolume(volumes: PaymentVolumes): VolumePlan {
|
|
|
109
109
|
}
|
|
110
110
|
return reached
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
export function planUpgradeFor(current: MerchantTier, volumes: PaymentVolumes): VolumePlan | null {
|
|
114
|
+
if (current === 'enterprise') return null
|
|
115
|
+
const earned = planForVolume(volumes)
|
|
116
|
+
return PLAN_ORDER.indexOf(earned) > PLAN_ORDER.indexOf(current) ? earned : null
|
|
117
|
+
}
|