Skip to content

Commit

Permalink
remember: 1. build, 2. publish
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed Nov 20, 2023
1 parent 83b655a commit d811708
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export declare class MicroGrantsStrategy {
private poolId;
private allo;
constructor({ chain, rpc, address, poolId }: ConstructorArgs);
setPoolId(poolId: number): void;
setPoolId(poolId: number): Promise<void>;
setContract(address: `0x${string}`): void;
private checkPoolId;
private checkStrategy;
Expand Down
24 changes: 17 additions & 7 deletions dist/strategies/MicroGrantsStrategy/MicroGrantsStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ class MicroGrantsStrategy {
this.poolId = poolId || -1;
}
setPoolId(poolId) {
this.poolId = poolId;
return __awaiter(this, void 0, void 0, function* () {
this.poolId = poolId;
const strategyAddress = yield this.allo.getStrategy(poolId);
this.setContract(strategyAddress);
});
}
setContract(address) {
this.contract = (0, viem_1.getContract)({
Expand Down Expand Up @@ -65,14 +69,17 @@ class MicroGrantsStrategy {
allocator(allocatorAddress) {
return __awaiter(this, void 0, void 0, function* () {
this.checkStrategy();
const allocator = yield this.contract.read.allocators(allocatorAddress);
const allocator = yield this.contract.read.allocators([allocatorAddress]);
return allocator;
});
}
allocated(allocatorAddress, recipientAddress) {
return __awaiter(this, void 0, void 0, function* () {
this.checkStrategy();
const allocated = yield this.contract.read.allocated(allocatorAddress, recipientAddress);
const allocated = yield this.contract.read.allocated([
allocatorAddress,
recipientAddress,
]);
return allocated;
});
}
Expand Down Expand Up @@ -137,14 +144,14 @@ class MicroGrantsStrategy {
getRecipient(recipientId) {
return __awaiter(this, void 0, void 0, function* () {
this.checkStrategy();
const recipient = yield this.contract.read.getRecipient(recipientId);
const recipient = yield this.contract.read.getRecipient([recipientId]);
return recipient;
});
}
getRecipientStatus(recipientId) {
return __awaiter(this, void 0, void 0, function* () {
this.checkStrategy();
const status = yield this.contract.read.getRecipientStatus(recipientId);
const status = yield this.contract.read.getRecipientStatus([recipientId]);
return status;
});
}
Expand All @@ -165,14 +172,17 @@ class MicroGrantsStrategy {
isValidAllocator(allocatorAddress) {
return __awaiter(this, void 0, void 0, function* () {
this.checkStrategy();
const valid = yield this.contract.read.isValidAllocator(allocatorAddress);
const valid = yield this.contract.read.isValidAllocator([allocatorAddress]);
return valid;
});
}
recipientAllocations(recipientId, status) {
return __awaiter(this, void 0, void 0, function* () {
this.checkStrategy();
const allocations = yield this.contract.read.recipientAllocations(recipientId, status);
const allocations = yield this.contract.read.recipientAllocations([
recipientId,
status,
]);
return allocations;
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@allo-team/allo-v2-sdk",
"version": "1.0.15",
"version": "1.0.16",
"description": "sdk for allo v2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit d811708

Please sign in to comment.