@dorafactory/maci-sdk 0.0.24 → 0.0.26
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/browser.d.mts +37 -2
- package/dist/browser.d.ts +37 -2
- package/dist/browser.js +21 -1
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +21 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/contract/contract.ts +4 -1
- package/src/libs/maci/maci.ts +5 -0
- package/src/libs/oracle-certificate/oracle-certificate.ts +16 -0
- package/src/libs/oracle-certificate/types.ts +18 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
|
|
2
2
|
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
|
|
3
3
|
import { StdFee, Coin } from '@cosmjs/amino';
|
|
4
|
+
import * as _cosmjs_stargate from '@cosmjs/stargate';
|
|
5
|
+
import * as _cosmjs_stargate_build_logs from '@cosmjs/stargate/build/logs';
|
|
4
6
|
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
5
7
|
export { Scalar, utils } from 'ffjavascript';
|
|
6
8
|
export { default as createBlakeHash } from 'blake-hash';
|
|
@@ -1590,7 +1592,15 @@ declare class Contract {
|
|
|
1590
1592
|
feegrantOperator: string;
|
|
1591
1593
|
whitelistBackendPubkey: string;
|
|
1592
1594
|
constructor({ rpcEndpoint, registryAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
|
|
1593
|
-
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<
|
|
1595
|
+
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<{
|
|
1596
|
+
contractAddress: string;
|
|
1597
|
+
logs: readonly _cosmjs_stargate_build_logs.Log[];
|
|
1598
|
+
height: number;
|
|
1599
|
+
transactionHash: string;
|
|
1600
|
+
events: readonly _cosmjs_stargate.Event[];
|
|
1601
|
+
gasWanted: bigint;
|
|
1602
|
+
gasUsed: bigint;
|
|
1603
|
+
}>;
|
|
1594
1604
|
createMaciRound({ signer, operatorPubkey, startVoting, endVoting, whitelist, title, description, link, maxVoter, maxOption, circuitType, certSystemType, }: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
1595
1605
|
createOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, voteOptionMap, circuitType, whitelistEcosystem, whitelistSnapshotHeight, whitelistVotingPowerArgs, }: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
1596
1606
|
queryRoundInfo({ signer, roundAddress, }: {
|
|
@@ -1641,6 +1651,21 @@ type FeegrantAllowanceResponse = {
|
|
|
1641
1651
|
amount: string;
|
|
1642
1652
|
}[];
|
|
1643
1653
|
};
|
|
1654
|
+
interface SnapshotHeightInfo {
|
|
1655
|
+
lowestHeight: string;
|
|
1656
|
+
latestHeight: string;
|
|
1657
|
+
}
|
|
1658
|
+
interface Ecosystem {
|
|
1659
|
+
name: string;
|
|
1660
|
+
displayName: string;
|
|
1661
|
+
decimals: number;
|
|
1662
|
+
apiPath: string;
|
|
1663
|
+
snapshotHeightInfo: SnapshotHeightInfo;
|
|
1664
|
+
baseSlope: number;
|
|
1665
|
+
}
|
|
1666
|
+
interface EcosystemsResponse {
|
|
1667
|
+
ecosystems: Ecosystem[];
|
|
1668
|
+
}
|
|
1644
1669
|
|
|
1645
1670
|
declare class OracleCertificate {
|
|
1646
1671
|
private certificateApiEndpoint;
|
|
@@ -1648,6 +1673,7 @@ declare class OracleCertificate {
|
|
|
1648
1673
|
constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
|
|
1649
1674
|
sign(data: SignatureRequest): Promise<SignatureResponse>;
|
|
1650
1675
|
feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
|
|
1676
|
+
listEcosystems(): Promise<EcosystemsResponse>;
|
|
1651
1677
|
}
|
|
1652
1678
|
|
|
1653
1679
|
type MixedData<T> = T | Array<MixedData<T>> | {
|
|
@@ -1842,6 +1868,7 @@ declare class MACI {
|
|
|
1842
1868
|
signer: OfflineSigner;
|
|
1843
1869
|
contractAddress: string;
|
|
1844
1870
|
}): Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
|
|
1871
|
+
getOracleCertificateConfig(): Promise<EcosystemsResponse>;
|
|
1845
1872
|
}
|
|
1846
1873
|
|
|
1847
1874
|
declare const circuits: Record<string, CircuitType>;
|
|
@@ -2002,7 +2029,15 @@ declare class MaciClient {
|
|
|
2002
2029
|
signer: OfflineSigner;
|
|
2003
2030
|
contractAddress: string;
|
|
2004
2031
|
}): Promise<AMaciClient>;
|
|
2005
|
-
createAMaciRound(params: CreateAMaciRoundParams): Promise<
|
|
2032
|
+
createAMaciRound(params: CreateAMaciRoundParams): Promise<{
|
|
2033
|
+
contractAddress: string;
|
|
2034
|
+
logs: readonly _cosmjs_stargate_build_logs.Log[];
|
|
2035
|
+
height: number;
|
|
2036
|
+
transactionHash: string;
|
|
2037
|
+
events: readonly _cosmjs_stargate.Event[];
|
|
2038
|
+
gasWanted: bigint;
|
|
2039
|
+
gasUsed: bigint;
|
|
2040
|
+
}>;
|
|
2006
2041
|
createMaciRound(params: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
2007
2042
|
createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
2008
2043
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
|
|
2
2
|
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
|
|
3
3
|
import { StdFee, Coin } from '@cosmjs/amino';
|
|
4
|
+
import * as _cosmjs_stargate from '@cosmjs/stargate';
|
|
5
|
+
import * as _cosmjs_stargate_build_logs from '@cosmjs/stargate/build/logs';
|
|
4
6
|
import { OfflineSigner } from '@cosmjs/proto-signing';
|
|
5
7
|
export { Scalar, utils } from 'ffjavascript';
|
|
6
8
|
export { default as createBlakeHash } from 'blake-hash';
|
|
@@ -1590,7 +1592,15 @@ declare class Contract {
|
|
|
1590
1592
|
feegrantOperator: string;
|
|
1591
1593
|
whitelistBackendPubkey: string;
|
|
1592
1594
|
constructor({ rpcEndpoint, registryAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
|
|
1593
|
-
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<
|
|
1595
|
+
createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<{
|
|
1596
|
+
contractAddress: string;
|
|
1597
|
+
logs: readonly _cosmjs_stargate_build_logs.Log[];
|
|
1598
|
+
height: number;
|
|
1599
|
+
transactionHash: string;
|
|
1600
|
+
events: readonly _cosmjs_stargate.Event[];
|
|
1601
|
+
gasWanted: bigint;
|
|
1602
|
+
gasUsed: bigint;
|
|
1603
|
+
}>;
|
|
1594
1604
|
createMaciRound({ signer, operatorPubkey, startVoting, endVoting, whitelist, title, description, link, maxVoter, maxOption, circuitType, certSystemType, }: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
1595
1605
|
createOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, voteOptionMap, circuitType, whitelistEcosystem, whitelistSnapshotHeight, whitelistVotingPowerArgs, }: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
1596
1606
|
queryRoundInfo({ signer, roundAddress, }: {
|
|
@@ -1641,6 +1651,21 @@ type FeegrantAllowanceResponse = {
|
|
|
1641
1651
|
amount: string;
|
|
1642
1652
|
}[];
|
|
1643
1653
|
};
|
|
1654
|
+
interface SnapshotHeightInfo {
|
|
1655
|
+
lowestHeight: string;
|
|
1656
|
+
latestHeight: string;
|
|
1657
|
+
}
|
|
1658
|
+
interface Ecosystem {
|
|
1659
|
+
name: string;
|
|
1660
|
+
displayName: string;
|
|
1661
|
+
decimals: number;
|
|
1662
|
+
apiPath: string;
|
|
1663
|
+
snapshotHeightInfo: SnapshotHeightInfo;
|
|
1664
|
+
baseSlope: number;
|
|
1665
|
+
}
|
|
1666
|
+
interface EcosystemsResponse {
|
|
1667
|
+
ecosystems: Ecosystem[];
|
|
1668
|
+
}
|
|
1644
1669
|
|
|
1645
1670
|
declare class OracleCertificate {
|
|
1646
1671
|
private certificateApiEndpoint;
|
|
@@ -1648,6 +1673,7 @@ declare class OracleCertificate {
|
|
|
1648
1673
|
constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
|
|
1649
1674
|
sign(data: SignatureRequest): Promise<SignatureResponse>;
|
|
1650
1675
|
feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
|
|
1676
|
+
listEcosystems(): Promise<EcosystemsResponse>;
|
|
1651
1677
|
}
|
|
1652
1678
|
|
|
1653
1679
|
type MixedData<T> = T | Array<MixedData<T>> | {
|
|
@@ -1842,6 +1868,7 @@ declare class MACI {
|
|
|
1842
1868
|
signer: OfflineSigner;
|
|
1843
1869
|
contractAddress: string;
|
|
1844
1870
|
}): Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
|
|
1871
|
+
getOracleCertificateConfig(): Promise<EcosystemsResponse>;
|
|
1845
1872
|
}
|
|
1846
1873
|
|
|
1847
1874
|
declare const circuits: Record<string, CircuitType>;
|
|
@@ -2002,7 +2029,15 @@ declare class MaciClient {
|
|
|
2002
2029
|
signer: OfflineSigner;
|
|
2003
2030
|
contractAddress: string;
|
|
2004
2031
|
}): Promise<AMaciClient>;
|
|
2005
|
-
createAMaciRound(params: CreateAMaciRoundParams): Promise<
|
|
2032
|
+
createAMaciRound(params: CreateAMaciRoundParams): Promise<{
|
|
2033
|
+
contractAddress: string;
|
|
2034
|
+
logs: readonly _cosmjs_stargate_build_logs.Log[];
|
|
2035
|
+
height: number;
|
|
2036
|
+
transactionHash: string;
|
|
2037
|
+
events: readonly _cosmjs_stargate.Event[];
|
|
2038
|
+
gasWanted: bigint;
|
|
2039
|
+
gasUsed: bigint;
|
|
2040
|
+
}>;
|
|
2006
2041
|
createMaciRound(params: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
2007
2042
|
createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
2008
2043
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4223,7 +4223,10 @@ var Contract = class {
|
|
|
4223
4223
|
}
|
|
4224
4224
|
}
|
|
4225
4225
|
});
|
|
4226
|
-
return
|
|
4226
|
+
return {
|
|
4227
|
+
...res,
|
|
4228
|
+
contractAddress
|
|
4229
|
+
};
|
|
4227
4230
|
}
|
|
4228
4231
|
async createMaciRound({
|
|
4229
4232
|
signer,
|
|
@@ -4433,6 +4436,19 @@ var OracleCertificate = class {
|
|
|
4433
4436
|
spend_limit: response.allowance.allowance.allowance.spend_limit
|
|
4434
4437
|
};
|
|
4435
4438
|
}
|
|
4439
|
+
async listEcosystems() {
|
|
4440
|
+
const response = await this.http.fetch(
|
|
4441
|
+
`${this.certificateApiEndpoint}/list`,
|
|
4442
|
+
{
|
|
4443
|
+
method: "GET",
|
|
4444
|
+
headers: {
|
|
4445
|
+
"Content-Type": "application/json"
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
);
|
|
4449
|
+
const signatureData = await response.json();
|
|
4450
|
+
return signatureData;
|
|
4451
|
+
}
|
|
4436
4452
|
};
|
|
4437
4453
|
|
|
4438
4454
|
// src/libs/circom/index.ts
|
|
@@ -5224,6 +5240,10 @@ var MACI = class {
|
|
|
5224
5240
|
});
|
|
5225
5241
|
return client.claim();
|
|
5226
5242
|
}
|
|
5243
|
+
async getOracleCertificateConfig() {
|
|
5244
|
+
const ecosystems = await this.oracleCertificate.listEcosystems();
|
|
5245
|
+
return ecosystems;
|
|
5246
|
+
}
|
|
5227
5247
|
};
|
|
5228
5248
|
|
|
5229
5249
|
// src/maci.ts
|