@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
- const discountAmount = Math.floor((tokenCost * 200_000) / RATE_SCALE);
1373
- discounts.push({
1374
- name: 'Gateway Operator',
1375
- discountTotal: discountAmount,
1376
- multiplier: 0.8,
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
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '4.0.0-solana.36';
17
+ export const version = '4.0.0-solana.37';
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "4.0.0-solana.35";
16
+ export declare const version = "4.0.0-solana.36";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "4.0.0-solana.36",
3
+ "version": "4.0.0-solana.37",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"