@dorafactory/maci-sdk 0.0.37 → 0.0.39

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,8 +1,4 @@
1
1
  import { OfflineSigner } from '@cosmjs/proto-signing';
2
- import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
3
- import { MaciClient } from './ts/Maci.client';
4
- import { AMaciClient } from './ts/AMaci.client';
5
- import { RegistryClient } from './ts/Registry.client';
6
2
  import { ContractParams } from '../../types';
7
3
  import { CreateAMaciRoundParams, CreateMaciRoundParams, CreateOracleMaciRoundParams } from './types';
8
4
  export declare const prefix = "dora";
@@ -42,16 +38,16 @@ export declare class Contract {
42
38
  registryClient({ signer, contractAddress, }: {
43
39
  signer: OfflineSigner;
44
40
  contractAddress: string;
45
- }): Promise<RegistryClient>;
41
+ }): Promise<import("./ts/Registry.client").RegistryClient>;
46
42
  maciClient({ signer, contractAddress, }: {
47
43
  signer: OfflineSigner;
48
44
  contractAddress: string;
49
- }): Promise<MaciClient>;
45
+ }): Promise<import("./ts/Maci.client").MaciClient>;
50
46
  amaciClient({ signer, contractAddress, }: {
51
47
  signer: OfflineSigner;
52
48
  contractAddress: string;
53
- }): Promise<AMaciClient>;
49
+ }): Promise<import("./ts/AMaci.client").AMaciClient>;
54
50
  contractClient({ signer }: {
55
51
  signer: OfflineSigner;
56
- }): Promise<SigningCosmWasmClient>;
52
+ }): Promise<import("@cosmjs/cosmwasm-stargate").SigningCosmWasmClient>;
57
53
  }
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.37",
3
+ "version": "0.0.39",
4
4
  "description": "SDK for interacting with maci",
5
5
  "keywords": [
6
6
  "maci",
@@ -30,30 +30,16 @@
30
30
  "dependencies": {
31
31
  "@cosmjs/amino": "^0.32.1",
32
32
  "@cosmjs/cosmwasm-stargate": "^0.32.1",
33
- "@cosmjs/crypto": "^0.32.1",
34
33
  "@cosmjs/launchpad": "^0.27.1",
35
34
  "@cosmjs/proto-signing": "^0.32.1",
36
35
  "@cosmjs/stargate": "^0.32.1",
37
36
  "@zk-kit/baby-jubjub": "^1.0.3",
38
37
  "@zk-kit/eddsa-poseidon": "^1.1.0",
39
38
  "@zk-kit/poseidon-cipher": "^0.3.2",
40
- "@zk-kit/utils": "^1.4.1",
41
39
  "assert": "^2.1.0",
42
40
  "bech32": "1.1.4",
43
- "blake-hash": "^2.0.0",
44
- "colorts": "^0.1.63",
45
41
  "cosmjs-types": "^0.9.0",
46
- "ethers": "^6.13.4",
47
- "gql.tada": "^1.7.0",
48
- "graphql": "^16.8.1",
49
- "husky": "^8.0.3",
50
- "keccak256": "^1.0.6",
51
- "micro-ftch": "^0.4.2",
52
- "superstruct": "^1.0.3",
53
- "tmp": "^0.2.1",
54
- "ts-retry-promise": "^0.7.1",
55
- "tweetnacl": "^1.0.3",
56
- "valibot": "0.36.0"
42
+ "ethers": "^6.13.4"
57
43
  },
58
44
  "devDependencies": {
59
45
  "@commitlint/cli": "^18.0.0",
package/src/index.ts CHANGED
@@ -1,14 +1,28 @@
1
- export * from './libs';
2
- export type * from './types';
3
- export * from './types';
4
- export * from './libs/const';
1
+ // Core
5
2
  export { MaciClient } from './maci';
6
3
  export { Http } from './libs/http';
7
- export { Round } from './libs/query';
8
- export { UserAccount } from './libs/query';
9
- export { Circuit } from './libs/query';
10
- export { Operator } from './libs/query';
11
- export { Proof } from './libs/query';
12
- export { Transaction } from './libs/query';
4
+
5
+ // Query Types
6
+ export {
7
+ Round,
8
+ UserAccount,
9
+ Circuit,
10
+ Operator,
11
+ Proof,
12
+ Transaction,
13
+ } from './libs/query';
14
+
15
+ // Crypto
13
16
  export * from './libs/crypto';
14
- export * from './utils';
17
+
18
+ // Types
19
+ export * from './types';
20
+ export type * from './types';
21
+
22
+ // Constants
23
+ export { circuits, getDefaultParams, type NetworkConfig } from './libs/const';
24
+
25
+ // Utils
26
+ export { stringizing, bigInt2Buffer } from './libs/crypto/bigintUtils';
27
+ export { isValidAddress } from './utils';
28
+ export { getAMaciRoundCircuitFee } from './libs/contract/utils';
@@ -5,10 +5,7 @@ import {
5
5
  SigningStargateClient,
6
6
  SigningStargateClientOptions,
7
7
  } from '@cosmjs/stargate';
8
- import {
9
- SigningCosmWasmClient,
10
- SigningCosmWasmClientOptions,
11
- } from '@cosmjs/cosmwasm-stargate';
8
+ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
12
9
  import { MaciClient } from './ts/Maci.client';
13
10
  import { AMaciClient } from './ts/AMaci.client';
14
11
  import { RegistryClient } from './ts/Registry.client';
@@ -1,17 +1,4 @@
1
- import { Secp256k1HdWallet } from '@cosmjs/launchpad';
2
- import { DirectSecp256k1HdWallet, OfflineSigner } from '@cosmjs/proto-signing';
3
- import {
4
- GasPrice,
5
- SigningStargateClient,
6
- SigningStargateClientOptions,
7
- } from '@cosmjs/stargate';
8
- import {
9
- SigningCosmWasmClient,
10
- SigningCosmWasmClientOptions,
11
- } from '@cosmjs/cosmwasm-stargate';
12
- import { MaciClient } from './ts/Maci.client';
13
- import { AMaciClient } from './ts/AMaci.client';
14
- import { RegistryClient } from './ts/Registry.client';
1
+ import { OfflineSigner } from '@cosmjs/proto-signing';
15
2
  import { ContractParams } from '../../types';
16
3
  import {
17
4
  createAMaciClientBy,
@@ -20,18 +7,12 @@ import {
20
7
  createOracleMaciClientBy,
21
8
  createRegistryClientBy,
22
9
  } from './config';
23
- import { Whitelist } from './ts/Registry.types';
24
- import { getDefaultParams } from '../const';
25
10
  import {
26
11
  CreateAMaciRoundParams,
27
12
  CreateMaciRoundParams,
28
13
  CreateOracleMaciRoundParams,
29
14
  } from './types';
30
- import {
31
- getAMaciRoundCircuitFee,
32
- getCircuitType,
33
- getContractParams,
34
- } from './utils';
15
+ import { getAMaciRoundCircuitFee, getContractParams } from './utils';
35
16
  import { QTR_LIB } from './vars';
36
17
  import { MaciRoundType, MaciCertSystemType } from '../../types';
37
18
  import { unpackPubKey } from '../crypto';
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;