@orangecheck/me-client 0.21.1 → 0.23.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/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +22 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -15
- package/dist/index.mjs.map +1 -1
- package/dist/{integrator-m712Srxt.d.mts → integrator-XkSgSrD4.d.mts} +66 -7
- package/dist/{integrator-m712Srxt.d.ts → integrator-XkSgSrD4.d.ts} +66 -7
- package/dist/integrator.d.mts +1 -1
- package/dist/integrator.d.ts +1 -1
- package/dist/integrator.js +20 -14
- package/dist/integrator.js.map +1 -1
- package/dist/integrator.mjs +20 -14
- package/dist/integrator.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -247,27 +247,34 @@ var PLATFORM_FEE_POLICY = {
|
|
|
247
247
|
* @orangecheck/me-client release. */
|
|
248
248
|
ratified: "2026-04-30"
|
|
249
249
|
};
|
|
250
|
-
var MIN_INTEGRATOR_PRICE_SATS =
|
|
251
|
-
|
|
250
|
+
var MIN_INTEGRATOR_PRICE_SATS = 1;
|
|
251
|
+
var MAX_DROP_WINDOW_DAYS = 92;
|
|
252
|
+
function computeFees(cfg, payment_amount_sats, opts) {
|
|
253
|
+
const is_agent = opts?.is_agent === true;
|
|
254
|
+
if (is_agent && cfg.agent?.refuse) {
|
|
255
|
+
throw new Error("agent_refused");
|
|
256
|
+
}
|
|
257
|
+
const effective_site_pays = is_agent && cfg.agent?.site_pays ? cfg.agent.site_pays : cfg.site_pays;
|
|
258
|
+
const effective_user_share_pct = is_agent && typeof cfg.agent?.user_share_pct === "number" ? cfg.agent.user_share_pct : cfg.user_share_pct;
|
|
252
259
|
let gross = 0;
|
|
253
|
-
if (
|
|
254
|
-
gross = Math.max(MIN_INTEGRATOR_PRICE_SATS, Math.round(
|
|
260
|
+
if (effective_site_pays.kind === "fixed_sats") {
|
|
261
|
+
gross = Math.max(MIN_INTEGRATOR_PRICE_SATS, Math.round(effective_site_pays.sats));
|
|
255
262
|
} else {
|
|
256
263
|
if (payment_amount_sats == null) {
|
|
257
264
|
throw new Error("percent_of_amount config requires payment_amount_sats");
|
|
258
265
|
}
|
|
259
266
|
gross = Math.max(
|
|
260
267
|
MIN_INTEGRATOR_PRICE_SATS,
|
|
261
|
-
Math.round(payment_amount_sats *
|
|
268
|
+
Math.round(payment_amount_sats * effective_site_pays.pct)
|
|
262
269
|
);
|
|
263
270
|
}
|
|
264
|
-
const platform_fee_sats = Math.
|
|
265
|
-
|
|
266
|
-
Math.round(gross * PLATFORM_FEE_POLICY.pct)
|
|
271
|
+
const platform_fee_sats = Math.min(
|
|
272
|
+
gross,
|
|
273
|
+
Math.max(PLATFORM_FEE_POLICY.min_floor_sats, Math.round(gross * PLATFORM_FEE_POLICY.pct))
|
|
267
274
|
);
|
|
268
|
-
const user_share = Math.min(0.8, Math.max(0,
|
|
269
|
-
const user_earned_sats = Math.round(gross * user_share);
|
|
270
|
-
const site_rebate_sats =
|
|
275
|
+
const user_share = Math.min(0.8, Math.max(0, effective_user_share_pct));
|
|
276
|
+
const user_earned_sats = Math.min(gross - platform_fee_sats, Math.round(gross * user_share));
|
|
277
|
+
const site_rebate_sats = gross - platform_fee_sats - user_earned_sats;
|
|
271
278
|
return { gross_fee_sats: gross, platform_fee_sats, user_earned_sats, site_rebate_sats };
|
|
272
279
|
}
|
|
273
280
|
function validateIntegratorConfig(cfg) {
|
|
@@ -1427,10 +1434,10 @@ var EVENT_SUBTYPES = {
|
|
|
1427
1434
|
id: "pledge_resolution",
|
|
1428
1435
|
class: "B",
|
|
1429
1436
|
label: "pledge resolved",
|
|
1430
|
-
fires_when: "an oc-pledge bonded commitment resolves (
|
|
1431
|
-
example: "user staked
|
|
1437
|
+
fires_when: "an oc-pledge bonded commitment resolves on your surface (kept / broken / disputed / expired_unresolved). pledge bonds never move \u2014 any sat payout is an integrator-composed flow on top of pledge (e.g., HTLC), not a pledge primitive (oc-pledge-protocol WHY.md H7)",
|
|
1438
|
+
example: "user staked sats \xD7 days-unspent on a prediction; the pledge resolved kept and the integrator paid out per its own composed terms",
|
|
1432
1439
|
common_use_cases: ["pledge", "staking", "resolution", "commit-reveal"],
|
|
1433
|
-
typical_price_hint: "1% of pledge amount (percent_of_amount) \xB7 OFF by default"
|
|
1440
|
+
typical_price_hint: "1% of pledge bond amount (percent_of_amount) \xB7 OFF by default"
|
|
1434
1441
|
},
|
|
1435
1442
|
// ── Class C · session ──
|
|
1436
1443
|
session_creation: {
|
|
@@ -1465,6 +1472,6 @@ var oc = {
|
|
|
1465
1472
|
identity
|
|
1466
1473
|
};
|
|
1467
1474
|
|
|
1468
|
-
export { ALL_EVENT_SUBTYPES, ARCHETYPE_TEMPLATES, EVENT_SUBTYPES, MIN_INTEGRATOR_PRICE_SATS, MeClientError, OcSignInButton, PLATFORM_FEE_POLICY, clearBearerToken, computeFees, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, identity, oc, onTelemetry, parseTrustAttestationCount, payment, refreshEnvelopeJwks, scope, session, setBearerToken, setOrigin, subtypesForClass, validateIntegratorConfig, verifyActivityAttestation, webhook, withRateLimitRetry };
|
|
1475
|
+
export { ALL_EVENT_SUBTYPES, ARCHETYPE_TEMPLATES, EVENT_SUBTYPES, MAX_DROP_WINDOW_DAYS, MIN_INTEGRATOR_PRICE_SATS, MeClientError, OcSignInButton, PLATFORM_FEE_POLICY, clearBearerToken, computeFees, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, identity, oc, onTelemetry, parseTrustAttestationCount, payment, refreshEnvelopeJwks, scope, session, setBearerToken, setOrigin, subtypesForClass, validateIntegratorConfig, verifyActivityAttestation, webhook, withRateLimitRetry };
|
|
1469
1476
|
//# sourceMappingURL=index.mjs.map
|
|
1470
1477
|
//# sourceMappingURL=index.mjs.map
|