@show-karma/karma-gap-sdk 0.4.7 → 0.4.9
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.
|
@@ -10,6 +10,8 @@ const consts_1 = require("../../consts");
|
|
|
10
10
|
const ethers_2 = require("ethers");
|
|
11
11
|
const allo_v2_sdk_1 = require("@allo-team/allo-v2-sdk/");
|
|
12
12
|
const axios_1 = __importDefault(require("axios"));
|
|
13
|
+
// ABI fragment for the Initialized event
|
|
14
|
+
const INITIALIZED_EVENT = ["event Initialized(uint256 poolId, bytes data)"];
|
|
13
15
|
class AlloBase {
|
|
14
16
|
constructor(signer, pinataJWTToken, chainId) {
|
|
15
17
|
this.signer = signer;
|
|
@@ -80,8 +82,28 @@ class AlloBase {
|
|
|
80
82
|
callback?.("pending");
|
|
81
83
|
const receipt = await tx.wait();
|
|
82
84
|
callback?.("confirmed");
|
|
83
|
-
//
|
|
84
|
-
const
|
|
85
|
+
// Create interface to parse the logs
|
|
86
|
+
const iface = new ethers_1.ethers.Interface(INITIALIZED_EVENT);
|
|
87
|
+
let poolId;
|
|
88
|
+
// Find the Initialized event in the logs
|
|
89
|
+
const initializedLog = receipt.logs.find((log) => {
|
|
90
|
+
try {
|
|
91
|
+
const parsed = iface.parseLog(log);
|
|
92
|
+
return parsed.name === "Initialized";
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
if (initializedLog) {
|
|
99
|
+
const parsedLog = iface.parseLog(initializedLog);
|
|
100
|
+
poolId = parsedLog.args.poolId.toString();
|
|
101
|
+
console.log(`Transaction ${tx.hash} - Found poolId: ${poolId}`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
poolId = receipt.logs[receipt.logs.length - 1].topics[1]; // Fallback to Initialized order logic
|
|
105
|
+
console.log(`No Initialized event found in tx ${tx.hash}`);
|
|
106
|
+
}
|
|
85
107
|
return {
|
|
86
108
|
poolId: BigInt(poolId).toString(),
|
|
87
109
|
txHash: tx.hash,
|
|
@@ -5,7 +5,19 @@ export interface _IProjectUpdate extends ProjectUpdate {
|
|
|
5
5
|
export interface IProjectUpdate {
|
|
6
6
|
title: string;
|
|
7
7
|
text: string;
|
|
8
|
+
startDate?: Date;
|
|
9
|
+
endDate?: Date;
|
|
8
10
|
type?: string;
|
|
11
|
+
grants?: string[];
|
|
12
|
+
indicators?: {
|
|
13
|
+
name: string;
|
|
14
|
+
indicatorId: string;
|
|
15
|
+
}[];
|
|
16
|
+
deliverables?: {
|
|
17
|
+
name: string;
|
|
18
|
+
proof: string;
|
|
19
|
+
description: string;
|
|
20
|
+
}[];
|
|
9
21
|
}
|
|
10
22
|
type IStatus = "verified";
|
|
11
23
|
export interface IProjectUpdateStatus {
|
|
@@ -81,8 +81,20 @@ export interface IProjectUpdateStatus extends IAttestationResponse {
|
|
|
81
81
|
}
|
|
82
82
|
export interface IProjectUpdate extends IAttestationResponse {
|
|
83
83
|
data: {
|
|
84
|
-
text: string;
|
|
85
84
|
title: string;
|
|
85
|
+
text: string;
|
|
86
|
+
startDate?: Date;
|
|
87
|
+
endDate?: Date;
|
|
88
|
+
grants?: string[];
|
|
89
|
+
indicators?: {
|
|
90
|
+
name: string;
|
|
91
|
+
indicatorId: string;
|
|
92
|
+
}[];
|
|
93
|
+
deliverables?: {
|
|
94
|
+
name: string;
|
|
95
|
+
proof: string;
|
|
96
|
+
description: string;
|
|
97
|
+
}[];
|
|
86
98
|
type: "project-update";
|
|
87
99
|
};
|
|
88
100
|
verified?: IProjectUpdateStatus[];
|