@actalink/sdkv2 0.1.7-dev → 0.1.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/index.cjs +18 -16
- package/dist/index.d.cts +13 -3407
- package/dist/index.d.ts +13 -3407
- package/dist/index.js +17 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ var ProviderConfigSchema = z.object({
|
|
|
113
113
|
apiKey: z.string().min(1, "API key is required"),
|
|
114
114
|
url: z.string().url().optional()
|
|
115
115
|
});
|
|
116
|
-
var
|
|
116
|
+
var OpendepositConfigSchema = z.object({
|
|
117
117
|
projectId: z.string().min(1, "projectId is required")
|
|
118
118
|
});
|
|
119
119
|
var CreateSinglePaymentSchema = z.object({
|
|
@@ -761,8 +761,8 @@ import {
|
|
|
761
761
|
} from "@zerodev/permissions/policies";
|
|
762
762
|
|
|
763
763
|
// src/constants.ts
|
|
764
|
-
var
|
|
765
|
-
var
|
|
764
|
+
var OPENDEPOSIT_URL = "https://api.opendeposit.xyz/flex/deposit";
|
|
765
|
+
var OPENDEPOSIT_TESTNET_URL = "https://api.opendeposit.xyz/flex/deposit/test";
|
|
766
766
|
var PAYMASTER_URL = `https://api.acta.link/paymaster/flex/deposit`;
|
|
767
767
|
var PROXY_URL = `https://api.acta.link/proxy/v1`;
|
|
768
768
|
|
|
@@ -787,7 +787,7 @@ var ActaAccount = class {
|
|
|
787
787
|
},
|
|
788
788
|
entryPoint,
|
|
789
789
|
kernelVersion,
|
|
790
|
-
index: BigInt("
|
|
790
|
+
index: BigInt("open-deposit".length)
|
|
791
791
|
});
|
|
792
792
|
return account;
|
|
793
793
|
});
|
|
@@ -865,6 +865,7 @@ var ActaAccount = class {
|
|
|
865
865
|
throw new Error("Token not found.");
|
|
866
866
|
}
|
|
867
867
|
const userOperation = yield accountClient.prepareUserOperation({
|
|
868
|
+
account,
|
|
868
869
|
calls: [
|
|
869
870
|
{
|
|
870
871
|
to: getAddress2(token2.address),
|
|
@@ -972,6 +973,7 @@ var ActaAccount = class {
|
|
|
972
973
|
allowMaxTokenApproval != null ? allowMaxTokenApproval : false
|
|
973
974
|
);
|
|
974
975
|
const userOperation = yield accountClient.prepareUserOperation({
|
|
976
|
+
account,
|
|
975
977
|
calls: [
|
|
976
978
|
{
|
|
977
979
|
to: getAddress2(token2.address),
|
|
@@ -1259,7 +1261,7 @@ function waitForPaymentStatus(url, id, intervalMs = 2e3) {
|
|
|
1259
1261
|
});
|
|
1260
1262
|
}
|
|
1261
1263
|
|
|
1262
|
-
// src/execution/
|
|
1264
|
+
// src/execution/opendeposit.ts
|
|
1263
1265
|
import { toHex } from "viem";
|
|
1264
1266
|
var returnEnvUrl = (chainId) => {
|
|
1265
1267
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
@@ -1269,11 +1271,11 @@ var returnEnvUrl = (chainId) => {
|
|
|
1269
1271
|
}
|
|
1270
1272
|
if (mainnetChain) {
|
|
1271
1273
|
return {
|
|
1272
|
-
|
|
1274
|
+
envOpendepositURL: OPENDEPOSIT_URL
|
|
1273
1275
|
};
|
|
1274
1276
|
} else {
|
|
1275
1277
|
return {
|
|
1276
|
-
|
|
1278
|
+
envOpendepositURL: OPENDEPOSIT_TESTNET_URL
|
|
1277
1279
|
};
|
|
1278
1280
|
}
|
|
1279
1281
|
};
|
|
@@ -1334,7 +1336,7 @@ function createOnetimePaymentInternal(parameters, projectId) {
|
|
|
1334
1336
|
if (!token2) {
|
|
1335
1337
|
throw new Error("Token not supported.");
|
|
1336
1338
|
}
|
|
1337
|
-
const {
|
|
1339
|
+
const { envOpendepositURL } = returnEnvUrl(chainId);
|
|
1338
1340
|
const accountInstance = new ActaAccount(publicClient, walletClient);
|
|
1339
1341
|
const rpcParameters = yield accountInstance.signSinglePaymentOperation(
|
|
1340
1342
|
{
|
|
@@ -1352,7 +1354,7 @@ function createOnetimePaymentInternal(parameters, projectId) {
|
|
|
1352
1354
|
projectId
|
|
1353
1355
|
);
|
|
1354
1356
|
const data = yield executeSinglePaymentAPICall(
|
|
1355
|
-
`${
|
|
1357
|
+
`${envOpendepositURL}/api/v1/execute/single`,
|
|
1356
1358
|
rpcParameters,
|
|
1357
1359
|
{
|
|
1358
1360
|
amount: toHex(amount),
|
|
@@ -1386,7 +1388,7 @@ function createRecurringePaymentInternal(parameters, projectId) {
|
|
|
1386
1388
|
if (!token2) {
|
|
1387
1389
|
throw new Error("Token not supported.");
|
|
1388
1390
|
}
|
|
1389
|
-
const {
|
|
1391
|
+
const { envOpendepositURL } = returnEnvUrl(chainId);
|
|
1390
1392
|
const accountInstance = new ActaAccount(publicClient, walletClient);
|
|
1391
1393
|
const { approval, amountExclusive } = yield accountInstance.signRecurringPayments(
|
|
1392
1394
|
{
|
|
@@ -1407,7 +1409,7 @@ function createRecurringePaymentInternal(parameters, projectId) {
|
|
|
1407
1409
|
);
|
|
1408
1410
|
const startAt = Math.floor(Date.now() / 1e3) + 2 * 60;
|
|
1409
1411
|
const data = yield scheduleRecurringPaymentsAPICall(
|
|
1410
|
-
`${
|
|
1412
|
+
`${envOpendepositURL}/api/v1/schedule/recurring`,
|
|
1411
1413
|
{
|
|
1412
1414
|
senderAddress: signerAddress,
|
|
1413
1415
|
receiverAddress: receiver,
|
|
@@ -1428,8 +1430,8 @@ function createRecurringePaymentInternal(parameters, projectId) {
|
|
|
1428
1430
|
});
|
|
1429
1431
|
}
|
|
1430
1432
|
|
|
1431
|
-
// src/
|
|
1432
|
-
var
|
|
1433
|
+
// src/opendeposit.ts
|
|
1434
|
+
var OpendepositSDK = class {
|
|
1433
1435
|
constructor(parameters) {
|
|
1434
1436
|
this.projectId = parameters.projectId;
|
|
1435
1437
|
}
|
|
@@ -1485,7 +1487,7 @@ var ActaFlexSDK = class {
|
|
|
1485
1487
|
const result = PollPaymentStatusSchema.parse({ id });
|
|
1486
1488
|
const envType = id.split("_")[1];
|
|
1487
1489
|
return yield waitForPaymentStatus(
|
|
1488
|
-
`${envType !== "test" ?
|
|
1490
|
+
`${envType !== "test" ? OPENDEPOSIT_URL : OPENDEPOSIT_TESTNET_URL}/api/v1/payment/status`,
|
|
1489
1491
|
result.id,
|
|
1490
1492
|
intervalMs
|
|
1491
1493
|
);
|
|
@@ -1500,8 +1502,8 @@ var ActaFlexSDK = class {
|
|
|
1500
1502
|
};
|
|
1501
1503
|
export {
|
|
1502
1504
|
ActaAccount,
|
|
1503
|
-
ActaFlexSDK,
|
|
1504
1505
|
HttpMethod,
|
|
1506
|
+
OpendepositSDK,
|
|
1505
1507
|
ViemClient,
|
|
1506
1508
|
arbitrumDAI,
|
|
1507
1509
|
arbitrumETH,
|