@dorafactory/maci-sdk 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dorafactory/maci-sdk",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "SDK for interacting with maci",
5
5
  "keywords": [
6
6
  "maci",
package/src/libs/const.ts CHANGED
@@ -188,7 +188,8 @@ export function getDefaultParams(
188
188
  registryAddress:
189
189
  'dora13c8aecstyxrhax9znvvh5zey89edrmd2k5va57pxvpe3fxtfsfeqlhsjnd',
190
190
  maciCodeId: 107,
191
- oracleCodeId: 113,
191
+ // oracleCodeId: 113, // 9-4-3-625
192
+ oracleCodeId: 115, // 6-3-3-125
192
193
  oracleWhitelistBackendPubkey:
193
194
  'AoYo/zENN/JquagPdG0/NMbWBBYxOM8BVN677mBXJKJQ',
194
195
  oracleFeegrantOperator: 'dora1xp0twdzsdeq4qg3c64v66552deax8zmvq4zw78',
@@ -1,5 +1,11 @@
1
1
  import { OfflineSigner } from '@cosmjs/proto-signing';
2
- import { batchGenMessage, Circom, PublicKey, stringizing } from '../circom';
2
+ import {
3
+ Account,
4
+ batchGenMessage,
5
+ Circom,
6
+ PublicKey,
7
+ stringizing,
8
+ } from '../circom';
3
9
  import { Contract } from '../contract';
4
10
  import { Indexer } from '../indexer';
5
11
  import { OracleCertificate } from '../oracle-certificate';
@@ -304,12 +310,14 @@ export class MACI {
304
310
  signer,
305
311
  address,
306
312
  contractAddress,
313
+ maciAccount,
307
314
  oracleCertificate,
308
315
  gasStation = false,
309
316
  }: {
310
317
  signer: OfflineSigner;
311
318
  address: string;
312
319
  contractAddress: string;
320
+ maciAccount?: Account;
313
321
  oracleCertificate?: {
314
322
  amount: string;
315
323
  signature: string;
@@ -317,7 +325,9 @@ export class MACI {
317
325
  gasStation?: boolean;
318
326
  }) {
319
327
  try {
320
- const maciAccount = await this.circom.genKeypairFromSign(signer, address);
328
+ if (maciAccount === undefined) {
329
+ maciAccount = await this.circom.genKeypairFromSign(signer, address);
330
+ }
321
331
 
322
332
  const client = await this.contract.contractClient({
323
333
  signer,
@@ -392,6 +402,7 @@ export class MACI {
392
402
  contractAddress,
393
403
  selectedOptions,
394
404
  operatorCoordPubKey,
405
+ maciAccount,
395
406
  gasStation = false,
396
407
  }: {
397
408
  signer: OfflineSigner;
@@ -403,6 +414,7 @@ export class MACI {
403
414
  vc: number;
404
415
  }[];
405
416
  operatorCoordPubKey: PublicKey;
417
+ maciAccount?: Account;
406
418
  gasStation?: boolean;
407
419
  }) {
408
420
  if (stateIdx === -1) {
@@ -422,7 +434,9 @@ export class MACI {
422
434
  voiceCreditBalance,
423
435
  });
424
436
 
425
- const maciAccount = await this.circom.genKeypairFromSign(signer, address);
437
+ if (maciAccount === undefined) {
438
+ maciAccount = await this.circom.genKeypairFromSign(signer, address);
439
+ }
426
440
 
427
441
  const plan = options.map((o) => {
428
442
  return [o.idx, o.vc] as [number, number];