@dorafactory/maci-sdk 0.0.36 → 0.0.38

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.
@@ -1 +1,2 @@
1
1
  export { Contract } from './contract';
2
+ export * from './utils';
@@ -1,8 +1,4 @@
1
1
  import { MaciCertSystemType, MaciCircuitType, MaciRoundType } from '../../types';
2
- type MixedData<T> = T | Array<MixedData<T>> | {
3
- [key: string]: MixedData<T>;
4
- };
5
- export declare const stringizing: (o: MixedData<bigint>, path?: MixedData<bigint>[]) => MixedData<string>;
6
2
  export declare function getCircuitType(circuitType: MaciCircuitType): string;
7
3
  export declare function getContractParams(type: MaciRoundType, circuitType: MaciCircuitType, proofSystem: MaciCertSystemType, maxVoter: number, maxOption: number): {
8
4
  parameters: {
@@ -60,4 +56,3 @@ export declare function getAMaciRoundCircuitFee(maxVoter: number, maxOption: num
60
56
  denom: string;
61
57
  amount: string;
62
58
  };
63
- export {};
package/dist/maci.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare class MaciClient {
26
26
  oracleCertificate: OracleCertificate;
27
27
  maci: MACI;
28
28
  maciKeypair: Keypair;
29
- signer: OfflineSigner;
29
+ signer?: OfflineSigner;
30
30
  /**
31
31
  * @constructor
32
32
  * @param {ClientParams} params - The parameters for the Maci Client instance.
@@ -18,7 +18,7 @@ export declare enum MaciRoundType {
18
18
  }
19
19
  export type CertificateEcosystem = 'cosmoshub' | 'doravota';
20
20
  export type ClientParams = {
21
- signer: OfflineSigner;
21
+ signer?: OfflineSigner;
22
22
  network: 'mainnet' | 'testnet';
23
23
  rpcEndpoint?: string;
24
24
  restEndpoint?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dorafactory/maci-sdk",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "SDK for interacting with maci",
5
5
  "keywords": [
6
6
  "maci",
@@ -1 +1,2 @@
1
1
  export { Contract } from './contract';
2
+ export * from './utils';
@@ -5,30 +5,6 @@ import {
5
5
  } from '../../types';
6
6
  import { CIRCUIT_INFO } from './vars';
7
7
 
8
- type MixedData<T> = T | Array<MixedData<T>> | { [key: string]: MixedData<T> };
9
-
10
- export const stringizing = (
11
- o: MixedData<bigint>,
12
- path: MixedData<bigint>[] = []
13
- ): MixedData<string> => {
14
- if (path.includes(o)) {
15
- throw new Error('loop nesting!');
16
- }
17
- const newPath = [...path, o];
18
-
19
- if (Array.isArray(o)) {
20
- return o.map((item) => stringizing(item, newPath));
21
- } else if (typeof o === 'object') {
22
- const output: { [key: string]: MixedData<string> } = {};
23
- for (const key in o) {
24
- output[key] = stringizing(o[key], newPath);
25
- }
26
- return output;
27
- } else {
28
- return o.toString();
29
- }
30
- };
31
-
32
8
  export function getCircuitType(circuitType: MaciCircuitType) {
33
9
  let maciVoteType = null;
34
10
  switch (circuitType) {
package/src/maci.ts CHANGED
@@ -42,7 +42,7 @@ export class MaciClient {
42
42
  public maci: MACI;
43
43
  public maciKeypair: Keypair;
44
44
 
45
- public signer: OfflineSigner;
45
+ public signer?: OfflineSigner;
46
46
 
47
47
  /**
48
48
  * @constructor
@@ -115,7 +115,13 @@ export class MaciClient {
115
115
  }
116
116
 
117
117
  getSigner(signer?: OfflineSigner) {
118
- return signer || this.signer;
118
+ if (signer) {
119
+ return signer;
120
+ }
121
+ if (this.signer) {
122
+ return this.signer;
123
+ }
124
+ throw new Error('No signer provided, please provide a signer');
119
125
  }
120
126
 
121
127
  getMaciKeypair() {
@@ -23,7 +23,7 @@ export enum MaciRoundType {
23
23
  export type CertificateEcosystem = 'cosmoshub' | 'doravota';
24
24
 
25
25
  export type ClientParams = {
26
- signer: OfflineSigner;
26
+ signer?: OfflineSigner;
27
27
  network: 'mainnet' | 'testnet';
28
28
  rpcEndpoint?: string;
29
29
  restEndpoint?: string;