@bandada/utils
Advanced tools
Comparing version 0.4.0 to 0.5.0
/** | ||
* @module @bandada/utils | ||
* @version 0.4.0 | ||
* @version 0.5.0 | ||
* @file General Bandada utility functions. | ||
@@ -934,2 +934,23 @@ * @copyright Ethereum Foundation 2023 | ||
}; | ||
BandadaContract.prototype.getGroups = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var filter, events; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
filter = this.contract.filters.GroupUpdated(); | ||
return [4 /*yield*/, this.contract.queryFilter(filter)]; | ||
case 1: | ||
events = _a.sent(); | ||
return [2 /*return*/, events.map(function (_a) { | ||
var args = _a.args; | ||
return ({ | ||
id: args[0].toBigInt(), | ||
fingerprint: args[1].toBigInt() | ||
}); | ||
})]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return BandadaContract; | ||
@@ -936,0 +957,0 @@ }()); |
@@ -8,3 +8,4 @@ import { Signer } from "@ethersproject/abstract-signer"; | ||
updateGroups(groups: OnchainBandadaGroup[]): Promise<ContractReceipt>; | ||
getGroups(): Promise<OnchainBandadaGroup[]>; | ||
} | ||
export default function getBandadaContract(network: Network, privateKeyOrSigner?: string | Signer, apiKey?: string): BandadaContract; |
{ | ||
"name": "@bandada/utils", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "General Bandada utility functions.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -22,2 +22,12 @@ /* istanbul ignore file */ | ||
} | ||
async getGroups(): Promise<OnchainBandadaGroup[]> { | ||
const filter = this.contract.filters.GroupUpdated() | ||
const events = await this.contract.queryFilter(filter) | ||
return events.map(({ args }: any) => ({ | ||
id: args[0].toBigInt(), | ||
fingerprint: args[1].toBigInt() | ||
})) | ||
} | ||
} | ||
@@ -24,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
126040
3188