@actalink/sdkv2 0.1.0 → 0.1.1
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 +56 -8
- package/dist/index.d.cts +45 -45
- package/dist/index.d.ts +45 -45
- package/dist/index.js +56 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -137,7 +137,10 @@ var supportedChains = [
|
|
|
137
137
|
import_chains2.bsc,
|
|
138
138
|
import_chains2.mainnet,
|
|
139
139
|
import_chains2.optimism,
|
|
140
|
-
import_chains2.polygon
|
|
140
|
+
import_chains2.polygon,
|
|
141
|
+
import_chains.baseSepolia,
|
|
142
|
+
import_chains.sepolia,
|
|
143
|
+
import_chains.polygonAmoy
|
|
141
144
|
];
|
|
142
145
|
var mainnetChains = [import_chains2.arbitrum, import_chains2.base, import_chains2.bsc, import_chains2.mainnet, import_chains2.optimism, import_chains2.polygon];
|
|
143
146
|
var testnetChains = [import_chains.sepolia, import_chains.baseSepolia, import_chains.polygonAmoy];
|
|
@@ -160,6 +163,12 @@ function getChainExplorerByChainId(chainId) {
|
|
|
160
163
|
return "https://optimistic.etherscan.io";
|
|
161
164
|
case import_chains2.polygon.id:
|
|
162
165
|
return "https://polygonscan.com";
|
|
166
|
+
case import_chains.baseSepolia.id:
|
|
167
|
+
return "https://sepolia.basescan.org";
|
|
168
|
+
case import_chains.sepolia.id:
|
|
169
|
+
return "https://sepolia.etherscan.io";
|
|
170
|
+
case import_chains.polygonAmoy.id:
|
|
171
|
+
return "https://amoy.polygonscan.com";
|
|
163
172
|
default:
|
|
164
173
|
return void 0;
|
|
165
174
|
}
|
|
@@ -187,7 +196,10 @@ var CreateSinglePaymentSchema = import_zod.z.object({
|
|
|
187
196
|
import_zod.z.literal(59144),
|
|
188
197
|
import_zod.z.literal(56),
|
|
189
198
|
import_zod.z.literal(10),
|
|
190
|
-
import_zod.z.literal(137)
|
|
199
|
+
import_zod.z.literal(137),
|
|
200
|
+
import_zod.z.literal(84532),
|
|
201
|
+
import_zod.z.literal(11155111),
|
|
202
|
+
import_zod.z.literal(80002)
|
|
191
203
|
]),
|
|
192
204
|
publicClient: import_zod.z.custom(
|
|
193
205
|
(val) => val !== void 0,
|
|
@@ -215,7 +227,10 @@ var CreateRecurringPaymentSchema = import_zod.z.object({
|
|
|
215
227
|
import_zod.z.literal(59144),
|
|
216
228
|
import_zod.z.literal(56),
|
|
217
229
|
import_zod.z.literal(10),
|
|
218
|
-
import_zod.z.literal(137)
|
|
230
|
+
import_zod.z.literal(137),
|
|
231
|
+
import_zod.z.literal(84532),
|
|
232
|
+
import_zod.z.literal(11155111),
|
|
233
|
+
import_zod.z.literal(80002)
|
|
219
234
|
]),
|
|
220
235
|
publicClient: import_zod.z.custom(
|
|
221
236
|
(val) => val !== void 0,
|
|
@@ -245,7 +260,10 @@ var EstimateSinglePaymentGasSchema = import_zod.z.object({
|
|
|
245
260
|
import_zod.z.literal(59144),
|
|
246
261
|
import_zod.z.literal(56),
|
|
247
262
|
import_zod.z.literal(10),
|
|
248
|
-
import_zod.z.literal(137)
|
|
263
|
+
import_zod.z.literal(137),
|
|
264
|
+
import_zod.z.literal(84532),
|
|
265
|
+
import_zod.z.literal(11155111),
|
|
266
|
+
import_zod.z.literal(80002)
|
|
249
267
|
]),
|
|
250
268
|
publicClient: import_zod.z.custom(
|
|
251
269
|
(val) => val !== void 0,
|
|
@@ -595,6 +613,7 @@ var polygonAmoyUSDC = token({
|
|
|
595
613
|
symbol: "USDC",
|
|
596
614
|
logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
|
|
597
615
|
});
|
|
616
|
+
var polygonAmoyTokens = [polygonAmoyUSDC];
|
|
598
617
|
var baseSepoliaUSDC = token({
|
|
599
618
|
chainId: import_chains3.baseSepolia.id,
|
|
600
619
|
address: (0, import_viem2.getAddress)("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
@@ -604,6 +623,7 @@ var baseSepoliaUSDC = token({
|
|
|
604
623
|
symbol: "USDC",
|
|
605
624
|
logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
|
|
606
625
|
});
|
|
626
|
+
var baseSepoliaTokens = [baseSepoliaUSDC];
|
|
607
627
|
var sepoliaUSDC = token({
|
|
608
628
|
chainId: import_chains3.sepolia.id,
|
|
609
629
|
address: (0, import_viem2.getAddress)("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
@@ -613,6 +633,7 @@ var sepoliaUSDC = token({
|
|
|
613
633
|
symbol: "USDC",
|
|
614
634
|
logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
|
|
615
635
|
});
|
|
636
|
+
var sepoliaTokens = [sepoliaUSDC];
|
|
616
637
|
var supportedTokensByChain = /* @__PURE__ */ new Map([
|
|
617
638
|
[import_chains3.arbitrum.id, arbitrumTokens],
|
|
618
639
|
//done
|
|
@@ -624,7 +645,14 @@ var supportedTokensByChain = /* @__PURE__ */ new Map([
|
|
|
624
645
|
//done
|
|
625
646
|
[import_chains3.optimism.id, optimismTokens],
|
|
626
647
|
//done
|
|
627
|
-
[import_chains3.polygon.id, polygonTokens]
|
|
648
|
+
[import_chains3.polygon.id, polygonTokens],
|
|
649
|
+
//done
|
|
650
|
+
[import_chains3.sepolia.id, sepoliaTokens],
|
|
651
|
+
//done
|
|
652
|
+
[import_chains3.polygonAmoy.id, polygonAmoyTokens],
|
|
653
|
+
//done
|
|
654
|
+
[import_chains3.baseSepolia.id, baseSepoliaTokens]
|
|
655
|
+
//done
|
|
628
656
|
]);
|
|
629
657
|
function nativeETH(chainId) {
|
|
630
658
|
return nativeToken({
|
|
@@ -1295,8 +1323,25 @@ var import_viem5 = require("viem");
|
|
|
1295
1323
|
|
|
1296
1324
|
// src/constants.ts
|
|
1297
1325
|
var ACCESS_URL = "https://api.acta.link/deposit";
|
|
1326
|
+
var ACCESS_TESTNET_URL = "https://api.acta.link/deposit/test";
|
|
1298
1327
|
|
|
1299
1328
|
// src/execution/access.ts
|
|
1329
|
+
var returnEnvUrl = (chainId) => {
|
|
1330
|
+
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
1331
|
+
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
1332
|
+
if (!mainnetChain && !testnetChain) {
|
|
1333
|
+
throw new Error(`Chain ${chainId} not supported.`);
|
|
1334
|
+
}
|
|
1335
|
+
if (mainnetChain) {
|
|
1336
|
+
return {
|
|
1337
|
+
envAccessURL: ACCESS_URL
|
|
1338
|
+
};
|
|
1339
|
+
} else {
|
|
1340
|
+
return {
|
|
1341
|
+
envAccessURL: ACCESS_TESTNET_URL
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1300
1345
|
var getPeriodInterval = (periodUnit) => {
|
|
1301
1346
|
switch (periodUnit) {
|
|
1302
1347
|
case "5mins":
|
|
@@ -1355,6 +1400,7 @@ function createOnetimePaymentInternal(parameters) {
|
|
|
1355
1400
|
if (!token2) {
|
|
1356
1401
|
throw new Error("Token not supported.");
|
|
1357
1402
|
}
|
|
1403
|
+
const { envAccessURL } = returnEnvUrl(chainId);
|
|
1358
1404
|
const accountInstance = new ActaAccount(publicClient, walletClient);
|
|
1359
1405
|
const rpcParameters = yield accountInstance.signSinglePaymentOperation({
|
|
1360
1406
|
signerAddress,
|
|
@@ -1369,7 +1415,7 @@ function createOnetimePaymentInternal(parameters) {
|
|
|
1369
1415
|
walletClient
|
|
1370
1416
|
});
|
|
1371
1417
|
const data = yield executeSinglePaymentAPICall(
|
|
1372
|
-
`${
|
|
1418
|
+
`${envAccessURL}/api/v1/execute/single`,
|
|
1373
1419
|
rpcParameters,
|
|
1374
1420
|
{
|
|
1375
1421
|
amount: (0, import_viem5.toHex)(amount),
|
|
@@ -1404,6 +1450,7 @@ function createRecurringePaymentInternal(parameters) {
|
|
|
1404
1450
|
if (!token2) {
|
|
1405
1451
|
throw new Error("Token not supported.");
|
|
1406
1452
|
}
|
|
1453
|
+
const { envAccessURL } = returnEnvUrl(chainId);
|
|
1407
1454
|
const accountInstance = new ActaAccount(publicClient, walletClient);
|
|
1408
1455
|
const { approval, amountExclusive } = yield accountInstance.signRecurringPayments({
|
|
1409
1456
|
signerAddress,
|
|
@@ -1421,7 +1468,7 @@ function createRecurringePaymentInternal(parameters) {
|
|
|
1421
1468
|
});
|
|
1422
1469
|
const startAt = Math.floor(Date.now() / 1e3) + 2 * 60;
|
|
1423
1470
|
const data = yield scheduleRecurringPaymentsAPICall(
|
|
1424
|
-
`${
|
|
1471
|
+
`${envAccessURL}/api/v1/schedule/recurring`,
|
|
1425
1472
|
{
|
|
1426
1473
|
senderAddress: signerAddress,
|
|
1427
1474
|
receiverAddress: receiver,
|
|
@@ -1499,8 +1546,9 @@ var ActaAccessSDK = class {
|
|
|
1499
1546
|
return __async(this, null, function* () {
|
|
1500
1547
|
try {
|
|
1501
1548
|
const result = PollPaymentStatusSchema.parse({ id });
|
|
1549
|
+
const envType = id.split("_")[1];
|
|
1502
1550
|
return yield waitForPaymentStatus(
|
|
1503
|
-
`${ACCESS_URL}/api/v1/payment/status`,
|
|
1551
|
+
`${envType !== "test" ? ACCESS_URL : ACCESS_TESTNET_URL}/api/v1/payment/status`,
|
|
1504
1552
|
result.id,
|
|
1505
1553
|
intervalMs
|
|
1506
1554
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -22,7 +22,7 @@ declare const ActaAccessConfigSchema: z.ZodObject<{
|
|
|
22
22
|
}, z.core.$strip>;
|
|
23
23
|
declare const CreateSinglePaymentSchema: z.ZodObject<{
|
|
24
24
|
signerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
25
|
-
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
|
|
25
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>, z.ZodLiteral<84532>, z.ZodLiteral<11155111>, z.ZodLiteral<80002>]>;
|
|
26
26
|
publicClient: z.ZodCustom<{
|
|
27
27
|
account: undefined;
|
|
28
28
|
batch?: {
|
|
@@ -16097,7 +16097,7 @@ declare const CreateSinglePaymentSchema: z.ZodObject<{
|
|
|
16097
16097
|
}, z.core.$strip>;
|
|
16098
16098
|
declare const CreateRecurringPaymentSchema: z.ZodObject<{
|
|
16099
16099
|
signerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
16100
|
-
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
|
|
16100
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>, z.ZodLiteral<84532>, z.ZodLiteral<11155111>, z.ZodLiteral<80002>]>;
|
|
16101
16101
|
publicClient: z.ZodCustom<{
|
|
16102
16102
|
account: undefined;
|
|
16103
16103
|
batch?: {
|
|
@@ -32179,7 +32179,7 @@ declare const CreateRecurringPaymentSchema: z.ZodObject<{
|
|
|
32179
32179
|
}, z.core.$strip>;
|
|
32180
32180
|
declare const EstimateSinglePaymentGasSchema: z.ZodObject<{
|
|
32181
32181
|
signerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
32182
|
-
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
|
|
32182
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>, z.ZodLiteral<84532>, z.ZodLiteral<11155111>, z.ZodLiteral<80002>]>;
|
|
32183
32183
|
publicClient: z.ZodCustom<{
|
|
32184
32184
|
account: undefined;
|
|
32185
32185
|
batch?: {
|
|
@@ -49106,46 +49106,6 @@ declare const mainnetChains: ({
|
|
|
49106
49106
|
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
49107
49107
|
})[];
|
|
49108
49108
|
declare const testnetChains: ({
|
|
49109
|
-
blockExplorers: {
|
|
49110
|
-
readonly default: {
|
|
49111
|
-
readonly name: "Etherscan";
|
|
49112
|
-
readonly url: "https://sepolia.etherscan.io";
|
|
49113
|
-
readonly apiUrl: "https://api-sepolia.etherscan.io/api";
|
|
49114
|
-
};
|
|
49115
|
-
};
|
|
49116
|
-
contracts: {
|
|
49117
|
-
readonly multicall3: {
|
|
49118
|
-
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
49119
|
-
readonly blockCreated: 751532;
|
|
49120
|
-
};
|
|
49121
|
-
readonly ensRegistry: {
|
|
49122
|
-
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
49123
|
-
};
|
|
49124
|
-
readonly ensUniversalResolver: {
|
|
49125
|
-
readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
|
|
49126
|
-
readonly blockCreated: 5317080;
|
|
49127
|
-
};
|
|
49128
|
-
};
|
|
49129
|
-
ensTlds?: readonly string[] | undefined;
|
|
49130
|
-
id: 11155111;
|
|
49131
|
-
name: "Sepolia";
|
|
49132
|
-
nativeCurrency: {
|
|
49133
|
-
readonly name: "Sepolia Ether";
|
|
49134
|
-
readonly symbol: "ETH";
|
|
49135
|
-
readonly decimals: 18;
|
|
49136
|
-
};
|
|
49137
|
-
rpcUrls: {
|
|
49138
|
-
readonly default: {
|
|
49139
|
-
readonly http: readonly ["https://sepolia.drpc.org"];
|
|
49140
|
-
};
|
|
49141
|
-
};
|
|
49142
|
-
sourceId?: number | undefined | undefined;
|
|
49143
|
-
testnet: true;
|
|
49144
|
-
custom?: Record<string, unknown> | undefined;
|
|
49145
|
-
fees?: viem.ChainFees<undefined> | undefined;
|
|
49146
|
-
formatters?: undefined;
|
|
49147
|
-
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
49148
|
-
} | {
|
|
49149
49109
|
blockExplorers: {
|
|
49150
49110
|
readonly default: {
|
|
49151
49111
|
readonly name: "Basescan";
|
|
@@ -49451,6 +49411,46 @@ declare const testnetChains: ({
|
|
|
49451
49411
|
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
49452
49412
|
};
|
|
49453
49413
|
readonly network: "base-sepolia";
|
|
49414
|
+
} | {
|
|
49415
|
+
blockExplorers: {
|
|
49416
|
+
readonly default: {
|
|
49417
|
+
readonly name: "Etherscan";
|
|
49418
|
+
readonly url: "https://sepolia.etherscan.io";
|
|
49419
|
+
readonly apiUrl: "https://api-sepolia.etherscan.io/api";
|
|
49420
|
+
};
|
|
49421
|
+
};
|
|
49422
|
+
contracts: {
|
|
49423
|
+
readonly multicall3: {
|
|
49424
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
49425
|
+
readonly blockCreated: 751532;
|
|
49426
|
+
};
|
|
49427
|
+
readonly ensRegistry: {
|
|
49428
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
49429
|
+
};
|
|
49430
|
+
readonly ensUniversalResolver: {
|
|
49431
|
+
readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
|
|
49432
|
+
readonly blockCreated: 5317080;
|
|
49433
|
+
};
|
|
49434
|
+
};
|
|
49435
|
+
ensTlds?: readonly string[] | undefined;
|
|
49436
|
+
id: 11155111;
|
|
49437
|
+
name: "Sepolia";
|
|
49438
|
+
nativeCurrency: {
|
|
49439
|
+
readonly name: "Sepolia Ether";
|
|
49440
|
+
readonly symbol: "ETH";
|
|
49441
|
+
readonly decimals: 18;
|
|
49442
|
+
};
|
|
49443
|
+
rpcUrls: {
|
|
49444
|
+
readonly default: {
|
|
49445
|
+
readonly http: readonly ["https://sepolia.drpc.org"];
|
|
49446
|
+
};
|
|
49447
|
+
};
|
|
49448
|
+
sourceId?: number | undefined | undefined;
|
|
49449
|
+
testnet: true;
|
|
49450
|
+
custom?: Record<string, unknown> | undefined;
|
|
49451
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
49452
|
+
formatters?: undefined;
|
|
49453
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
49454
49454
|
} | {
|
|
49455
49455
|
blockExplorers: {
|
|
49456
49456
|
readonly default: {
|
|
@@ -52944,7 +52944,7 @@ declare function sendRequest<TResponse = any, TBody = any>({ url, method, body,
|
|
|
52944
52944
|
declare function scheduleRecurringPaymentsAPICall(url: string, params: {
|
|
52945
52945
|
senderAddress: string;
|
|
52946
52946
|
receiverAddress: string;
|
|
52947
|
-
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137;
|
|
52947
|
+
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137 | 84532 | 11155111 | 80002;
|
|
52948
52948
|
tokenAddress: string;
|
|
52949
52949
|
amount: Hex;
|
|
52950
52950
|
amountExclusive: Hex;
|
|
@@ -52958,7 +52958,7 @@ declare function scheduleRecurringPaymentsAPICall(url: string, params: {
|
|
|
52958
52958
|
}): Promise<any>;
|
|
52959
52959
|
declare function executeSinglePaymentAPICall(url: string, userOperation: RpcUserOperation$1<"0.7">, paymentParams: {
|
|
52960
52960
|
signerAddress: Address;
|
|
52961
|
-
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137;
|
|
52961
|
+
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137 | 84532 | 11155111 | 80002;
|
|
52962
52962
|
token: Address;
|
|
52963
52963
|
amount: Hex;
|
|
52964
52964
|
receiver: Address;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const ActaAccessConfigSchema: z.ZodObject<{
|
|
|
22
22
|
}, z.core.$strip>;
|
|
23
23
|
declare const CreateSinglePaymentSchema: z.ZodObject<{
|
|
24
24
|
signerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
25
|
-
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
|
|
25
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>, z.ZodLiteral<84532>, z.ZodLiteral<11155111>, z.ZodLiteral<80002>]>;
|
|
26
26
|
publicClient: z.ZodCustom<{
|
|
27
27
|
account: undefined;
|
|
28
28
|
batch?: {
|
|
@@ -16097,7 +16097,7 @@ declare const CreateSinglePaymentSchema: z.ZodObject<{
|
|
|
16097
16097
|
}, z.core.$strip>;
|
|
16098
16098
|
declare const CreateRecurringPaymentSchema: z.ZodObject<{
|
|
16099
16099
|
signerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
16100
|
-
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
|
|
16100
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>, z.ZodLiteral<84532>, z.ZodLiteral<11155111>, z.ZodLiteral<80002>]>;
|
|
16101
16101
|
publicClient: z.ZodCustom<{
|
|
16102
16102
|
account: undefined;
|
|
16103
16103
|
batch?: {
|
|
@@ -32179,7 +32179,7 @@ declare const CreateRecurringPaymentSchema: z.ZodObject<{
|
|
|
32179
32179
|
}, z.core.$strip>;
|
|
32180
32180
|
declare const EstimateSinglePaymentGasSchema: z.ZodObject<{
|
|
32181
32181
|
signerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
32182
|
-
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
|
|
32182
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<42161>, z.ZodLiteral<8453>, z.ZodLiteral<59144>, z.ZodLiteral<56>, z.ZodLiteral<10>, z.ZodLiteral<137>, z.ZodLiteral<84532>, z.ZodLiteral<11155111>, z.ZodLiteral<80002>]>;
|
|
32183
32183
|
publicClient: z.ZodCustom<{
|
|
32184
32184
|
account: undefined;
|
|
32185
32185
|
batch?: {
|
|
@@ -49106,46 +49106,6 @@ declare const mainnetChains: ({
|
|
|
49106
49106
|
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
49107
49107
|
})[];
|
|
49108
49108
|
declare const testnetChains: ({
|
|
49109
|
-
blockExplorers: {
|
|
49110
|
-
readonly default: {
|
|
49111
|
-
readonly name: "Etherscan";
|
|
49112
|
-
readonly url: "https://sepolia.etherscan.io";
|
|
49113
|
-
readonly apiUrl: "https://api-sepolia.etherscan.io/api";
|
|
49114
|
-
};
|
|
49115
|
-
};
|
|
49116
|
-
contracts: {
|
|
49117
|
-
readonly multicall3: {
|
|
49118
|
-
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
49119
|
-
readonly blockCreated: 751532;
|
|
49120
|
-
};
|
|
49121
|
-
readonly ensRegistry: {
|
|
49122
|
-
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
49123
|
-
};
|
|
49124
|
-
readonly ensUniversalResolver: {
|
|
49125
|
-
readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
|
|
49126
|
-
readonly blockCreated: 5317080;
|
|
49127
|
-
};
|
|
49128
|
-
};
|
|
49129
|
-
ensTlds?: readonly string[] | undefined;
|
|
49130
|
-
id: 11155111;
|
|
49131
|
-
name: "Sepolia";
|
|
49132
|
-
nativeCurrency: {
|
|
49133
|
-
readonly name: "Sepolia Ether";
|
|
49134
|
-
readonly symbol: "ETH";
|
|
49135
|
-
readonly decimals: 18;
|
|
49136
|
-
};
|
|
49137
|
-
rpcUrls: {
|
|
49138
|
-
readonly default: {
|
|
49139
|
-
readonly http: readonly ["https://sepolia.drpc.org"];
|
|
49140
|
-
};
|
|
49141
|
-
};
|
|
49142
|
-
sourceId?: number | undefined | undefined;
|
|
49143
|
-
testnet: true;
|
|
49144
|
-
custom?: Record<string, unknown> | undefined;
|
|
49145
|
-
fees?: viem.ChainFees<undefined> | undefined;
|
|
49146
|
-
formatters?: undefined;
|
|
49147
|
-
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
49148
|
-
} | {
|
|
49149
49109
|
blockExplorers: {
|
|
49150
49110
|
readonly default: {
|
|
49151
49111
|
readonly name: "Basescan";
|
|
@@ -49451,6 +49411,46 @@ declare const testnetChains: ({
|
|
|
49451
49411
|
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
49452
49412
|
};
|
|
49453
49413
|
readonly network: "base-sepolia";
|
|
49414
|
+
} | {
|
|
49415
|
+
blockExplorers: {
|
|
49416
|
+
readonly default: {
|
|
49417
|
+
readonly name: "Etherscan";
|
|
49418
|
+
readonly url: "https://sepolia.etherscan.io";
|
|
49419
|
+
readonly apiUrl: "https://api-sepolia.etherscan.io/api";
|
|
49420
|
+
};
|
|
49421
|
+
};
|
|
49422
|
+
contracts: {
|
|
49423
|
+
readonly multicall3: {
|
|
49424
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
49425
|
+
readonly blockCreated: 751532;
|
|
49426
|
+
};
|
|
49427
|
+
readonly ensRegistry: {
|
|
49428
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
49429
|
+
};
|
|
49430
|
+
readonly ensUniversalResolver: {
|
|
49431
|
+
readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
|
|
49432
|
+
readonly blockCreated: 5317080;
|
|
49433
|
+
};
|
|
49434
|
+
};
|
|
49435
|
+
ensTlds?: readonly string[] | undefined;
|
|
49436
|
+
id: 11155111;
|
|
49437
|
+
name: "Sepolia";
|
|
49438
|
+
nativeCurrency: {
|
|
49439
|
+
readonly name: "Sepolia Ether";
|
|
49440
|
+
readonly symbol: "ETH";
|
|
49441
|
+
readonly decimals: 18;
|
|
49442
|
+
};
|
|
49443
|
+
rpcUrls: {
|
|
49444
|
+
readonly default: {
|
|
49445
|
+
readonly http: readonly ["https://sepolia.drpc.org"];
|
|
49446
|
+
};
|
|
49447
|
+
};
|
|
49448
|
+
sourceId?: number | undefined | undefined;
|
|
49449
|
+
testnet: true;
|
|
49450
|
+
custom?: Record<string, unknown> | undefined;
|
|
49451
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
49452
|
+
formatters?: undefined;
|
|
49453
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
49454
49454
|
} | {
|
|
49455
49455
|
blockExplorers: {
|
|
49456
49456
|
readonly default: {
|
|
@@ -52944,7 +52944,7 @@ declare function sendRequest<TResponse = any, TBody = any>({ url, method, body,
|
|
|
52944
52944
|
declare function scheduleRecurringPaymentsAPICall(url: string, params: {
|
|
52945
52945
|
senderAddress: string;
|
|
52946
52946
|
receiverAddress: string;
|
|
52947
|
-
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137;
|
|
52947
|
+
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137 | 84532 | 11155111 | 80002;
|
|
52948
52948
|
tokenAddress: string;
|
|
52949
52949
|
amount: Hex;
|
|
52950
52950
|
amountExclusive: Hex;
|
|
@@ -52958,7 +52958,7 @@ declare function scheduleRecurringPaymentsAPICall(url: string, params: {
|
|
|
52958
52958
|
}): Promise<any>;
|
|
52959
52959
|
declare function executeSinglePaymentAPICall(url: string, userOperation: RpcUserOperation$1<"0.7">, paymentParams: {
|
|
52960
52960
|
signerAddress: Address;
|
|
52961
|
-
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137;
|
|
52961
|
+
chainId: 1 | 42161 | 8453 | 59144 | 56 | 10 | 137 | 84532 | 11155111 | 80002;
|
|
52962
52962
|
token: Address;
|
|
52963
52963
|
amount: Hex;
|
|
52964
52964
|
receiver: Address;
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,10 @@ var supportedChains = [
|
|
|
62
62
|
bsc,
|
|
63
63
|
mainnet,
|
|
64
64
|
optimism,
|
|
65
|
-
polygon
|
|
65
|
+
polygon,
|
|
66
|
+
baseSepolia,
|
|
67
|
+
sepolia,
|
|
68
|
+
polygonAmoy
|
|
66
69
|
];
|
|
67
70
|
var mainnetChains = [arbitrum, base, bsc, mainnet, optimism, polygon];
|
|
68
71
|
var testnetChains = [sepolia, baseSepolia, polygonAmoy];
|
|
@@ -85,6 +88,12 @@ function getChainExplorerByChainId(chainId) {
|
|
|
85
88
|
return "https://optimistic.etherscan.io";
|
|
86
89
|
case polygon.id:
|
|
87
90
|
return "https://polygonscan.com";
|
|
91
|
+
case baseSepolia.id:
|
|
92
|
+
return "https://sepolia.basescan.org";
|
|
93
|
+
case sepolia.id:
|
|
94
|
+
return "https://sepolia.etherscan.io";
|
|
95
|
+
case polygonAmoy.id:
|
|
96
|
+
return "https://amoy.polygonscan.com";
|
|
88
97
|
default:
|
|
89
98
|
return void 0;
|
|
90
99
|
}
|
|
@@ -112,7 +121,10 @@ var CreateSinglePaymentSchema = z.object({
|
|
|
112
121
|
z.literal(59144),
|
|
113
122
|
z.literal(56),
|
|
114
123
|
z.literal(10),
|
|
115
|
-
z.literal(137)
|
|
124
|
+
z.literal(137),
|
|
125
|
+
z.literal(84532),
|
|
126
|
+
z.literal(11155111),
|
|
127
|
+
z.literal(80002)
|
|
116
128
|
]),
|
|
117
129
|
publicClient: z.custom(
|
|
118
130
|
(val) => val !== void 0,
|
|
@@ -140,7 +152,10 @@ var CreateRecurringPaymentSchema = z.object({
|
|
|
140
152
|
z.literal(59144),
|
|
141
153
|
z.literal(56),
|
|
142
154
|
z.literal(10),
|
|
143
|
-
z.literal(137)
|
|
155
|
+
z.literal(137),
|
|
156
|
+
z.literal(84532),
|
|
157
|
+
z.literal(11155111),
|
|
158
|
+
z.literal(80002)
|
|
144
159
|
]),
|
|
145
160
|
publicClient: z.custom(
|
|
146
161
|
(val) => val !== void 0,
|
|
@@ -170,7 +185,10 @@ var EstimateSinglePaymentGasSchema = z.object({
|
|
|
170
185
|
z.literal(59144),
|
|
171
186
|
z.literal(56),
|
|
172
187
|
z.literal(10),
|
|
173
|
-
z.literal(137)
|
|
188
|
+
z.literal(137),
|
|
189
|
+
z.literal(84532),
|
|
190
|
+
z.literal(11155111),
|
|
191
|
+
z.literal(80002)
|
|
174
192
|
]),
|
|
175
193
|
publicClient: z.custom(
|
|
176
194
|
(val) => val !== void 0,
|
|
@@ -520,6 +538,7 @@ var polygonAmoyUSDC = token({
|
|
|
520
538
|
symbol: "USDC",
|
|
521
539
|
logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
|
|
522
540
|
});
|
|
541
|
+
var polygonAmoyTokens = [polygonAmoyUSDC];
|
|
523
542
|
var baseSepoliaUSDC = token({
|
|
524
543
|
chainId: baseSepolia2.id,
|
|
525
544
|
address: getAddress("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
@@ -529,6 +548,7 @@ var baseSepoliaUSDC = token({
|
|
|
529
548
|
symbol: "USDC",
|
|
530
549
|
logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
|
|
531
550
|
});
|
|
551
|
+
var baseSepoliaTokens = [baseSepoliaUSDC];
|
|
532
552
|
var sepoliaUSDC = token({
|
|
533
553
|
chainId: sepolia2.id,
|
|
534
554
|
address: getAddress("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
@@ -538,6 +558,7 @@ var sepoliaUSDC = token({
|
|
|
538
558
|
symbol: "USDC",
|
|
539
559
|
logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
|
|
540
560
|
});
|
|
561
|
+
var sepoliaTokens = [sepoliaUSDC];
|
|
541
562
|
var supportedTokensByChain = /* @__PURE__ */ new Map([
|
|
542
563
|
[arbitrum2.id, arbitrumTokens],
|
|
543
564
|
//done
|
|
@@ -549,7 +570,14 @@ var supportedTokensByChain = /* @__PURE__ */ new Map([
|
|
|
549
570
|
//done
|
|
550
571
|
[optimism2.id, optimismTokens],
|
|
551
572
|
//done
|
|
552
|
-
[polygon2.id, polygonTokens]
|
|
573
|
+
[polygon2.id, polygonTokens],
|
|
574
|
+
//done
|
|
575
|
+
[sepolia2.id, sepoliaTokens],
|
|
576
|
+
//done
|
|
577
|
+
[polygonAmoy2.id, polygonAmoyTokens],
|
|
578
|
+
//done
|
|
579
|
+
[baseSepolia2.id, baseSepoliaTokens]
|
|
580
|
+
//done
|
|
553
581
|
]);
|
|
554
582
|
function nativeETH(chainId) {
|
|
555
583
|
return nativeToken({
|
|
@@ -1242,8 +1270,25 @@ import { toHex } from "viem";
|
|
|
1242
1270
|
|
|
1243
1271
|
// src/constants.ts
|
|
1244
1272
|
var ACCESS_URL = "https://api.acta.link/deposit";
|
|
1273
|
+
var ACCESS_TESTNET_URL = "https://api.acta.link/deposit/test";
|
|
1245
1274
|
|
|
1246
1275
|
// src/execution/access.ts
|
|
1276
|
+
var returnEnvUrl = (chainId) => {
|
|
1277
|
+
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
1278
|
+
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
1279
|
+
if (!mainnetChain && !testnetChain) {
|
|
1280
|
+
throw new Error(`Chain ${chainId} not supported.`);
|
|
1281
|
+
}
|
|
1282
|
+
if (mainnetChain) {
|
|
1283
|
+
return {
|
|
1284
|
+
envAccessURL: ACCESS_URL
|
|
1285
|
+
};
|
|
1286
|
+
} else {
|
|
1287
|
+
return {
|
|
1288
|
+
envAccessURL: ACCESS_TESTNET_URL
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1247
1292
|
var getPeriodInterval = (periodUnit) => {
|
|
1248
1293
|
switch (periodUnit) {
|
|
1249
1294
|
case "5mins":
|
|
@@ -1302,6 +1347,7 @@ function createOnetimePaymentInternal(parameters) {
|
|
|
1302
1347
|
if (!token2) {
|
|
1303
1348
|
throw new Error("Token not supported.");
|
|
1304
1349
|
}
|
|
1350
|
+
const { envAccessURL } = returnEnvUrl(chainId);
|
|
1305
1351
|
const accountInstance = new ActaAccount(publicClient, walletClient);
|
|
1306
1352
|
const rpcParameters = yield accountInstance.signSinglePaymentOperation({
|
|
1307
1353
|
signerAddress,
|
|
@@ -1316,7 +1362,7 @@ function createOnetimePaymentInternal(parameters) {
|
|
|
1316
1362
|
walletClient
|
|
1317
1363
|
});
|
|
1318
1364
|
const data = yield executeSinglePaymentAPICall(
|
|
1319
|
-
`${
|
|
1365
|
+
`${envAccessURL}/api/v1/execute/single`,
|
|
1320
1366
|
rpcParameters,
|
|
1321
1367
|
{
|
|
1322
1368
|
amount: toHex(amount),
|
|
@@ -1351,6 +1397,7 @@ function createRecurringePaymentInternal(parameters) {
|
|
|
1351
1397
|
if (!token2) {
|
|
1352
1398
|
throw new Error("Token not supported.");
|
|
1353
1399
|
}
|
|
1400
|
+
const { envAccessURL } = returnEnvUrl(chainId);
|
|
1354
1401
|
const accountInstance = new ActaAccount(publicClient, walletClient);
|
|
1355
1402
|
const { approval, amountExclusive } = yield accountInstance.signRecurringPayments({
|
|
1356
1403
|
signerAddress,
|
|
@@ -1368,7 +1415,7 @@ function createRecurringePaymentInternal(parameters) {
|
|
|
1368
1415
|
});
|
|
1369
1416
|
const startAt = Math.floor(Date.now() / 1e3) + 2 * 60;
|
|
1370
1417
|
const data = yield scheduleRecurringPaymentsAPICall(
|
|
1371
|
-
`${
|
|
1418
|
+
`${envAccessURL}/api/v1/schedule/recurring`,
|
|
1372
1419
|
{
|
|
1373
1420
|
senderAddress: signerAddress,
|
|
1374
1421
|
receiverAddress: receiver,
|
|
@@ -1446,8 +1493,9 @@ var ActaAccessSDK = class {
|
|
|
1446
1493
|
return __async(this, null, function* () {
|
|
1447
1494
|
try {
|
|
1448
1495
|
const result = PollPaymentStatusSchema.parse({ id });
|
|
1496
|
+
const envType = id.split("_")[1];
|
|
1449
1497
|
return yield waitForPaymentStatus(
|
|
1450
|
-
`${ACCESS_URL}/api/v1/payment/status`,
|
|
1498
|
+
`${envType !== "test" ? ACCESS_URL : ACCESS_TESTNET_URL}/api/v1/payment/status`,
|
|
1451
1499
|
result.id,
|
|
1452
1500
|
intervalMs
|
|
1453
1501
|
);
|