@ar.io/sdk 3.6.2-alpha.1 → 3.7.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.
@@ -51,7 +51,7 @@ export declare function getArNSReturnedName(o: NameCLIOptions): Promise<import("
51
51
  export declare function listArNSReturnedNames(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoReturnedName> | {
52
52
  message: string;
53
53
  }>;
54
- export declare function getEpoch(o: EpochCLIOptions): Promise<import("../../types/io.js").AoEpochData | {
54
+ export declare function getEpoch(o: EpochCLIOptions): Promise<import("../../types/io.js").AoEpochData<import("../../types/io.js").AoEpochDistributionData> | {
55
55
  message: string;
56
56
  }>;
57
57
  export declare function getPrescribedObservers(o: EpochCLIOptions): Promise<import("../../types/io.js").AoWeightedObserver[] | {
@@ -39,7 +39,7 @@ export declare function requiredAddressFromOptions<O extends AddressCLIOptions>(
39
39
  export declare function paginationParamsFromOptions<O extends PaginationCLIOptions, R>(options: O): PaginationParams<R>;
40
40
  export declare function epochInputFromOptions(options: EpochCLIOptions): EpochInput;
41
41
  export declare function requiredInitiatorFromOptions(options: InitiatorCLIOptions): string;
42
- export declare function writeActionTagsFromOptions<O extends WriteActionCLIOptions>(options: O): WriteOptions;
42
+ export declare function customTagsFromOptions<O extends WriteActionCLIOptions>(options: O): WriteOptions;
43
43
  export declare function gatewaySettingsFromOptions({ allowDelegatedStaking, autoStake, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, observerAddress, port, properties, allowedDelegates, }: UpdateGatewaySettingsCLIOptions): AoUpdateGatewaySettingsParams;
44
44
  export declare function requiredTargetAndQuantityFromOptions(options: TransferCLIOptions): {
45
45
  target: string;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import Arweave from 'arweave';
17
17
  import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoReturnedName, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, OptionalArweave, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
18
- import { AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, AoArNSNameData, AoArNSPurchaseParams, AoArNSReservedNameDataWithName, AoBuyRecordParams, AoCreateVaultParams, AoDelegation, AoEpochData, AoEpochSettings, AoExtendLeaseParams, AoExtendVaultParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoIncreaseVaultParams, AoPaginatedAddressParams, AoRegistrationFees, AoRevokeVaultParams, AoVaultData, AoVaultedTransferParams, AoWalletVault, CostDetailsResult, DemandFactorSettings, EpochInput } from '../types/io.js';
18
+ import { AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, AoArNSNameData, AoArNSPurchaseParams, AoArNSReservedNameDataWithName, AoBuyRecordParams, AoCreateVaultParams, AoDelegation, AoEligibleDistribution, AoEpochData, AoEpochSettings, AoExtendLeaseParams, AoExtendVaultParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoIncreaseVaultParams, AoPaginatedAddressParams, AoRegistrationFees, AoRevokeVaultParams, AoVaultData, AoVaultedTransferParams, AoWalletVault, CostDetailsResult, DemandFactorSettings, EpochInput } from '../types/io.js';
19
19
  import { mARIOToken } from '../types/token.js';
20
20
  import { AOProcess } from './contracts/ao-process.js';
21
21
  type ARIOConfigNoSigner = OptionalArweave<ProcessConfiguration>;
@@ -76,6 +76,7 @@ export declare class ARIOReadable implements AoARIORead {
76
76
  getPrescribedNames(epoch?: EpochInput): Promise<string[] | undefined>;
77
77
  getObservations(epoch?: EpochInput): Promise<AoEpochObservationData | undefined>;
78
78
  getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData | undefined>;
79
+ getEligibleEpochRewards(epoch?: EpochInput, params?: PaginationParams<AoEligibleDistribution>): Promise<PaginationResult<AoEligibleDistribution>>;
79
80
  getTokenCost(params: {
80
81
  intent: 'Buy-Record' | 'Buy-Name';
81
82
  type: 'permabuy' | 'lease';
@@ -65,22 +65,6 @@ export type AoVaultData = {
65
65
  startTimestamp: Timestamp;
66
66
  endTimestamp: Timestamp;
67
67
  };
68
- export type AoEpochDistributionRewards = {
69
- eligible: Record<WalletAddress, {
70
- delegateRewards: Record<WalletAddress, number>;
71
- operatorReward: number;
72
- }>;
73
- distributed?: Record<WalletAddress, number>;
74
- };
75
- export type AoEpochDistributionData = {
76
- rewards: AoEpochDistributionRewards;
77
- totalEligibleGateways: number;
78
- totalEligibleRewards: number;
79
- totalEligibleObserverReward: number;
80
- totalEligibleGatewayReward: number;
81
- distributedTimestamp?: Timestamp;
82
- totalDistributedRewards?: number;
83
- };
84
68
  export type AoArNSReservedNameData = {
85
69
  target?: string;
86
70
  endTimestamp?: number;
@@ -112,7 +96,28 @@ export type AoEpochSettings = {
112
96
  prescribedNameCount: number;
113
97
  maxObservers: number;
114
98
  };
115
- export type AoEpochData = {
99
+ export type AoEpochDistributionTotalsData = {
100
+ totalEligibleGateways: number;
101
+ totalEligibleRewards: number;
102
+ totalEligibleObserverReward: number;
103
+ totalEligibleGatewayReward: number;
104
+ };
105
+ /** @deprecated Use getEligibleEpochRewards getEpochDistributions, will be removed in a future release */
106
+ export type AoEpochDistributionRewards = {
107
+ eligible: Record<WalletAddress, {
108
+ delegateRewards: Record<WalletAddress, number>;
109
+ operatorReward: number;
110
+ }>;
111
+ distributed: Record<WalletAddress, number>;
112
+ };
113
+ export type AoEpochDistributed = AoEpochDistributionTotalsData & {
114
+ /** @deprecated Use getEligibleEpochRewards getEpochDistributions, will be removed in a future release */
115
+ rewards: AoEpochDistributionRewards;
116
+ distributedTimestamp: Timestamp;
117
+ totalDistributedRewards: number;
118
+ };
119
+ export type AoEpochDistributionData = AoEpochDistributionTotalsData | AoEpochDistributed;
120
+ export type AoEpochData<D = AoEpochDistributionData> = {
116
121
  epochIndex: AoEpochIndex;
117
122
  startHeight: BlockHeight;
118
123
  observations: AoEpochObservationData;
@@ -121,8 +126,7 @@ export type AoEpochData = {
121
126
  startTimestamp: Timestamp;
122
127
  endTimestamp: Timestamp;
123
128
  distributionTimestamp: Timestamp;
124
- /** @deprecated - use `getDistributions` to get distribution data for a given epoch **/
125
- distributions: AoEpochDistributionData;
129
+ distributions: D;
126
130
  arnsStats: {
127
131
  totalReturnedNames: number;
128
132
  totalActiveNames: number;
@@ -130,6 +134,19 @@ export type AoEpochData = {
130
134
  totalReservedNames: number;
131
135
  };
132
136
  };
137
+ export declare const isDistributedEpochData: (data: AoEpochDistributed | AoEpochDistributionTotalsData) => data is AoEpochDistributed;
138
+ export declare const isDistributedEpoch: (data: AoEpochData | undefined) => data is AoEpochData<AoEpochDistributed> & {
139
+ distributions: {
140
+ rewards: object;
141
+ };
142
+ };
143
+ export type AoEligibleDistribution = {
144
+ type: 'operatorReward' | 'delegateReward';
145
+ recipient: WalletAddress;
146
+ eligibleReward: number;
147
+ gatewayAddress: WalletAddress;
148
+ cursorId: string;
149
+ };
133
150
  export type AoTokenSupplyData = {
134
151
  total: number;
135
152
  circulating: number;
@@ -445,6 +462,7 @@ export interface AoARIORead {
445
462
  getPrescribedNames(epoch?: EpochInput): Promise<string[] | undefined>;
446
463
  getObservations(epoch?: EpochInput): Promise<AoEpochObservationData | undefined>;
447
464
  getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData | undefined>;
465
+ getEligibleEpochRewards(epoch?: EpochInput, params?: PaginationParams<AoEligibleDistribution>): Promise<PaginationResult<AoEligibleDistribution> | undefined>;
448
466
  getTokenCost({ intent, type, years, name, quantity, }: AoTokenCostParams): Promise<number>;
449
467
  getCostDetails({ intent, type, years, name, quantity, fundFrom, }: AoGetCostDetailsParams): Promise<CostDetailsResult>;
450
468
  getRegistrationFees(): Promise<AoRegistrationFees>;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import Arweave from 'arweave';
17
17
  import { BlockHeight } from '../types/common.js';
18
- import { AoEpochData, PaginationParams } from '../types/io.js';
18
+ import { AoEligibleDistribution, AoEpochData, PaginationParams, PaginationResult } from '../types/io.js';
19
19
  export declare const validateArweaveId: (id: string) => boolean;
20
20
  export declare function isBlockHeight(height: string | number): height is BlockHeight;
21
21
  /**
@@ -58,3 +58,5 @@ export declare const epochDistributionNoticeGqlQuery: ({ epochIndex, processId,
58
58
  processId?: string | undefined;
59
59
  authorities?: string[] | undefined;
60
60
  }) => string;
61
+ export declare function sortAndPaginateEpochDataIntoEligibleDistributions(epochData?: AoEpochData, params?: PaginationParams<AoEligibleDistribution>): PaginationResult<AoEligibleDistribution>;
62
+ export declare function removeEligibleRewardsFromEpochData(epochData?: AoEpochData): AoEpochData | undefined;
@@ -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 = "3.6.1";
16
+ export declare const version = "3.7.0-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.6.2-alpha.1",
3
+ "version": "3.7.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"