@actalink/commonlib 0.0.36 → 0.0.37

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/index.cjs CHANGED
@@ -1239,7 +1239,7 @@ var ActaAccount = class {
1239
1239
  signer: this.signer
1240
1240
  }
1241
1241
  );
1242
- const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1242
+ const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1243
1243
  const emptyAccount = (0, import_sdk.addressToEmptyAccount)(sessionKeyAddress);
1244
1244
  const emptySessionKeySigner = yield (0, import_signers.toECDSASigner)({ signer: emptyAccount });
1245
1245
  const {
@@ -1367,7 +1367,7 @@ var ActaAccount = class {
1367
1367
  signer: this.signer
1368
1368
  }
1369
1369
  );
1370
- const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1370
+ const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1371
1371
  const emptyAccount = (0, import_sdk.addressToEmptyAccount)(sessionKeyAddress);
1372
1372
  const emptySessionKeySigner = yield (0, import_signers.toECDSASigner)({ signer: emptyAccount });
1373
1373
  const {
@@ -1473,7 +1473,7 @@ var ActaAccount = class {
1473
1473
  const viemClient = new ViemClient(this.chainId, this.signer);
1474
1474
  const account = yield this.createAccount();
1475
1475
  const { kernelAccountClient, accountClient } = yield this.createAccountHelpers();
1476
- const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1476
+ const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1477
1477
  const emptyAccount = (0, import_sdk.addressToEmptyAccount)(sessionKeyAddress);
1478
1478
  const emptySessionKeySigner = yield (0, import_signers.toECDSASigner)({ signer: emptyAccount });
1479
1479
  const callPolicy = (0, import_policies.toCallPolicy)({
@@ -2622,8 +2622,7 @@ var ActaBatch = class {
2622
2622
  },
2623
2623
  serviceParams
2624
2624
  );
2625
- console.log(txn);
2626
- return txn.transaction.id;
2625
+ return txn;
2627
2626
  } catch (error) {
2628
2627
  if (error instanceof Error) {
2629
2628
  throw new Error(error.message);
@@ -3187,21 +3186,36 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3187
3186
  throw new Error("Invalid initCode");
3188
3187
  return { index, validatorInitData, useMetaFactory };
3189
3188
  };
3190
- var getPeriodInterval = (periodUnit) => {
3189
+ var getPeriodInterval = (periodUnit, currentDate = /* @__PURE__ */ new Date(), count = 1) => {
3190
+ const nextDate = new Date(currentDate);
3191
+ const c = count;
3191
3192
  switch (periodUnit) {
3192
3193
  case "5mins":
3193
- return 5 * 60;
3194
+ nextDate.setMinutes(nextDate.getMinutes() + 5 * c);
3195
+ break;
3194
3196
  case "day":
3195
- return 24 * 60 * 60;
3197
+ nextDate.setDate(nextDate.getDate() + 1 * c);
3198
+ break;
3196
3199
  case "week":
3197
- return 7 * 24 * 60 * 60;
3200
+ nextDate.setDate(nextDate.getDate() + 7 * c);
3201
+ break;
3198
3202
  case "month":
3199
- return 28 * 24 * 60 * 60;
3203
+ nextDate.setMonth(nextDate.getMonth() + 1 * c);
3204
+ break;
3205
+ case "quarter":
3206
+ nextDate.setMonth(nextDate.getMonth() + 3 * c);
3207
+ break;
3208
+ case "halfyear":
3209
+ nextDate.setMonth(nextDate.getMonth() + 6 * c);
3210
+ break;
3200
3211
  case "year":
3201
- return 365 * 24 * 60 * 60;
3212
+ nextDate.setFullYear(nextDate.getFullYear() + 1 * c);
3213
+ break;
3202
3214
  default:
3203
3215
  throw new Error("Invalid period unit");
3204
3216
  }
3217
+ const milliSeconds = nextDate.getTime();
3218
+ return { milliSeconds, nextDate };
3205
3219
  };
3206
3220
  var createBillingCheckoutSession = (serviceSessionparams) => __async(null, null, function* () {
3207
3221
  var _a, _b, _c, _d;
package/dist/index.d.cts CHANGED
@@ -5038,6 +5038,10 @@ declare class ActaAccount {
5038
5038
  }): Promise<RpcUserOperation>;
5039
5039
  }
5040
5040
 
5041
+ interface PeriodIntervalResult {
5042
+ milliSeconds: number;
5043
+ nextDate: Date;
5044
+ }
5041
5045
  declare const toSignerId: (signer: ModularSigner) => Hex;
5042
5046
  declare function toECDSASigner(signer: Signer, signerContractAddress?: `0x${string}`): Promise<ModularSigner>;
5043
5047
  declare const toPolicyId: (policies: Policy[]) => Hex;
@@ -5059,7 +5063,7 @@ declare const decodeParamsFromInitCode: (initCode: Hex, kernelVersion: KERNEL_VE
5059
5063
  validatorInitData: ValidatorInitData;
5060
5064
  useMetaFactory: boolean;
5061
5065
  };
5062
- declare const getPeriodInterval: (periodUnit: string) => number;
5066
+ declare const getPeriodInterval: (periodUnit: "5mins" | "day" | "week" | "month" | "quarter" | "halfyear" | "year", currentDate?: Date, count?: number) => PeriodIntervalResult;
5063
5067
  declare const createBillingCheckoutSession: (serviceSessionparams: {
5064
5068
  paylinkId: string;
5065
5069
  mode: "paylink";
package/dist/index.d.ts CHANGED
@@ -5038,6 +5038,10 @@ declare class ActaAccount {
5038
5038
  }): Promise<RpcUserOperation>;
5039
5039
  }
5040
5040
 
5041
+ interface PeriodIntervalResult {
5042
+ milliSeconds: number;
5043
+ nextDate: Date;
5044
+ }
5041
5045
  declare const toSignerId: (signer: ModularSigner) => Hex;
5042
5046
  declare function toECDSASigner(signer: Signer, signerContractAddress?: `0x${string}`): Promise<ModularSigner>;
5043
5047
  declare const toPolicyId: (policies: Policy[]) => Hex;
@@ -5059,7 +5063,7 @@ declare const decodeParamsFromInitCode: (initCode: Hex, kernelVersion: KERNEL_VE
5059
5063
  validatorInitData: ValidatorInitData;
5060
5064
  useMetaFactory: boolean;
5061
5065
  };
5062
- declare const getPeriodInterval: (periodUnit: string) => number;
5066
+ declare const getPeriodInterval: (periodUnit: "5mins" | "day" | "week" | "month" | "quarter" | "halfyear" | "year", currentDate?: Date, count?: number) => PeriodIntervalResult;
5063
5067
  declare const createBillingCheckoutSession: (serviceSessionparams: {
5064
5068
  paylinkId: string;
5065
5069
  mode: "paylink";
package/dist/index.js CHANGED
@@ -1166,7 +1166,7 @@ var ActaAccount = class {
1166
1166
  signer: this.signer
1167
1167
  }
1168
1168
  );
1169
- const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1169
+ const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1170
1170
  const emptyAccount = addressToEmptyAccount(sessionKeyAddress);
1171
1171
  const emptySessionKeySigner = yield toECDSASigner({ signer: emptyAccount });
1172
1172
  const {
@@ -1294,7 +1294,7 @@ var ActaAccount = class {
1294
1294
  signer: this.signer
1295
1295
  }
1296
1296
  );
1297
- const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1297
+ const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1298
1298
  const emptyAccount = addressToEmptyAccount(sessionKeyAddress);
1299
1299
  const emptySessionKeySigner = yield toECDSASigner({ signer: emptyAccount });
1300
1300
  const {
@@ -1400,7 +1400,7 @@ var ActaAccount = class {
1400
1400
  const viemClient = new ViemClient(this.chainId, this.signer);
1401
1401
  const account = yield this.createAccount();
1402
1402
  const { kernelAccountClient, accountClient } = yield this.createAccountHelpers();
1403
- const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1403
+ const sessionKeyAddress = "0x182f375CD15102B22A55702a516d36f8a6443E40";
1404
1404
  const emptyAccount = addressToEmptyAccount(sessionKeyAddress);
1405
1405
  const emptySessionKeySigner = yield toECDSASigner({ signer: emptyAccount });
1406
1406
  const callPolicy = toCallPolicy({
@@ -2554,8 +2554,7 @@ var ActaBatch = class {
2554
2554
  },
2555
2555
  serviceParams
2556
2556
  );
2557
- console.log(txn);
2558
- return txn.transaction.id;
2557
+ return txn;
2559
2558
  } catch (error) {
2560
2559
  if (error instanceof Error) {
2561
2560
  throw new Error(error.message);
@@ -3150,21 +3149,36 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3150
3149
  throw new Error("Invalid initCode");
3151
3150
  return { index, validatorInitData, useMetaFactory };
3152
3151
  };
3153
- var getPeriodInterval = (periodUnit) => {
3152
+ var getPeriodInterval = (periodUnit, currentDate = /* @__PURE__ */ new Date(), count = 1) => {
3153
+ const nextDate = new Date(currentDate);
3154
+ const c = count;
3154
3155
  switch (periodUnit) {
3155
3156
  case "5mins":
3156
- return 5 * 60;
3157
+ nextDate.setMinutes(nextDate.getMinutes() + 5 * c);
3158
+ break;
3157
3159
  case "day":
3158
- return 24 * 60 * 60;
3160
+ nextDate.setDate(nextDate.getDate() + 1 * c);
3161
+ break;
3159
3162
  case "week":
3160
- return 7 * 24 * 60 * 60;
3163
+ nextDate.setDate(nextDate.getDate() + 7 * c);
3164
+ break;
3161
3165
  case "month":
3162
- return 28 * 24 * 60 * 60;
3166
+ nextDate.setMonth(nextDate.getMonth() + 1 * c);
3167
+ break;
3168
+ case "quarter":
3169
+ nextDate.setMonth(nextDate.getMonth() + 3 * c);
3170
+ break;
3171
+ case "halfyear":
3172
+ nextDate.setMonth(nextDate.getMonth() + 6 * c);
3173
+ break;
3163
3174
  case "year":
3164
- return 365 * 24 * 60 * 60;
3175
+ nextDate.setFullYear(nextDate.getFullYear() + 1 * c);
3176
+ break;
3165
3177
  default:
3166
3178
  throw new Error("Invalid period unit");
3167
3179
  }
3180
+ const milliSeconds = nextDate.getTime();
3181
+ return { milliSeconds, nextDate };
3168
3182
  };
3169
3183
  var createBillingCheckoutSession = (serviceSessionparams) => __async(null, null, function* () {
3170
3184
  var _a, _b, _c, _d;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actalink/commonlib",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "author": "Actalink",
5
5
  "license": "MIT license",
6
6
  "publishConfig": {