@actalink/commonlib 0.0.42 → 0.1.0-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 +42 -5
- package/dist/index.d.cts +1806 -4998
- package/dist/index.d.ts +1806 -4998
- package/dist/index.js +51 -14
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -565,7 +565,7 @@ function getTokenByChainIdAndAddress(chainId, address) {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
// src/flexdeposit.ts
|
|
568
|
-
import { toHex as toHex3, zeroAddress as
|
|
568
|
+
import { toHex as toHex3, zeroAddress as zeroAddress2 } from "viem";
|
|
569
569
|
|
|
570
570
|
// src/account.ts
|
|
571
571
|
import {
|
|
@@ -596,6 +596,7 @@ import {
|
|
|
596
596
|
VALIDATOR_TYPE
|
|
597
597
|
} from "@zerodev/sdk/constants";
|
|
598
598
|
import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator";
|
|
599
|
+
import { signerToSmartAccountValidator } from "@zerodev/smart-account-validator";
|
|
599
600
|
import { createSmartAccountClient, getRequiredPrefund } from "permissionless";
|
|
600
601
|
import { createPimlicoClient } from "permissionless/clients/pimlico";
|
|
601
602
|
|
|
@@ -718,8 +719,9 @@ var ActaAccount = class {
|
|
|
718
719
|
this.signer = signer;
|
|
719
720
|
this.publicClient = publicClient;
|
|
720
721
|
}
|
|
721
|
-
|
|
722
|
+
createAccountFromEOA() {
|
|
722
723
|
return __async(this, null, function* () {
|
|
724
|
+
console.log("EOA connected");
|
|
723
725
|
const kernelVersion = KERNEL_V3_1;
|
|
724
726
|
const entryPoint = getEntryPoint("0.7");
|
|
725
727
|
const ecdsaValidator = yield signerToEcdsaValidator(this.publicClient, {
|
|
@@ -737,6 +739,45 @@ var ActaAccount = class {
|
|
|
737
739
|
return account;
|
|
738
740
|
});
|
|
739
741
|
}
|
|
742
|
+
createAccountFromSmartWallet() {
|
|
743
|
+
return __async(this, null, function* () {
|
|
744
|
+
console.log("Smart account Connected");
|
|
745
|
+
const kernelVersion = KERNEL_V3_1;
|
|
746
|
+
const entryPoint = getEntryPoint("0.7");
|
|
747
|
+
const validator = yield signerToSmartAccountValidator(this.publicClient, {
|
|
748
|
+
entryPoint: getEntryPoint("0.7"),
|
|
749
|
+
kernelVersion,
|
|
750
|
+
signer: this.signer,
|
|
751
|
+
smartAccountType: "SAFE"
|
|
752
|
+
});
|
|
753
|
+
const account = yield createKernelAccount(this.publicClient, {
|
|
754
|
+
plugins: {
|
|
755
|
+
sudo: validator
|
|
756
|
+
},
|
|
757
|
+
entryPoint,
|
|
758
|
+
kernelVersion
|
|
759
|
+
});
|
|
760
|
+
return account;
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
createAccount() {
|
|
764
|
+
return __async(this, null, function* () {
|
|
765
|
+
const signerAccount = this.signer.account;
|
|
766
|
+
if (!signerAccount) {
|
|
767
|
+
throw new Error("Signer account not provided");
|
|
768
|
+
}
|
|
769
|
+
const code = yield this.publicClient.getCode({
|
|
770
|
+
address: signerAccount.address
|
|
771
|
+
});
|
|
772
|
+
let account;
|
|
773
|
+
if (code && code.length > 0) {
|
|
774
|
+
account = yield this.createAccountFromSmartWallet();
|
|
775
|
+
} else {
|
|
776
|
+
account = yield this.createAccountFromEOA();
|
|
777
|
+
}
|
|
778
|
+
return account;
|
|
779
|
+
});
|
|
780
|
+
}
|
|
740
781
|
createAccountHelpers() {
|
|
741
782
|
return __async(this, null, function* () {
|
|
742
783
|
const account = yield this.createAccount();
|
|
@@ -837,10 +878,8 @@ var ActaAccount = class {
|
|
|
837
878
|
if (receiver === signerAddress) {
|
|
838
879
|
throw new Error("Receiver cannot be the same as the signer.");
|
|
839
880
|
}
|
|
840
|
-
const account = yield this.createAccount();
|
|
841
881
|
const { accountClient, pimlicoClient } = yield this.createAccountHelpers();
|
|
842
882
|
const fromAddress = signerAddress;
|
|
843
|
-
const smartAccountAddress = account.address;
|
|
844
883
|
const token2 = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
|
|
845
884
|
if (!token2) {
|
|
846
885
|
throw new Error("Token not found.");
|
|
@@ -912,10 +951,8 @@ var ActaAccount = class {
|
|
|
912
951
|
if (receivers.length === 0) {
|
|
913
952
|
throw new Error("Receivers not found for batch payment");
|
|
914
953
|
}
|
|
915
|
-
const account = yield this.createAccount();
|
|
916
954
|
const { accountClient, pimlicoClient } = yield this.createAccountHelperBatch();
|
|
917
955
|
const fromAddress = signerAddress;
|
|
918
|
-
const smartAccountAddress = account.address;
|
|
919
956
|
const token2 = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
|
|
920
957
|
if (!token2) {
|
|
921
958
|
throw new Error("Token not found.");
|
|
@@ -1836,13 +1873,13 @@ var ActaFlexDeposit = class {
|
|
|
1836
1873
|
createSession(serviceSessionparams) {
|
|
1837
1874
|
return __async(this, null, function* () {
|
|
1838
1875
|
try {
|
|
1839
|
-
if (!this.signerAddress || this.signerAddress ===
|
|
1876
|
+
if (!this.signerAddress || this.signerAddress === zeroAddress2) {
|
|
1840
1877
|
throw new Error("Signer address is required.");
|
|
1841
1878
|
}
|
|
1842
1879
|
if (this.paymentType !== "single" && this.paymentType !== "choose" && this.paymentType !== "recurring") {
|
|
1843
1880
|
throw new Error("Invalid payment type.");
|
|
1844
1881
|
}
|
|
1845
|
-
if (!this.receiver || this.receiver ===
|
|
1882
|
+
if (!this.receiver || this.receiver === zeroAddress2) {
|
|
1846
1883
|
throw new Error("Receiver is required.");
|
|
1847
1884
|
}
|
|
1848
1885
|
if (this.paymentType === "recurring" && (this.count === void 0 || this.count === 0)) {
|
|
@@ -2152,7 +2189,7 @@ import {
|
|
|
2152
2189
|
getAddress as getAddress3,
|
|
2153
2190
|
parseUnits,
|
|
2154
2191
|
toHex as toHex4,
|
|
2155
|
-
zeroAddress as
|
|
2192
|
+
zeroAddress as zeroAddress3
|
|
2156
2193
|
} from "viem";
|
|
2157
2194
|
var batchServiceUrl = "https://flex-api.acta.link/flex/batch/api/v1/";
|
|
2158
2195
|
var batchServiceTestUrl = "https://flex-api.acta.link/flex/batch/test/api/v1/";
|
|
@@ -2184,7 +2221,7 @@ var ActaFlexBatch = class {
|
|
|
2184
2221
|
if (!this.APIkey) {
|
|
2185
2222
|
throw new Error("No API key provided.");
|
|
2186
2223
|
}
|
|
2187
|
-
if (!signerAddress || signerAddress ===
|
|
2224
|
+
if (!signerAddress || signerAddress === zeroAddress3) {
|
|
2188
2225
|
throw new Error("Signer address is required.");
|
|
2189
2226
|
}
|
|
2190
2227
|
if (!name || name === "") {
|
|
@@ -2858,7 +2895,7 @@ import {
|
|
|
2858
2895
|
getAddress as getAddress4,
|
|
2859
2896
|
parseUnits as parseUnits2,
|
|
2860
2897
|
toHex as toHex6,
|
|
2861
|
-
zeroAddress as
|
|
2898
|
+
zeroAddress as zeroAddress4
|
|
2862
2899
|
} from "viem";
|
|
2863
2900
|
var batchServiceUrl2 = "https://api.acta.link/bexo/api/v1/";
|
|
2864
2901
|
var batchServiceTestUrl2 = "https://api.acta.link/bexo/test/api/v1/";
|
|
@@ -2890,7 +2927,7 @@ var ActaBatch = class {
|
|
|
2890
2927
|
if (!this.APIkey) {
|
|
2891
2928
|
throw new Error("No API key provided.");
|
|
2892
2929
|
}
|
|
2893
|
-
if (!signerAddress || signerAddress ===
|
|
2930
|
+
if (!signerAddress || signerAddress === zeroAddress4) {
|
|
2894
2931
|
throw new Error("Signer address is required.");
|
|
2895
2932
|
}
|
|
2896
2933
|
if (!name || name === "") {
|
|
@@ -3337,7 +3374,7 @@ import {
|
|
|
3337
3374
|
encodeAbiParameters,
|
|
3338
3375
|
keccak256,
|
|
3339
3376
|
slice,
|
|
3340
|
-
zeroAddress as
|
|
3377
|
+
zeroAddress as zeroAddress5,
|
|
3341
3378
|
decodeFunctionData,
|
|
3342
3379
|
hexToBigInt as hexToBigInt2
|
|
3343
3380
|
} from "viem";
|
|
@@ -3449,7 +3486,7 @@ function toPermissionValidator2(_0, _1) {
|
|
|
3449
3486
|
return __spreadProps(__spreadValues({}, signer.account), {
|
|
3450
3487
|
supportedKernelVersions: ">=0.3.0",
|
|
3451
3488
|
validatorType: "PERMISSION",
|
|
3452
|
-
address:
|
|
3489
|
+
address: zeroAddress5,
|
|
3453
3490
|
source: "PermissionValidator",
|
|
3454
3491
|
getEnableData,
|
|
3455
3492
|
getIdentifier: getPermissionId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actalink/commonlib",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-dev",
|
|
4
4
|
"author": "Actalink",
|
|
5
5
|
"license": "MIT license",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
"@zerodev/ecdsa-validator": "^5.4.8",
|
|
34
34
|
"@zerodev/permissions": "5.5.12",
|
|
35
35
|
"@zerodev/sdk": "5.4.41",
|
|
36
|
+
"@zerodev/smart-account-validator": "^5.4.1",
|
|
36
37
|
"@zerodev/webauthn-key": "^5.4.4",
|
|
37
38
|
"permissionless": "^0.2.47",
|
|
38
39
|
"semver": "^7.7.2",
|
|
39
40
|
"ts-node": "^10.9.2",
|
|
40
41
|
"typescript": "^5.8.3",
|
|
41
|
-
"viem": "2.
|
|
42
|
+
"viem": "2.43.2"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@types/semver": "^7.7.0",
|