Skip to content

Commit

Permalink
fix(io): include address in delegate type for gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Nov 11, 2024
1 parent ac91bc9 commit 46ef1a7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
10 changes: 3 additions & 7 deletions src/common/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
AoEpochData,
AoEpochSettings,
AoGateway,
AoGatewayDelegate,
AoGatewayDelegateWithAddress,
AoIORead,
AoIOWrite,
AoRegistrationFees,
Expand Down Expand Up @@ -272,11 +272,7 @@ export class IOReadable implements AoIORead {
async getGatewayDelegates({
address,
...pageParams
}: {
address: WalletAddress;
} & PaginationParams<AoGatewayDelegate>): Promise<
PaginationResult<AoGatewayDelegate>
> {
}): Promise<PaginationResult<AoGatewayDelegateWithAddress>> {
const allTags = [
{ name: 'Action', value: 'Paginated-Delegates' },
{ name: 'Address', value: address },
Expand All @@ -286,7 +282,7 @@ export class IOReadable implements AoIORead {
{ name: 'Sort-Order', value: pageParams?.sortOrder },
];

return this.process.read<PaginationResult<AoGatewayDelegate>>({
return this.process.read<PaginationResult<AoGatewayDelegateWithAddress>>({
tags: pruneTags(allTags),
});
}
Expand Down
21 changes: 13 additions & 8 deletions src/types/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ export type AoGatewayDelegate = {
vaults: Record<WalletAddress, AoVaultData>;
};

export type AoGatewayDelegateWithAddress = AoGatewayDelegate & {
address: WalletAddress;
};

export type AoGatewaySettings = {
allowDelegatedStaking: boolean | 'allowlist';
delegateRewardShareRatio: number;
Expand Down Expand Up @@ -316,15 +320,16 @@ export interface AoIORead {
address: WalletAddress;
}): Promise<AoGateway | undefined>;
// TODO: these could be moved to a separate Gateways class that implements gateway specific interactions
getGatewayDelegates(
params: {
address: WalletAddress;
} & PaginationParams<AoGatewayDelegate>,
): Promise<PaginationResult<AoGatewayDelegate>>;
getGatewayDelegates({
address,
...pageParams
}: {
address: WalletAddress;
} & PaginationParams<AoGatewayDelegateWithAddress>): Promise<
PaginationResult<AoGatewayDelegateWithAddress>
>;
getGatewayDelegateAllowList(
params?: PaginationParams<WalletAddress> & {
address: WalletAddress;
},
params?: PaginationParams<WalletAddress>,
): Promise<PaginationResult<WalletAddress>>;
// END OF GATEWAY SPECIFIC INTERACTIONS
getGateways(
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/esm/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ describe('e2e esm tests', async () => {
assert(Array.isArray(delegate.vaults));
assert(typeof delegate.delegatedStake === 'number');
assert(typeof delegate.startTimestamp === 'number');
assert(typeof delegate.address === 'string');
});
});

Expand Down

0 comments on commit 46ef1a7

Please sign in to comment.