Skip to content

Commit

Permalink
Merge pull request #295 from ar-io/alpha
Browse files Browse the repository at this point in the history
chore: release 2.6.0
  • Loading branch information
fedellen authored Dec 5, 2024
2 parents 8cff7a3 + 4105163 commit 3eb287c
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 6 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# [2.6.0-alpha.4](https://github.com/ar-io/ar-io-sdk/compare/v2.6.0-alpha.3...v2.6.0-alpha.4) (2024-12-05)


### Features

* **get demand factor settings:** init new IO method PE-6894 ([ad2eb36](https://github.com/ar-io/ar-io-sdk/commit/ad2eb366328439fa1693de10c7c2ced12623385f))

# [2.6.0-alpha.3](https://github.com/ar-io/ar-io-sdk/compare/v2.6.0-alpha.2...v2.6.0-alpha.3) (2024-12-05)


### Bug Fixes

* **lua id:** bump lua id for ANT 9 ([9e8e7e8](https://github.com/ar-io/ar-io-sdk/commit/9e8e7e83deb7aef9fc6d94f294d6087840ade3e0))

# [2.6.0-alpha.2](https://github.com/ar-io/ar-io-sdk/compare/v2.6.0-alpha.1...v2.6.0-alpha.2) (2024-12-02)


### Bug Fixes

* **io:** update gateway delegates api, add to README ([65aa6a8](https://github.com/ar-io/ar-io-sdk/commit/65aa6a8e280a6d0b6044caf9ba88f47a61d08022))

## [2.5.5](https://github.com/ar-io/ar-io-sdk/compare/v2.5.4...v2.5.5) (2024-11-28)


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
- [Primary Names](#primary-names)
- [`getPrimaryNames({ cursor, limit, sortBy, sortOrder })`](#getprimarynames-cursor-limit-sortby-sortorder-)
- [`getPrimaryName({ name, address })`](#getprimaryname-name-address-)
- [`requestPrimaryName({ name, address })`](#requestprimaryname-name-address-)
- [`requestPrimaryName({ name })`](#requestprimaryname-name-)
- [`getPrimaryNameRequest({ initiator })`](#getprimarynamerequest-initiator-)
- [Configuration](#configuration)
- [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
Expand Down Expand Up @@ -1688,7 +1688,7 @@ const name = await io.getPrimaryName({

</details>

#### `requestPrimaryName({ name, address })`
#### `requestPrimaryName({ name })`

Requests a primary name for the caller's address. The request must be approved by the new owner of the requested name via the `approvePrimaryNameRequest`[#approveprimarynamerequest-name-address-] API.

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.5.5",
"version": "2.6.0-alpha.4",
"repository": {
"type": "git",
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
Expand Down
2 changes: 1 addition & 1 deletion src/common/ant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
tags: [
...(options?.tags ?? []),
{ name: 'Action', value: 'Set-Keywords' },
{ name: 'Description', value: JSON.stringify(keywords) },
{ name: 'Keywords', value: JSON.stringify(keywords) },
],
signer: this.signer,
});
Expand Down
14 changes: 14 additions & 0 deletions src/common/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ import {
AoEpochSettings,
AoGateway,
AoGatewayDelegateWithAddress,
AoGatewayRegistrySettings,
AoGatewayVault,
AoIORead,
AoIOWrite,
AoRegistrationFees,
AoVaultData,
AoWalletVault,
DemandFactorSettings,
EpochInput,
isProcessConfiguration,
isProcessIdConfiguration,
Expand Down Expand Up @@ -534,6 +536,12 @@ export class IOReadable implements AoIORead {
});
}

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

// Auctions
async getArNSAuctions(
params?: PaginationParams<AoAuction>,
Expand Down Expand Up @@ -725,6 +733,12 @@ export class IOReadable implements AoIORead {
],
});
}

async getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings> {
return this.process.read({
tags: [{ name: 'Action', value: 'Gateway-Registry-Settings' }],
});
}
}

export class IOWriteable extends IOReadable implements AoIOWrite {
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export const IO_TESTNET_PROCESS_ID =
export const ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
export const MIO_PER_IO = 1_000_000;
export const AOS_MODULE_ID = 'cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk';
export const ANT_LUA_ID = 'XP9_LFTae8C0yvCb_DUJaC5LXaiZIbiGT1yY25X0JCg';
export const ANT_LUA_ID = 'ezS3Z57rq_0skoG0WYmIqJ33mJiu0HbYNn9vEu12Mc4';
export const DEFAULT_SCHEDULER_ID =
'_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
34 changes: 34 additions & 0 deletions src/types/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,38 @@ export type AoJoinNetworkParams = Pick<

export type AoUpdateGatewaySettingsParams = AtLeastOne<AoJoinNetworkParams>;

export type AoGatewayRegistrySettings = {
delegates: {
minStake: number;
withdrawLengthMs: number;
};
observers: {
tenureWeightDays: number;
tenureWeightPeriod: number;
maxTenureWeight: number;
maxPerEpoch: number;
};
operators: {
minStake: number;
withdrawLengthMs: number;
leaveLengthMs: number;
failedEpochCountMax: number;
failedEpochSlashRate: number;
};
};

export type DemandFactorSettings = {
periodZeroStartTimestamp: number;
movingAvgPeriodCount: number;
periodLengthMs: number;
demandFactorBaseValue: number;
demandFactorMin: number;
demandFactorUpAdjustment: number;
demandFactorDownAdjustment: number;
stepDownThreshold: number;
criteria: string;
};

// Interfaces

export interface AoIORead {
Expand Down Expand Up @@ -429,6 +461,7 @@ export interface AoIORead {
}): Promise<number>; // TODO: add getCostDetails API that provides funding cost and discount details
getRegistrationFees(): Promise<AoRegistrationFees>;
getDemandFactor(): Promise<number>;
getDemandFactorSettings(): Promise<DemandFactorSettings>;
getVaults(
params?: PaginationParams<AoWalletVault>,
): Promise<PaginationResult<AoWalletVault>>;
Expand All @@ -454,6 +487,7 @@ export interface AoIORead {
getRedelegationFee(params: {
address: WalletAddress;
}): Promise<AoRedelegationFeeInfo>;
getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings>;
}

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 @@ -15,4 +15,4 @@
*/

// AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
export const version = '2.5.5';
export const version = '2.6.0-alpha.4';
51 changes: 51 additions & 0 deletions tests/e2e/esm/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,29 @@ describe('e2e esm tests', async () => {
assert.ok(epochSettings);
});

it('should be able to get demand factor settings', async () => {
const demandFactorSettings = await io.getDemandFactorSettings();
assert.ok(demandFactorSettings);
assert.equal(
typeof demandFactorSettings.periodZeroStartTimestamp,
'number',
);
assert.equal(typeof demandFactorSettings.movingAvgPeriodCount, 'number');
assert.equal(typeof demandFactorSettings.periodLengthMs, 'number');
assert.equal(typeof demandFactorSettings.demandFactorBaseValue, 'number');
assert.equal(typeof demandFactorSettings.demandFactorMin, 'number');
assert.equal(
typeof demandFactorSettings.demandFactorUpAdjustment,
'number',
);
assert.equal(
typeof demandFactorSettings.demandFactorDownAdjustment,
'number',
);
assert.equal(typeof demandFactorSettings.stepDownThreshold, 'number');
assert.equal(typeof demandFactorSettings.criteria, 'string');
});

it('should be able to get reserved names', async () => {
const reservedNames = await io.getArNSReservedNames();
assert.ok(reservedNames);
Expand Down Expand Up @@ -718,6 +741,34 @@ describe('e2e esm tests', async () => {
assert.equal(redelegationFee.redelegationFeeRate, 0);
assert.equal(redelegationFee.feeResetTimestamp, undefined);
});

it('should be able to get gateway registry settings', async () => {
const registrySettings = await io.getGatewayRegistrySettings();
assert.ok(registrySettings);
assert.ok(typeof registrySettings.delegates.minStake === 'number');
assert.ok(
typeof registrySettings.delegates.withdrawLengthMs === 'number',
);
assert.ok(typeof registrySettings.observers.maxPerEpoch === 'number');
assert.ok(typeof registrySettings.observers.maxTenureWeight === 'number');
assert.ok(
typeof registrySettings.observers.tenureWeightDays === 'number',
);
assert.ok(
typeof registrySettings.observers.tenureWeightPeriod === 'number',
);
assert.ok(
typeof registrySettings.operators.failedEpochCountMax === 'number',
);
assert.ok(
typeof registrySettings.operators.failedEpochSlashRate === 'number',
);
assert.ok(typeof registrySettings.operators.leaveLengthMs === 'number');
assert.ok(typeof registrySettings.operators.minStake === 'number');
assert.ok(
typeof registrySettings.operators.withdrawLengthMs === 'number',
);
});
});

describe('ANTRegistry', async () => {
Expand Down

0 comments on commit 3eb287c

Please sign in to comment.