@dorafactory/maci-sdk 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/browser.d.mts +7 -2
- package/dist/browser.d.ts +7 -2
- package/dist/browser.js +21 -4
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +21 -4
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/maci/maci.ts +32 -5
package/dist/browser.mjs
CHANGED
|
@@ -30228,7 +30228,7 @@ var MACI = class {
|
|
|
30228
30228
|
return round.data.round.voiceCreditAmount;
|
|
30229
30229
|
} else {
|
|
30230
30230
|
throw new Error(
|
|
30231
|
-
`Failed to query amaci voice credit: ${round.error.type}`
|
|
30231
|
+
`Failed to query amaci voice credit: ${round.error.type} ${round.error.message}`
|
|
30232
30232
|
);
|
|
30233
30233
|
}
|
|
30234
30234
|
} else {
|
|
@@ -30285,7 +30285,9 @@ var MACI = class {
|
|
|
30285
30285
|
async getRoundInfo({ contractAddress }) {
|
|
30286
30286
|
const roundInfo = await this.indexer.getRoundById(contractAddress);
|
|
30287
30287
|
if (isErrorResponse(roundInfo)) {
|
|
30288
|
-
throw new Error(
|
|
30288
|
+
throw new Error(
|
|
30289
|
+
`Failed to get round info: ${roundInfo.error.type} ${roundInfo.error.message}`
|
|
30290
|
+
);
|
|
30289
30291
|
}
|
|
30290
30292
|
return roundInfo.data.round;
|
|
30291
30293
|
}
|
|
@@ -30323,6 +30325,15 @@ var MACI = class {
|
|
|
30323
30325
|
}
|
|
30324
30326
|
return status;
|
|
30325
30327
|
}
|
|
30328
|
+
async queryRoundBalance({ contractAddress }) {
|
|
30329
|
+
const roundBalance = await this.indexer.balanceOf(contractAddress);
|
|
30330
|
+
if (isErrorResponse(roundBalance)) {
|
|
30331
|
+
throw new Error(
|
|
30332
|
+
`Failed to query round balance: ${roundBalance.error.type} ${roundBalance.error.message}`
|
|
30333
|
+
);
|
|
30334
|
+
}
|
|
30335
|
+
return roundBalance.data.balance;
|
|
30336
|
+
}
|
|
30326
30337
|
async requestOracleCertificate({
|
|
30327
30338
|
signer,
|
|
30328
30339
|
ecosystem,
|
|
@@ -30345,11 +30356,14 @@ var MACI = class {
|
|
|
30345
30356
|
signer,
|
|
30346
30357
|
address,
|
|
30347
30358
|
contractAddress,
|
|
30359
|
+
maciAccount,
|
|
30348
30360
|
oracleCertificate,
|
|
30349
30361
|
gasStation = false
|
|
30350
30362
|
}) {
|
|
30351
30363
|
try {
|
|
30352
|
-
|
|
30364
|
+
if (maciAccount === void 0) {
|
|
30365
|
+
maciAccount = await this.circom.genKeypairFromSign(signer, address);
|
|
30366
|
+
}
|
|
30353
30367
|
const client = await this.contract.contractClient({
|
|
30354
30368
|
signer
|
|
30355
30369
|
});
|
|
@@ -30404,6 +30418,7 @@ var MACI = class {
|
|
|
30404
30418
|
contractAddress,
|
|
30405
30419
|
selectedOptions,
|
|
30406
30420
|
operatorCoordPubKey,
|
|
30421
|
+
maciAccount,
|
|
30407
30422
|
gasStation = false
|
|
30408
30423
|
}) {
|
|
30409
30424
|
if (stateIdx === -1) {
|
|
@@ -30420,7 +30435,9 @@ var MACI = class {
|
|
|
30420
30435
|
contractAddress,
|
|
30421
30436
|
voiceCreditBalance
|
|
30422
30437
|
});
|
|
30423
|
-
|
|
30438
|
+
if (maciAccount === void 0) {
|
|
30439
|
+
maciAccount = await this.circom.genKeypairFromSign(signer, address);
|
|
30440
|
+
}
|
|
30424
30441
|
const plan = options.map((o) => {
|
|
30425
30442
|
return [o.idx, o.vc];
|
|
30426
30443
|
});
|