@ar.io/sdk 3.6.1 → 3.7.0-alpha.1
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.
- package/README.md +34 -6
- package/bundles/web.bundle.min.js +53 -53
- package/lib/cjs/cli/cli.js +46 -14
- package/lib/cjs/cli/commands/antCommands.js +3 -3
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +4 -4
- package/lib/cjs/cli/commands/gatewayWriteCommands.js +9 -9
- package/lib/cjs/cli/commands/transfer.js +6 -6
- package/lib/cjs/cli/utils.js +3 -3
- package/lib/cjs/common/io.js +21 -1
- package/lib/cjs/types/io.js +11 -1
- package/lib/cjs/utils/arweave.js +84 -1
- package/lib/cjs/utils/utils.test.js +98 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +47 -15
- package/lib/esm/cli/commands/antCommands.js +4 -4
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +5 -5
- package/lib/esm/cli/commands/gatewayWriteCommands.js +10 -10
- package/lib/esm/cli/commands/transfer.js +7 -7
- package/lib/esm/cli/utils.js +1 -1
- package/lib/esm/common/io.js +22 -2
- package/lib/esm/types/io.js +8 -0
- package/lib/esm/utils/arweave.js +81 -0
- package/lib/esm/utils/utils.test.js +99 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/readCommands.d.ts +1 -1
- package/lib/types/cli/utils.d.ts +1 -1
- package/lib/types/common/io.d.ts +2 -1
- package/lib/types/types/io.d.ts +37 -23
- package/lib/types/utils/arweave.d.ts +3 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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[] | {
|
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -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
|
|
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;
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -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';
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -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;
|
|
@@ -110,13 +94,30 @@ export type AoEpochSettings = {
|
|
|
110
94
|
epochZeroStartTimestamp: Timestamp;
|
|
111
95
|
durationMs: number;
|
|
112
96
|
prescribedNameCount: number;
|
|
113
|
-
rewardPercentage: number;
|
|
114
97
|
maxObservers: number;
|
|
115
|
-
distributionDelayMs: number;
|
|
116
|
-
epochZeroTimestamp: Timestamp;
|
|
117
|
-
pruneEpochsCount: number;
|
|
118
98
|
};
|
|
119
|
-
export type
|
|
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> = {
|
|
120
121
|
epochIndex: AoEpochIndex;
|
|
121
122
|
startHeight: BlockHeight;
|
|
122
123
|
observations: AoEpochObservationData;
|
|
@@ -125,8 +126,7 @@ export type AoEpochData = {
|
|
|
125
126
|
startTimestamp: Timestamp;
|
|
126
127
|
endTimestamp: Timestamp;
|
|
127
128
|
distributionTimestamp: Timestamp;
|
|
128
|
-
|
|
129
|
-
distributions: AoEpochDistributionData;
|
|
129
|
+
distributions: D;
|
|
130
130
|
arnsStats: {
|
|
131
131
|
totalReturnedNames: number;
|
|
132
132
|
totalActiveNames: number;
|
|
@@ -134,6 +134,19 @@ export type AoEpochData = {
|
|
|
134
134
|
totalReservedNames: number;
|
|
135
135
|
};
|
|
136
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
|
+
};
|
|
137
150
|
export type AoTokenSupplyData = {
|
|
138
151
|
total: number;
|
|
139
152
|
circulating: number;
|
|
@@ -449,6 +462,7 @@ export interface AoARIORead {
|
|
|
449
462
|
getPrescribedNames(epoch?: EpochInput): Promise<string[] | undefined>;
|
|
450
463
|
getObservations(epoch?: EpochInput): Promise<AoEpochObservationData | undefined>;
|
|
451
464
|
getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData | undefined>;
|
|
465
|
+
getEligibleEpochRewards(epoch?: EpochInput, params?: PaginationParams<AoEligibleDistribution>): Promise<PaginationResult<AoEligibleDistribution> | undefined>;
|
|
452
466
|
getTokenCost({ intent, type, years, name, quantity, }: AoTokenCostParams): Promise<number>;
|
|
453
467
|
getCostDetails({ intent, type, years, name, quantity, fundFrom, }: AoGetCostDetailsParams): Promise<CostDetailsResult>;
|
|
454
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;
|
package/lib/types/version.d.ts
CHANGED