@dorafactory/maci-sdk 0.0.30 → 0.0.31
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 +17 -0
- package/dist/browser.d.ts +17 -0
- package/dist/browser.js +99 -0
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +99 -0
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/maci/maci.ts +112 -0
package/package.json
CHANGED
package/src/libs/maci/maci.ts
CHANGED
|
@@ -770,4 +770,116 @@ export class MACI {
|
|
|
770
770
|
const ecosystems = await this.oracleCertificate.listEcosystems();
|
|
771
771
|
return ecosystems;
|
|
772
772
|
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Batch grant with bond (for maci)
|
|
776
|
+
* @param client
|
|
777
|
+
* @param contractAddress
|
|
778
|
+
* @param address
|
|
779
|
+
* @param amount
|
|
780
|
+
* @returns
|
|
781
|
+
*/
|
|
782
|
+
async batchGrantWithBond(
|
|
783
|
+
client: SigningCosmWasmClient,
|
|
784
|
+
contractAddress: string,
|
|
785
|
+
address: string,
|
|
786
|
+
amount: string
|
|
787
|
+
) {
|
|
788
|
+
const msgs: MsgExecuteContractEncodeObject[] = [
|
|
789
|
+
{
|
|
790
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
|
791
|
+
value: MsgExecuteContract.fromPartial({
|
|
792
|
+
sender: address,
|
|
793
|
+
contract: contractAddress,
|
|
794
|
+
msg: new TextEncoder().encode(
|
|
795
|
+
JSON.stringify(
|
|
796
|
+
stringizing({
|
|
797
|
+
grant: {
|
|
798
|
+
max_amount: BigInt('100000000000000000000000'),
|
|
799
|
+
},
|
|
800
|
+
})
|
|
801
|
+
)
|
|
802
|
+
),
|
|
803
|
+
}),
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
|
807
|
+
value: MsgExecuteContract.fromPartial({
|
|
808
|
+
sender: address,
|
|
809
|
+
contract: contractAddress,
|
|
810
|
+
msg: new TextEncoder().encode(
|
|
811
|
+
JSON.stringify(
|
|
812
|
+
stringizing({
|
|
813
|
+
bond: {},
|
|
814
|
+
})
|
|
815
|
+
)
|
|
816
|
+
),
|
|
817
|
+
funds: [
|
|
818
|
+
{
|
|
819
|
+
denom: 'peaka',
|
|
820
|
+
amount,
|
|
821
|
+
},
|
|
822
|
+
],
|
|
823
|
+
}),
|
|
824
|
+
},
|
|
825
|
+
];
|
|
826
|
+
|
|
827
|
+
try {
|
|
828
|
+
const result = await client.signAndBroadcast(address, msgs, 'auto');
|
|
829
|
+
return result;
|
|
830
|
+
} catch (err) {
|
|
831
|
+
throw err;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Batch revoke with withdraw (for maci)
|
|
837
|
+
* @param client
|
|
838
|
+
* @param contractAddress
|
|
839
|
+
* @param address
|
|
840
|
+
* @returns
|
|
841
|
+
*/
|
|
842
|
+
async batchRevokeWithdraw(
|
|
843
|
+
client: SigningCosmWasmClient,
|
|
844
|
+
contractAddress: string,
|
|
845
|
+
address: string
|
|
846
|
+
) {
|
|
847
|
+
const msgs: MsgExecuteContractEncodeObject[] = [
|
|
848
|
+
{
|
|
849
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
|
850
|
+
value: MsgExecuteContract.fromPartial({
|
|
851
|
+
sender: address,
|
|
852
|
+
contract: contractAddress,
|
|
853
|
+
msg: new TextEncoder().encode(
|
|
854
|
+
JSON.stringify(
|
|
855
|
+
stringizing({
|
|
856
|
+
withdraw: {},
|
|
857
|
+
})
|
|
858
|
+
)
|
|
859
|
+
),
|
|
860
|
+
}),
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
|
864
|
+
value: MsgExecuteContract.fromPartial({
|
|
865
|
+
sender: address,
|
|
866
|
+
contract: contractAddress,
|
|
867
|
+
msg: new TextEncoder().encode(
|
|
868
|
+
JSON.stringify(
|
|
869
|
+
stringizing({
|
|
870
|
+
revoke: {},
|
|
871
|
+
})
|
|
872
|
+
)
|
|
873
|
+
),
|
|
874
|
+
}),
|
|
875
|
+
},
|
|
876
|
+
];
|
|
877
|
+
|
|
878
|
+
try {
|
|
879
|
+
const result = await client.signAndBroadcast(address, msgs, 'auto');
|
|
880
|
+
return result;
|
|
881
|
+
} catch (err) {
|
|
882
|
+
throw err;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
773
885
|
}
|