@dorafactory/maci-sdk 0.1.2 → 0.1.3-pre.10
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/dist/index.d.ts +1 -1
- package/dist/index.js +2371 -975
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2369 -975
- package/dist/index.mjs.map +1 -1
- package/dist/libs/const.d.ts +1 -2
- package/dist/libs/contract/config.d.ts +12 -0
- package/dist/libs/contract/contract.d.ts +66 -4
- package/dist/libs/contract/ts/AMaci.client.d.ts +25 -3
- package/dist/libs/contract/ts/AMaci.types.d.ts +26 -1
- package/dist/libs/contract/ts/ApiMaci.client.d.ts +170 -0
- package/dist/libs/contract/ts/ApiMaci.types.d.ts +187 -0
- package/dist/libs/contract/ts/ApiSaas.client.d.ts +148 -0
- package/dist/libs/contract/ts/ApiSaas.types.d.ts +126 -0
- package/dist/libs/contract/ts/Registry.client.d.ts +17 -7
- package/dist/libs/contract/ts/Registry.types.d.ts +16 -5
- package/dist/libs/contract/types.d.ts +15 -3
- package/dist/libs/crypto/bigintUtils.d.ts +2 -0
- package/dist/libs/maci/maci.d.ts +34 -4
- package/dist/maci.d.ts +47 -3
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/libs/const.ts +5 -6
- package/src/libs/contract/config.ts +36 -0
- package/src/libs/contract/contract.ts +611 -6
- package/src/libs/contract/ts/AMaci.client.ts +66 -0
- package/src/libs/contract/ts/AMaci.types.ts +30 -1
- package/src/libs/contract/ts/ApiMaci.client.ts +459 -0
- package/src/libs/contract/ts/ApiMaci.types.ts +188 -0
- package/src/libs/contract/ts/ApiSaas.client.ts +581 -0
- package/src/libs/contract/ts/ApiSaas.types.ts +144 -0
- package/src/libs/contract/ts/Registry.client.ts +57 -9
- package/src/libs/contract/ts/Registry.types.ts +18 -5
- package/src/libs/contract/types.ts +16 -3
- package/src/libs/crypto/bigintUtils.ts +28 -0
- package/src/libs/maci/maci.ts +190 -9
- package/src/maci.ts +86 -4
- package/src/types/index.ts +2 -2
package/src/maci.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Http, Indexer, Contract, OracleCertificate, MACI } from './libs';
|
|
|
3
3
|
import { getDefaultParams } from './libs/const';
|
|
4
4
|
import {
|
|
5
5
|
CreateAMaciRoundParams,
|
|
6
|
+
CreateApiSaasAmaciRoundParams,
|
|
6
7
|
CreateMaciRoundParams,
|
|
7
8
|
CreateOracleMaciRoundParams,
|
|
8
9
|
CreateSaasOracleMaciRoundParams,
|
|
@@ -35,9 +36,9 @@ export class MaciClient {
|
|
|
35
36
|
|
|
36
37
|
public registryAddress: string;
|
|
37
38
|
public saasAddress: string;
|
|
39
|
+
public apiSaasAddress: string;
|
|
38
40
|
public maciCodeId: number;
|
|
39
41
|
public oracleCodeId: number;
|
|
40
|
-
public saasOracleCodeId: number;
|
|
41
42
|
public feegrantOperator: string;
|
|
42
43
|
public whitelistBackendPubkey: string;
|
|
43
44
|
|
|
@@ -62,9 +63,9 @@ export class MaciClient {
|
|
|
62
63
|
apiEndpoint,
|
|
63
64
|
registryAddress,
|
|
64
65
|
saasAddress,
|
|
66
|
+
apiSaasAddress,
|
|
65
67
|
maciCodeId,
|
|
66
68
|
oracleCodeId,
|
|
67
|
-
saasOracleCodeId,
|
|
68
69
|
customFetch,
|
|
69
70
|
defaultOptions,
|
|
70
71
|
feegrantOperator,
|
|
@@ -83,9 +84,9 @@ export class MaciClient {
|
|
|
83
84
|
certificateApiEndpoint || defaultParams.certificateApiEndpoint;
|
|
84
85
|
this.registryAddress = registryAddress || defaultParams.registryAddress;
|
|
85
86
|
this.saasAddress = saasAddress || defaultParams.saasAddress;
|
|
87
|
+
this.apiSaasAddress = apiSaasAddress || defaultParams.apiSaasAddress;
|
|
86
88
|
this.maciCodeId = maciCodeId || defaultParams.maciCodeId;
|
|
87
89
|
this.oracleCodeId = oracleCodeId || defaultParams.oracleCodeId;
|
|
88
|
-
this.saasOracleCodeId = saasOracleCodeId || defaultParams.saasCodeId;
|
|
89
90
|
this.feegrantOperator =
|
|
90
91
|
feegrantOperator || defaultParams.oracleFeegrantOperator;
|
|
91
92
|
this.whitelistBackendPubkey =
|
|
@@ -109,9 +110,9 @@ export class MaciClient {
|
|
|
109
110
|
rpcEndpoint: this.rpcEndpoint,
|
|
110
111
|
registryAddress: this.registryAddress,
|
|
111
112
|
saasAddress: this.saasAddress,
|
|
113
|
+
apiSaasAddress: this.apiSaasAddress,
|
|
112
114
|
maciCodeId: this.maciCodeId,
|
|
113
115
|
oracleCodeId: this.oracleCodeId,
|
|
114
|
-
saasOracleCodeId: this.saasOracleCodeId,
|
|
115
116
|
feegrantOperator: this.feegrantOperator,
|
|
116
117
|
whitelistBackendPubkey: this.whitelistBackendPubkey,
|
|
117
118
|
});
|
|
@@ -232,6 +233,19 @@ export class MaciClient {
|
|
|
232
233
|
...params,
|
|
233
234
|
});
|
|
234
235
|
}
|
|
236
|
+
async createApiSaasMaciRound(params: CreateSaasOracleMaciRoundParams) {
|
|
237
|
+
return await this.contract.createApiSaasMaciRound({
|
|
238
|
+
signer: this.getSigner(params.signer),
|
|
239
|
+
...params,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async createApiSaasAmaciRound(params: CreateApiSaasAmaciRoundParams) {
|
|
244
|
+
return await this.contract.createApiSaasAmaciRound({
|
|
245
|
+
signer: this.getSigner(params.signer),
|
|
246
|
+
...params,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
235
249
|
|
|
236
250
|
async genKeypairFromSign({
|
|
237
251
|
signer,
|
|
@@ -681,4 +695,72 @@ export class MaciClient {
|
|
|
681
695
|
fee,
|
|
682
696
|
});
|
|
683
697
|
}
|
|
698
|
+
|
|
699
|
+
async rawSignup({
|
|
700
|
+
signer,
|
|
701
|
+
address,
|
|
702
|
+
contractAddress,
|
|
703
|
+
pubKey,
|
|
704
|
+
oracleCertificate,
|
|
705
|
+
gasStation = false,
|
|
706
|
+
granter,
|
|
707
|
+
fee,
|
|
708
|
+
}: {
|
|
709
|
+
signer?: OfflineSigner;
|
|
710
|
+
address?: string;
|
|
711
|
+
contractAddress: string;
|
|
712
|
+
pubKey: PubKey;
|
|
713
|
+
oracleCertificate?: {
|
|
714
|
+
amount: string;
|
|
715
|
+
signature: string;
|
|
716
|
+
};
|
|
717
|
+
gasStation?: boolean;
|
|
718
|
+
granter?: string;
|
|
719
|
+
fee?: StdFee;
|
|
720
|
+
}) {
|
|
721
|
+
return await this.maci.rawSignup({
|
|
722
|
+
signer: this.getSigner(signer),
|
|
723
|
+
address,
|
|
724
|
+
contractAddress,
|
|
725
|
+
pubKey,
|
|
726
|
+
oracleCertificate,
|
|
727
|
+
gasStation,
|
|
728
|
+
granter,
|
|
729
|
+
fee,
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
async rawVote({
|
|
734
|
+
signer,
|
|
735
|
+
address,
|
|
736
|
+
contractAddress,
|
|
737
|
+
pubKey,
|
|
738
|
+
payload,
|
|
739
|
+
gasStation = false,
|
|
740
|
+
granter,
|
|
741
|
+
fee,
|
|
742
|
+
}: {
|
|
743
|
+
signer?: OfflineSigner;
|
|
744
|
+
address?: string;
|
|
745
|
+
contractAddress: string;
|
|
746
|
+
pubKey: PubKey;
|
|
747
|
+
payload: {
|
|
748
|
+
msg: bigint[];
|
|
749
|
+
encPubkeys: PubKey;
|
|
750
|
+
}[];
|
|
751
|
+
gasStation?: boolean;
|
|
752
|
+
granter?: string;
|
|
753
|
+
fee?: StdFee | 'auto' | number;
|
|
754
|
+
}) {
|
|
755
|
+
return await this.maci.rawVote({
|
|
756
|
+
signer: this.getSigner(signer),
|
|
757
|
+
address,
|
|
758
|
+
contractAddress,
|
|
759
|
+
pubKey,
|
|
760
|
+
payload,
|
|
761
|
+
gasStation,
|
|
762
|
+
granter,
|
|
763
|
+
fee,
|
|
764
|
+
});
|
|
765
|
+
}
|
|
684
766
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -31,9 +31,9 @@ export type ClientParams = {
|
|
|
31
31
|
certificateApiEndpoint?: string;
|
|
32
32
|
registryAddress?: string;
|
|
33
33
|
saasAddress?: string;
|
|
34
|
+
apiSaasAddress?: string;
|
|
34
35
|
maciCodeId?: number;
|
|
35
36
|
oracleCodeId?: number;
|
|
36
|
-
saasOracleCodeId?: number;
|
|
37
37
|
customFetch?: typeof fetch;
|
|
38
38
|
defaultOptions?: FetchOptions;
|
|
39
39
|
feegrantOperator?: string;
|
|
@@ -48,9 +48,9 @@ export type ContractParams = {
|
|
|
48
48
|
rpcEndpoint: string;
|
|
49
49
|
registryAddress: string;
|
|
50
50
|
saasAddress: string;
|
|
51
|
+
apiSaasAddress: string;
|
|
51
52
|
maciCodeId: number;
|
|
52
53
|
oracleCodeId: number;
|
|
53
|
-
saasOracleCodeId: number;
|
|
54
54
|
whitelistBackendPubkey: string;
|
|
55
55
|
feegrantOperator: string;
|
|
56
56
|
};
|