Skip to content

Commit

Permalink
use indexer height args for voting power and total power queries inst…
Browse files Browse the repository at this point in the history
…ead of block
  • Loading branch information
NoahSaso committed Nov 20, 2024
1 parent 0146c74 commit cfbff89
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 27 deletions.
4 changes: 2 additions & 2 deletions packages/state/query/queries/contracts/Cw20Stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ export const cw20StakeQueries = {
formula: 'cw20Stake/stakedBalanceAtHeight',
args: {
address: args.address,
height: args.height,
...(oraichainStakingToken && { oraichainStakingToken }),
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -254,9 +254,9 @@ export const cw20StakeQueries = {
contractAddress,
formula: 'cw20Stake/totalStakedAtHeight',
args: {
height: args.height,
...(oraichainStakingToken && { oraichainStakingToken }),
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down
6 changes: 1 addition & 5 deletions packages/state/query/queries/contracts/Cw4Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,8 @@ export const cw4GroupQueries = {
formula: 'cw4Group/member',
args: {
address: args.addr,
height: args.atHeight,
},
...(args.atHeight && {
block: {
height: args.atHeight,
},
}),
})
),
}
Expand Down
6 changes: 4 additions & 2 deletions packages/state/query/queries/contracts/DaoDaoCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ export const daoDaoCoreQueries = {
formula: 'daoCore/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { height: args.height }),
})
)
} catch (error) {
Expand Down Expand Up @@ -864,7 +864,9 @@ export const daoDaoCoreQueries = {
chainId,
contractAddress,
formula: 'daoCore/totalPowerAtHeight',
...(args.height && { height: args.height }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
6 changes: 4 additions & 2 deletions packages/state/query/queries/contracts/DaoVotingCw20Staked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ export const daoVotingCw20StakedQueries = {
formula: 'daoVotingCw20Staked/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -268,7 +268,9 @@ export const daoVotingCw20StakedQueries = {
chainId,
contractAddress,
formula: 'daoVotingCw20Staked/totalPowerAtHeight',
...(args.height && { block: { height: args.height } }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
10 changes: 4 additions & 6 deletions packages/state/query/queries/contracts/DaoVotingCw4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ export const daoVotingCw4Queries = {
formula: 'daoVotingCw4/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && {
block: { height: args.height },
}),
})
)
} catch (error) {
Expand Down Expand Up @@ -188,9 +186,9 @@ export const daoVotingCw4Queries = {
chainId,
contractAddress,
formula: 'daoVotingCw4/totalPowerAtHeight',
...(args.height && {
block: { height: args.height },
}),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ export const daoVotingCw721StakedQueries = {
formula: 'daoVotingCw721Staked/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -419,7 +419,9 @@ export const daoVotingCw721StakedQueries = {
chainId,
contractAddress,
formula: 'daoVotingCw721Staked/totalPowerAtHeight',
...(args.height && { block: { height: args.height } }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ export const daoVotingNativeStakedQueries = {
formula: 'daoVotingNativeStaked/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -303,7 +303,9 @@ export const daoVotingNativeStakedQueries = {
chainId,
contractAddress,
formula: 'daoVotingNativeStaked/totalPowerAtHeight',
...(args.height && { block: { height: args.height } }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
6 changes: 4 additions & 2 deletions packages/state/query/queries/contracts/DaoVotingOnftStaked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ export const daoVotingOnftStakedQueries = {
formula: 'daoVotingOnftStaked/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -413,7 +413,9 @@ export const daoVotingOnftStakedQueries = {
chainId,
contractAddress,
formula: 'daoVotingOnftStaked/totalPowerAtHeight',
...(args.height && { block: { height: args.height } }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ export const daoVotingSgCommunityNftQueries = {
formula: 'daoVotingSgCommunityNft/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -403,7 +403,9 @@ export const daoVotingSgCommunityNftQueries = {
chainId,
contractAddress,
formula: 'daoVotingSgCommunityNft/totalPowerAtHeight',
...(args.height && { block: { height: args.height } }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ export const daoVotingTokenStakedQueries = {
formula: 'daoVotingTokenStaked/votingPowerAtHeight',
args: {
address: args.address,
height: args.height,
},
...(args.height && { block: { height: args.height } }),
})
)
} catch (error) {
Expand Down Expand Up @@ -509,7 +509,9 @@ export const daoVotingTokenStakedQueries = {
chainId,
contractAddress,
formula: 'daoVotingTokenStaked/totalPowerAtHeight',
...(args.height && { block: { height: args.height } }),
args: {
height: args.height,
},
})
)
} catch (error) {
Expand Down

0 comments on commit cfbff89

Please sign in to comment.