@verified-network/verified-sdk 1.9.7 → 1.9.8
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/contract/index.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare class VerifiedContract {
|
|
|
50
50
|
/** Constructs and call function with ethers.js */
|
|
51
51
|
callFunctionWithEthers(functionName: string, ...args: any): Promise<SCResponse>;
|
|
52
52
|
/** Constructs and call function as userop for biconomy gassless(sponsored/erc20 mode) */
|
|
53
|
-
callFunctionAsUserOp(smartAccount: any, tx: any, functionName: string, paymentToken: string, ...args: any): Promise<SCResponse
|
|
54
|
-
callContract(functionName: string, ...args: any): Promise<SCResponse
|
|
53
|
+
callFunctionAsUserOp(smartAccount: any, tx: any, functionName: string, paymentToken: string, ...args: any): Promise<SCResponse>;
|
|
54
|
+
callContract(functionName: string, ...args: any): Promise<SCResponse>;
|
|
55
55
|
protected getEvent(eventName: string, callback: any): void;
|
|
56
56
|
}
|
|
57
57
|
export {};
|
package/dist/contract/index.js
CHANGED
|
@@ -319,35 +319,65 @@ class VerifiedContract {
|
|
|
319
319
|
const txHash = (_c = messageArray === null || messageArray === void 0 ? void 0 : messageArray.find((msg) => msg === null || msg === void 0 ? void 0 : msg.startsWith("0x"))) === null || _c === void 0 ? void 0 : _c.replace(".", "");
|
|
320
320
|
//wait up to max round to fetch receipt ???
|
|
321
321
|
if (txHash) {
|
|
322
|
+
// for (
|
|
323
|
+
// let i = 0;
|
|
324
|
+
// i < Number(PaymasterConstants.MAX_WAITING_ROUND);
|
|
325
|
+
// i++
|
|
326
|
+
// ) {
|
|
327
|
+
// await new Promise((resolve) => {
|
|
328
|
+
// setTimeout(resolve, 6000); //1 minute delay per round
|
|
329
|
+
// });
|
|
330
|
+
// console.log(
|
|
331
|
+
// "Gassless timeout exceeded, fetching receipt for round: ",
|
|
332
|
+
// i + 1,
|
|
333
|
+
// "out of ",
|
|
334
|
+
// Number(PaymasterConstants.MAX_WAITING_ROUND)
|
|
335
|
+
// );
|
|
336
|
+
// return await this.fetchUserOpReceipt(txHash).then(async (_res) => {
|
|
337
|
+
// if (_res && !_res?.failed) {
|
|
338
|
+
// //if receipt received stop and configure return
|
|
339
|
+
// res.status = STATUS.SUCCESS;
|
|
340
|
+
// res.response = {
|
|
341
|
+
// hash: _res?.transactionHash || txHash,
|
|
342
|
+
// result: _res,
|
|
343
|
+
// }; //TODO: update result on response
|
|
344
|
+
// res.message = "";
|
|
345
|
+
// return res;
|
|
346
|
+
// } else if (_res && _res?.failed) {
|
|
347
|
+
// //if receipt failed stop and use ethers
|
|
348
|
+
// console.log("will use ethers....");
|
|
349
|
+
// return await this.callFunctionWithEthers(functionName, ...args);
|
|
350
|
+
// }
|
|
351
|
+
// });
|
|
352
|
+
// }
|
|
322
353
|
for (let i = 0; i < Number(constants_1.PaymasterConstants.MAX_WAITING_ROUND); i++) {
|
|
323
|
-
await new Promise((resolve) =>
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
});
|
|
354
|
+
await new Promise((resolve) => setTimeout(resolve, 6000)); // 6 second delay
|
|
355
|
+
console.log("Gassless timeout exceeded, fetching receipt for round:", i + 1, "out of", Number(constants_1.PaymasterConstants.MAX_WAITING_ROUND));
|
|
356
|
+
const _res = await this.fetchUserOpReceipt(txHash);
|
|
357
|
+
if (_res && !(_res === null || _res === void 0 ? void 0 : _res.failed) && (_res === null || _res === void 0 ? void 0 : _res.status) === "0x1") {
|
|
358
|
+
res.status = STATUS.SUCCESS;
|
|
359
|
+
res.response = {
|
|
360
|
+
hash: (_res === null || _res === void 0 ? void 0 : _res.transactionHash) || txHash,
|
|
361
|
+
result: _res,
|
|
362
|
+
};
|
|
363
|
+
res.message = "";
|
|
364
|
+
break; // Exit the loop
|
|
365
|
+
}
|
|
366
|
+
else if (_res && !(_res === null || _res === void 0 ? void 0 : _res.failed) && (_res === null || _res === void 0 ? void 0 : _res.status) !== "0x1") {
|
|
367
|
+
res.status = STATUS.ERROR;
|
|
368
|
+
res.response = {
|
|
369
|
+
hash: (_res === null || _res === void 0 ? void 0 : _res.transactionHash) || txHash,
|
|
370
|
+
result: _res,
|
|
371
|
+
};
|
|
372
|
+
res.message = (_res === null || _res === void 0 ? void 0 : _res.reason) || (_res === null || _res === void 0 ? void 0 : _res.message) || "";
|
|
373
|
+
break; // Exit the loop
|
|
374
|
+
}
|
|
375
|
+
else if (_res && (_res === null || _res === void 0 ? void 0 : _res.failed)) {
|
|
376
|
+
console.log("will use ethers....");
|
|
377
|
+
return await this.callFunctionWithEthers(functionName, ...args);
|
|
378
|
+
}
|
|
350
379
|
}
|
|
380
|
+
return res;
|
|
351
381
|
}
|
|
352
382
|
else {
|
|
353
383
|
console.error("gasless transaction failed with error: ", "No TX-hash from error message.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VerifiedContract } from
|
|
1
|
+
import { VerifiedContract } from "../index";
|
|
2
2
|
import { VerifiedWallet } from "../../../wallet";
|
|
3
3
|
export default class Security extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
@@ -107,4 +107,8 @@ export default class Security extends VerifiedContract {
|
|
|
107
107
|
gasPrice: number;
|
|
108
108
|
gasLimit: number;
|
|
109
109
|
}): any;
|
|
110
|
+
vote(_time: string, _ballot: string, options?: {
|
|
111
|
+
gasPrice: number;
|
|
112
|
+
gasLimit: number;
|
|
113
|
+
}): any;
|
|
110
114
|
}
|
|
@@ -32,6 +32,7 @@ var FUNCTIONS;
|
|
|
32
32
|
FUNCTIONS["WITHDRAWABLEFUNDSOF"] = "withdrawableFundsOf";
|
|
33
33
|
FUNCTIONS["WITHDRAWNFUNDSOF"] = "withdrawnFundsOf";
|
|
34
34
|
FUNCTIONS["ACCUMULATIVEFUNDSOF"] = "accumulativeFundsOf";
|
|
35
|
+
FUNCTIONS["VOTE"] = "vote";
|
|
35
36
|
})(FUNCTIONS || (FUNCTIONS = {}));
|
|
36
37
|
class Security extends index_1.VerifiedContract {
|
|
37
38
|
constructor(signer, tokenAddress) {
|
|
@@ -156,5 +157,10 @@ class Security extends index_1.VerifiedContract {
|
|
|
156
157
|
async updateFundsReceived(options) {
|
|
157
158
|
return this.callContract(FUNCTIONS.UPDATEFUNDSRECEIVED, options);
|
|
158
159
|
}
|
|
160
|
+
async vote(_time, _ballot, options) {
|
|
161
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _time);
|
|
162
|
+
await this.validateInput(index_1.DATATYPES.BOOLEAN, _ballot);
|
|
163
|
+
return this.callContract(FUNCTIONS.VOTE, _time, _ballot, options);
|
|
164
|
+
}
|
|
159
165
|
}
|
|
160
166
|
exports.default = Security;
|