Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/alpha' into PE-6929-validate-ant…
Browse files Browse the repository at this point in the history
…-read
  • Loading branch information
atticusofsparta committed Oct 15, 2024
2 parents 44cc472 + 2a42ba4 commit 7c54bd9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [2.3.2-alpha.2](https://github.com/ar-io/ar-io-sdk/compare/v2.3.2-alpha.1...v2.3.2-alpha.2) (2024-10-15)


### Bug Fixes

* **io:** add getDemandFactor api ([feab461](https://github.com/ar-io/ar-io-sdk/commit/feab4612d4e95b0fea14a4e0fa9f17a5c57779e1))

## [2.3.2-alpha.1](https://github.com/ar-io/ar-io-sdk/compare/v2.3.1...v2.3.2-alpha.1) (2024-10-14)


Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
- [`getGateways({ cursor, limit, sortBy, sortOrder })`](#getgateways-cursor-limit-sortby-sortorder-)
- [`getArNSRecord({ name })`](#getarnsrecord-name-)
- [`getArNSRecords({ cursor, limit, sortBy, sortOrder })`](#getarnsrecords-cursor-limit-sortby-sortorder-)
- [`getDemandFactor()`](#getdemandfactor)
- [`getObservations({ epochIndex })`](#getobservations-epochindex-)
- [`getDistributions({ epochIndex })`](#getdistributions-epochindex-)
- [`getEpoch({ epochIndex })`](#getepoch-epochindex-)
Expand Down Expand Up @@ -571,6 +572,24 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`

</details>

#### `getDemandFactor()`

Retrieves the current demand factor of the network. The demand factor is a multiplier applied to the cost of ArNS interactions based on the current network demand.

```typescript
const io = IO.init();
const demandFactor = await io.getDemandFactor();
```

<details>
<summary>Output</summary>

```json
1.05256
```

</details>

#### `getObservations({ epochIndex })`

Returns the epoch-indexed observation list.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ar.io/sdk",
"version": "2.3.2-alpha.1",
"version": "2.3.2-alpha.2",
"repository": {
"type": "git",
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
Expand Down
6 changes: 6 additions & 0 deletions src/common/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ export class IOReadable implements AoIORead {
tags: [{ name: 'Action', value: 'Get-Registration-Fees' }],
});
}

async getDemandFactor(): Promise<number> {
return this.process.read<number>({
tags: [{ name: 'Action', value: 'Demand-Factor' }],
});
}
}

export class IOWriteable extends IOReadable implements AoIOWrite {
Expand Down
1 change: 1 addition & 0 deletions src/types/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export interface AoIORead {
quantity?: number;
}): Promise<number>;
getRegistrationFees(): Promise<AoRegistrationFees>;
getDemandFactor(): Promise<number>;
}

export interface AoIOWrite extends AoIORead {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

// AUTOMATICALLY GENERATED FILE - DO NOT TOUCH

export const version = '2.3.2-alpha.1';
export const version = '2.3.2-alpha.2';

0 comments on commit 7c54bd9

Please sign in to comment.