Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(cardano-services-client): use CIP129 when querying dreps/:drepId - LW-12316 #1591

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading