@ar.io/sdk 4.0.0-solana.36 → 4.0.0-solana.37
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.
|
@@ -1369,12 +1369,25 @@ export class SolanaARIOReadable {
|
|
|
1369
1369
|
if (gwAccount.exists) {
|
|
1370
1370
|
const gw = deserializeGateway(Buffer.from(gwAccount.data));
|
|
1371
1371
|
if (gw.status === 'joined') {
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1372
|
+
// Match on-chain eligibility from ario-arns pricing.rs
|
|
1373
|
+
// `try_apply_gateway_discount`:
|
|
1374
|
+
// 1. Tenure: gateway running >= 180 days (15_552_000 seconds)
|
|
1375
|
+
const GATEWAY_DISCOUNT_MIN_TENURE_S = 15_552_000;
|
|
1376
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
1377
|
+
const timeRunning = nowSeconds - gw.startTimestamp;
|
|
1378
|
+
// 2. Performance: >= 90% epoch pass rate
|
|
1379
|
+
const passRate = ((1 + gw.stats.passedEpochCount) /
|
|
1380
|
+
(1 + gw.stats.totalEpochCount)) *
|
|
1381
|
+
1_000_000;
|
|
1382
|
+
if (timeRunning >= GATEWAY_DISCOUNT_MIN_TENURE_S &&
|
|
1383
|
+
passRate >= 900_000) {
|
|
1384
|
+
const discountAmount = Math.floor((tokenCost * 200_000) / RATE_SCALE);
|
|
1385
|
+
discounts.push({
|
|
1386
|
+
name: 'Gateway Operator',
|
|
1387
|
+
discountTotal: discountAmount,
|
|
1388
|
+
multiplier: 0.8,
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1378
1391
|
}
|
|
1379
1392
|
}
|
|
1380
1393
|
}
|
package/lib/esm/version.js
CHANGED
package/lib/types/version.d.ts
CHANGED