Skip to content

Commit

Permalink
Merge pull request #114 from aurora-is-near/fix-near-multisig-version…
Browse files Browse the repository at this point in the history
…-source

fix: near multisig version source
  • Loading branch information
diegofigs committed Dec 2, 2024
2 parents ac6ce70 + fff3d90 commit 7e0ed92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-owls-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aurora-is-near/backstage-plugin-blockchainradar-backend': patch
---

fix: source dao version from chain instead of API
11 changes: 7 additions & 4 deletions plugins/blockchainradar-backend/src/adapters/AstroDaoAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import {
MultisigSpec,
} from '@aurora-is-near/backstage-plugin-blockchainradar-common';
import { PolicyAdapter } from './PolicyAdapter';
import { AstroDaoClient } from '../lib/AstroDaoClient';
// import { AstroDaoClient } from '../lib/AstroDaoClient';

export class AstroDaoAdapter extends PolicyAdapter {
public async fetchMultisigSpec(
address: string,
_address: string,
stateSpec: ContractStateSpec | undefined,
): Promise<MultisigSpec | undefined> {
if (stateSpec && stateSpec.methods.get_policy) {
Expand All @@ -21,7 +21,6 @@ export class AstroDaoAdapter extends PolicyAdapter {
? councilRole.kind.Group.length
: 0;
if (this.isValidCouncilRole(councilRole) && owners) {
const client = new AstroDaoClient(this.logger);
return {
policy: {
owners,
Expand All @@ -30,7 +29,7 @@ export class AstroDaoAdapter extends PolicyAdapter {
councilRole.vote_policy.config || nearPolicy.default_vote_policy,
),
},
version: await client.safeVersion(address),
version: unescape(stateSpec.methods.version),
fetchDate: new Date().getTime(),
};
}
Expand Down Expand Up @@ -108,3 +107,7 @@ type AstroDaoVotePolicy = {
quorum: string;
threshold: number[];
};

function unescape(value: string) {
return value.replace(/^\\?"|\\?"$/g, '');
}

0 comments on commit 7e0ed92

Please sign in to comment.