@actalink/commonlib 0.0.38-dev → 0.0.40-dev

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)({
@@ -3186,21 +3186,36 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3186
3186
  throw new Error("Invalid initCode");
3187
3187
  return { index, validatorInitData, useMetaFactory };
3188
3188
  };
3189
- var getPeriodInterval = (periodUnit) => {
3189
+ var getPeriodInterval = (periodUnit, currentDate = /* @__PURE__ */ new Date(), count = 1) => {
3190
+ const nextDate = new Date(currentDate);
3191
+ const c = count;
3190
3192
  switch (periodUnit) {
3191
3193
  case "5mins":
3192
- return 5 * 60;
3194
+ nextDate.setMinutes(nextDate.getMinutes() + 5 * c);
3195
+ break;
3193
3196
  case "day":
3194
- return 24 * 60 * 60;
3197
+ nextDate.setDate(nextDate.getDate() + 1 * c);
3198
+ break;
3195
3199
  case "week":
3196
- return 7 * 24 * 60 * 60;
3200
+ nextDate.setDate(nextDate.getDate() + 7 * c);
3201
+ break;
3197
3202
  case "month":
3198
- 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;
3199
3211
  case "year":
3200
- return 365 * 24 * 60 * 60;
3212
+ nextDate.setFullYear(nextDate.getFullYear() + 1 * c);
3213
+ break;
3201
3214
  default:
3202
3215
  throw new Error("Invalid period unit");
3203
3216
  }
3217
+ const milliSeconds = nextDate.getTime();
3218
+ return { milliSeconds, nextDate };
3204
3219
  };
3205
3220
  var createBillingCheckoutSession = (serviceSessionparams) => __async(null, null, function* () {
3206
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({
@@ -3149,21 +3149,36 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3149
3149
  throw new Error("Invalid initCode");
3150
3150
  return { index, validatorInitData, useMetaFactory };
3151
3151
  };
3152
- var getPeriodInterval = (periodUnit) => {
3152
+ var getPeriodInterval = (periodUnit, currentDate = /* @__PURE__ */ new Date(), count = 1) => {
3153
+ const nextDate = new Date(currentDate);
3154
+ const c = count;
3153
3155
  switch (periodUnit) {
3154
3156
  case "5mins":
3155
- return 5 * 60;
3157
+ nextDate.setMinutes(nextDate.getMinutes() + 5 * c);
3158
+ break;
3156
3159
  case "day":
3157
- return 24 * 60 * 60;
3160
+ nextDate.setDate(nextDate.getDate() + 1 * c);
3161
+ break;
3158
3162
  case "week":
3159
- return 7 * 24 * 60 * 60;
3163
+ nextDate.setDate(nextDate.getDate() + 7 * c);
3164
+ break;
3160
3165
  case "month":
3161
- 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;
3162
3174
  case "year":
3163
- return 365 * 24 * 60 * 60;
3175
+ nextDate.setFullYear(nextDate.getFullYear() + 1 * c);
3176
+ break;
3164
3177
  default:
3165
3178
  throw new Error("Invalid period unit");
3166
3179
  }
3180
+ const milliSeconds = nextDate.getTime();
3181
+ return { milliSeconds, nextDate };
3167
3182
  };
3168
3183
  var createBillingCheckoutSession = (serviceSessionparams) => __async(null, null, function* () {
3169
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.38-dev",
3
+ "version": "0.0.40-dev",
4
4
  "author": "Actalink",
5
5
  "license": "MIT license",
6
6
  "publishConfig": {