@show-karma/karma-gap-sdk 0.3.34 → 0.3.35
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.
|
@@ -9,9 +9,9 @@ export declare class AlloBase {
|
|
|
9
9
|
name: string;
|
|
10
10
|
}): Promise<any>;
|
|
11
11
|
encodeStrategyInitData(applicationStart: number, applicationEnd: number, roundStart: number, roundEnd: number, payoutToken: string): Promise<string>;
|
|
12
|
-
createGrant(args: any): Promise<{
|
|
12
|
+
createGrant(args: any, callback?: Function): Promise<{
|
|
13
13
|
poolId: string;
|
|
14
14
|
txHash: string;
|
|
15
15
|
}>;
|
|
16
|
-
updatePoolMetadata(poolId: string, poolMetadata: any): Promise<any>;
|
|
16
|
+
updatePoolMetadata(poolId: string, poolMetadata: any, callback?: Function): Promise<any>;
|
|
17
17
|
}
|
|
@@ -47,7 +47,7 @@ class AlloBase {
|
|
|
47
47
|
]);
|
|
48
48
|
return initStrategyData;
|
|
49
49
|
}
|
|
50
|
-
async createGrant(args) {
|
|
50
|
+
async createGrant(args, callback) {
|
|
51
51
|
console.log("Creating grant...");
|
|
52
52
|
const walletBalance = await this.signer.provider.getBalance(await this.signer.getAddress());
|
|
53
53
|
console.log("Wallet balance:", (0, ethers_1.formatEther)(walletBalance.toString()), " ETH");
|
|
@@ -70,13 +70,16 @@ class AlloBase {
|
|
|
70
70
|
metadata: metadata,
|
|
71
71
|
managers: args.managers,
|
|
72
72
|
};
|
|
73
|
+
callback?.("preparing");
|
|
73
74
|
const txData = this.allo.createPool(createPoolArgs);
|
|
74
75
|
const tx = await this.signer.sendTransaction({
|
|
75
76
|
data: txData.data,
|
|
76
77
|
to: txData.to,
|
|
77
78
|
value: BigInt(txData.value),
|
|
78
79
|
});
|
|
80
|
+
callback?.("pending");
|
|
79
81
|
const receipt = await tx.wait();
|
|
82
|
+
callback?.("confirmed");
|
|
80
83
|
// Get ProfileCreated event
|
|
81
84
|
const poolId = receipt.logs[receipt.logs.length - 1].topics[0];
|
|
82
85
|
return {
|
|
@@ -88,15 +91,18 @@ class AlloBase {
|
|
|
88
91
|
console.error(`Failed to create pool: ${error}`);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
async updatePoolMetadata(poolId, poolMetadata) {
|
|
94
|
+
async updatePoolMetadata(poolId, poolMetadata, callback) {
|
|
92
95
|
try {
|
|
96
|
+
callback?.("preparing");
|
|
93
97
|
const metadata_cid = await this.saveAndGetCID(poolMetadata);
|
|
94
98
|
const metadata = {
|
|
95
99
|
protocol: 1,
|
|
96
100
|
pointer: metadata_cid,
|
|
97
101
|
};
|
|
98
102
|
const tx = await this.contract.updatePoolMetadata(poolId, metadata);
|
|
103
|
+
callback?.("pending");
|
|
99
104
|
const receipt = await tx.wait();
|
|
105
|
+
callback?.("confirmed");
|
|
100
106
|
return receipt;
|
|
101
107
|
}
|
|
102
108
|
catch (error) {
|