Skip to content

Commit

Permalink
Merge pull request #1591 from input-output-hk/refactor/lw-12316-use-c…
Browse files Browse the repository at this point in the history
…ip129-to-query-drep

refactor(cardano-services-client): use CIP129 when querying dreps/:drepId - LW-12316
  • Loading branch information
mirceahasegan authored Feb 14, 2025
2 parents 0ef2c4f + fbc2511 commit f89fba9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compose/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ x-sdk-environment: &sdk-environment
services:
blockfrost-ryo:
build:
context: 'https://github.com/mkazlauskas/blockfrost-backend-ryo.git#feat/custom-network-support'
context: 'https://github.com/blockfrost/blockfrost-backend-ryo.git#v3.1.0'
dockerfile: Dockerfile
environment:
BLOCKFROST_CONFIG_SERVER_LISTEN_ADDRESS: 0.0.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export class BlockfrostDRepProvider extends BlockfrostProvider implements DRepPr

async getDRepInfo({ id }: GetDRepInfoArgs): Promise<DRepInfo> {
try {
const cip105DRepId = Cardano.DRepID.toCip105DRepID(id); // Blockfrost only supports CIP-105 DRep IDs
const response = await this.request<Responses['drep']>(`governance/dreps/${cip105DRepId.toString()}`);
const cip129DRepId = Cardano.DRepID.toCip129DRepID(id).toString();
const response = await this.request<Responses['drep']>(`governance/dreps/${cip129DRepId}`);
const amount = BigInt(response.amount);
const activeEpoch = response.active_epoch ? Cardano.EpochNo(response.active_epoch) : undefined;
const active = response.active;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ describe('BlockfrostDRepProvider', () => {

describe('getDRep', () => {
const mockedDRepId = Cardano.DRepID('drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc');
const mockedCip129DrepID = Cardano.DRepID.toCip129DRepID(mockedDRepId).toString();
const mockedAssetResponse = {
active: true,
active_epoch: 420,
amount: '2000000',
drep_id: 'drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc',
drep_id: mockedCip129DrepID,
has_script: true,
hex: 'a61261172624e8333ceff098648d90f8e404e2e36d5b5f5985cbd35d'
} as Responses['drep'];

test('getDRepInfo', async () => {
mockResponses(request, [
[
`governance/dreps/${mockedDRepId}`,
`governance/dreps/${mockedCip129DrepID}`,
{
...mockedAssetResponse
}
Expand Down

0 comments on commit f89fba9

Please sign in to comment.