@actalink/commonlib 0.0.16 → 0.0.17
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 +120 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +120 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1192,7 +1192,7 @@ var ActaAccount = class {
|
|
|
1192
1192
|
args: [
|
|
1193
1193
|
fromAddress,
|
|
1194
1194
|
"0x26eeCa5956Bf8C01040BAC9e6D7982a0e87F31B4",
|
|
1195
|
-
|
|
1195
|
+
estimatedTotalFeesInToken
|
|
1196
1196
|
]
|
|
1197
1197
|
}
|
|
1198
1198
|
]
|
|
@@ -2687,6 +2687,125 @@ var ActaBatch = class {
|
|
|
2687
2687
|
}
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
|
+
createSingleBatchPaymentWithoutKey(params, serviceParams) {
|
|
2691
|
+
return __async(this, null, function* () {
|
|
2692
|
+
try {
|
|
2693
|
+
const {
|
|
2694
|
+
chainId,
|
|
2695
|
+
feeInclusive,
|
|
2696
|
+
signerAddress,
|
|
2697
|
+
token: tokenSymbol,
|
|
2698
|
+
walletClient,
|
|
2699
|
+
allowMaxTokenApproval,
|
|
2700
|
+
receivers,
|
|
2701
|
+
totalAmount
|
|
2702
|
+
} = params;
|
|
2703
|
+
let isFeeInclusive = false;
|
|
2704
|
+
if (feeInclusive) {
|
|
2705
|
+
isFeeInclusive = true;
|
|
2706
|
+
}
|
|
2707
|
+
const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
|
|
2708
|
+
if (!tokenData) {
|
|
2709
|
+
throw new Error("Token not supported");
|
|
2710
|
+
}
|
|
2711
|
+
const viemClient = new ViemClient(chainId, walletClient);
|
|
2712
|
+
const account = new ActaAccount(
|
|
2713
|
+
chainId,
|
|
2714
|
+
viemClient.publicClient(),
|
|
2715
|
+
walletClient
|
|
2716
|
+
);
|
|
2717
|
+
console.log("signing");
|
|
2718
|
+
const rpcParameters = yield account.signSingleBatchOperation({
|
|
2719
|
+
signerAddress,
|
|
2720
|
+
chainId,
|
|
2721
|
+
token: tokenSymbol,
|
|
2722
|
+
feeInclusive: isFeeInclusive,
|
|
2723
|
+
receivers,
|
|
2724
|
+
totalAmount,
|
|
2725
|
+
walletClient,
|
|
2726
|
+
allowMaxTokenApproval,
|
|
2727
|
+
feebps: 20
|
|
2728
|
+
});
|
|
2729
|
+
return {
|
|
2730
|
+
senderAddress: signerAddress,
|
|
2731
|
+
chainId,
|
|
2732
|
+
tokenAddress: tokenData.address,
|
|
2733
|
+
amount: (0, import_viem7.toHex)(totalAmount),
|
|
2734
|
+
feeInclusive: isFeeInclusive,
|
|
2735
|
+
serviceType: "batch",
|
|
2736
|
+
sessionId: serviceParams.sessionId,
|
|
2737
|
+
rpcParameters
|
|
2738
|
+
};
|
|
2739
|
+
} catch (error) {
|
|
2740
|
+
if (error instanceof Error) {
|
|
2741
|
+
throw new Error(error.message);
|
|
2742
|
+
}
|
|
2743
|
+
throw new Error("Failed to create payment.");
|
|
2744
|
+
}
|
|
2745
|
+
});
|
|
2746
|
+
}
|
|
2747
|
+
createScheduleBatchPaymentWithoutKey(params, serviceParams) {
|
|
2748
|
+
return __async(this, null, function* () {
|
|
2749
|
+
try {
|
|
2750
|
+
const {
|
|
2751
|
+
chainId,
|
|
2752
|
+
feeInclusive,
|
|
2753
|
+
signerAddress,
|
|
2754
|
+
token: tokenSymbol,
|
|
2755
|
+
walletClient,
|
|
2756
|
+
allowMaxTokenApproval,
|
|
2757
|
+
executionTime,
|
|
2758
|
+
receivers,
|
|
2759
|
+
totalAmount
|
|
2760
|
+
} = params;
|
|
2761
|
+
let isFeeInclusive = false;
|
|
2762
|
+
if (feeInclusive) {
|
|
2763
|
+
isFeeInclusive = true;
|
|
2764
|
+
}
|
|
2765
|
+
const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
|
|
2766
|
+
if (!tokenData) {
|
|
2767
|
+
throw new Error("Token not supported");
|
|
2768
|
+
}
|
|
2769
|
+
const viemClient = new ViemClient(chainId, walletClient);
|
|
2770
|
+
const account = new ActaAccount(
|
|
2771
|
+
chainId,
|
|
2772
|
+
viemClient.publicClient(),
|
|
2773
|
+
walletClient
|
|
2774
|
+
);
|
|
2775
|
+
console.log("signing");
|
|
2776
|
+
const { amountExclusive, approval } = yield account.signRecurringOrScheduleBatchPayments({
|
|
2777
|
+
signerAddress,
|
|
2778
|
+
chainId,
|
|
2779
|
+
token: tokenSymbol,
|
|
2780
|
+
feeInclusive: isFeeInclusive,
|
|
2781
|
+
receivers,
|
|
2782
|
+
totalAmount,
|
|
2783
|
+
walletClient,
|
|
2784
|
+
allowMaxTokenApproval,
|
|
2785
|
+
count: 1,
|
|
2786
|
+
feebps: 20
|
|
2787
|
+
});
|
|
2788
|
+
return {
|
|
2789
|
+
senderAddress: signerAddress,
|
|
2790
|
+
chainId,
|
|
2791
|
+
tokenAddress: tokenData.address,
|
|
2792
|
+
amount: (0, import_viem7.toHex)(totalAmount),
|
|
2793
|
+
feeInclusive: isFeeInclusive,
|
|
2794
|
+
serviceType: "batch",
|
|
2795
|
+
amountExclusive: (0, import_viem7.toHex)(amountExclusive),
|
|
2796
|
+
approval,
|
|
2797
|
+
executionAt: executionTime,
|
|
2798
|
+
sessionId: serviceParams.sessionId
|
|
2799
|
+
};
|
|
2800
|
+
} catch (error) {
|
|
2801
|
+
console.log(error);
|
|
2802
|
+
if (error instanceof Error) {
|
|
2803
|
+
throw new Error(error.message);
|
|
2804
|
+
}
|
|
2805
|
+
throw new Error("Failed to create payment.");
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2690
2809
|
};
|
|
2691
2810
|
|
|
2692
2811
|
// src/utils.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -166,9 +166,23 @@ type SingleBatchPaymentClassParamsType = Omit<AbstractPaymentParams, "connectorT
|
|
|
166
166
|
token: "USDC" | "USDT";
|
|
167
167
|
instructionId: string;
|
|
168
168
|
};
|
|
169
|
+
type SingleBatchPaymentWithoutKeyClassParamsType = Omit<SingleBatchPaymentClassParamsType, "instructionId"> & {
|
|
170
|
+
receivers: {
|
|
171
|
+
address: Address;
|
|
172
|
+
amount: bigint;
|
|
173
|
+
}[];
|
|
174
|
+
totalAmount: bigint;
|
|
175
|
+
};
|
|
169
176
|
type ScheduleBatchPaymentClassParamsType = SingleBatchPaymentClassParamsType & {
|
|
170
177
|
executionTime: number;
|
|
171
178
|
};
|
|
179
|
+
type ScheduleBatchPaymentWithoutKeyClassParamsType = Omit<ScheduleBatchPaymentClassParamsType, "instructionId"> & {
|
|
180
|
+
receivers: {
|
|
181
|
+
address: Address;
|
|
182
|
+
amount: bigint;
|
|
183
|
+
}[];
|
|
184
|
+
totalAmount: bigint;
|
|
185
|
+
};
|
|
172
186
|
type RecurringPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "serviceUrl" | "serviceSessionParams"> & {
|
|
173
187
|
endDate?: number;
|
|
174
188
|
allowMaxTokenApproval?: boolean;
|
|
@@ -1519,6 +1533,32 @@ declare class ActaBatch {
|
|
|
1519
1533
|
createScheduleBatchPayment(params: ScheduleBatchPaymentClassParamsType, serviceParams: {
|
|
1520
1534
|
sessionId: string;
|
|
1521
1535
|
}): Promise<any>;
|
|
1536
|
+
createSingleBatchPaymentWithoutKey(params: SingleBatchPaymentWithoutKeyClassParamsType, serviceParams: {
|
|
1537
|
+
sessionId: string;
|
|
1538
|
+
}): Promise<{
|
|
1539
|
+
senderAddress: `0x${string}` | undefined;
|
|
1540
|
+
chainId: 80002 | 42161 | 8453 | 56 | 1 | 10 | 137 | 84532 | 11155111 | 59144;
|
|
1541
|
+
tokenAddress: `0x${string}`;
|
|
1542
|
+
amount: `0x${string}`;
|
|
1543
|
+
feeInclusive: boolean;
|
|
1544
|
+
serviceType: string;
|
|
1545
|
+
sessionId: string;
|
|
1546
|
+
rpcParameters: viem.RpcUserOperation;
|
|
1547
|
+
}>;
|
|
1548
|
+
createScheduleBatchPaymentWithoutKey(params: ScheduleBatchPaymentWithoutKeyClassParamsType, serviceParams: {
|
|
1549
|
+
sessionId: string;
|
|
1550
|
+
}): Promise<{
|
|
1551
|
+
senderAddress: `0x${string}` | undefined;
|
|
1552
|
+
chainId: 80002 | 42161 | 8453 | 56 | 1 | 10 | 137 | 84532 | 11155111 | 59144;
|
|
1553
|
+
tokenAddress: `0x${string}`;
|
|
1554
|
+
amount: `0x${string}`;
|
|
1555
|
+
feeInclusive: boolean;
|
|
1556
|
+
serviceType: string;
|
|
1557
|
+
amountExclusive: `0x${string}`;
|
|
1558
|
+
approval: string;
|
|
1559
|
+
executionAt: number;
|
|
1560
|
+
sessionId: string;
|
|
1561
|
+
}>;
|
|
1522
1562
|
}
|
|
1523
1563
|
|
|
1524
1564
|
declare class ActaAccount {
|
|
@@ -12022,4 +12062,4 @@ declare function createBatchSessionAPICall(url: string, APIKey: string, params:
|
|
|
12022
12062
|
}): Promise<any>;
|
|
12023
12063
|
declare function fetchBatchInstructionDetails(url: string, APIKey: string): Promise<any>;
|
|
12024
12064
|
|
|
12025
|
-
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
|
12065
|
+
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleBatchPaymentWithoutKeyClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SingleBatchPaymentWithoutKeyClassParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
package/dist/index.d.ts
CHANGED
|
@@ -166,9 +166,23 @@ type SingleBatchPaymentClassParamsType = Omit<AbstractPaymentParams, "connectorT
|
|
|
166
166
|
token: "USDC" | "USDT";
|
|
167
167
|
instructionId: string;
|
|
168
168
|
};
|
|
169
|
+
type SingleBatchPaymentWithoutKeyClassParamsType = Omit<SingleBatchPaymentClassParamsType, "instructionId"> & {
|
|
170
|
+
receivers: {
|
|
171
|
+
address: Address;
|
|
172
|
+
amount: bigint;
|
|
173
|
+
}[];
|
|
174
|
+
totalAmount: bigint;
|
|
175
|
+
};
|
|
169
176
|
type ScheduleBatchPaymentClassParamsType = SingleBatchPaymentClassParamsType & {
|
|
170
177
|
executionTime: number;
|
|
171
178
|
};
|
|
179
|
+
type ScheduleBatchPaymentWithoutKeyClassParamsType = Omit<ScheduleBatchPaymentClassParamsType, "instructionId"> & {
|
|
180
|
+
receivers: {
|
|
181
|
+
address: Address;
|
|
182
|
+
amount: bigint;
|
|
183
|
+
}[];
|
|
184
|
+
totalAmount: bigint;
|
|
185
|
+
};
|
|
172
186
|
type RecurringPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "serviceUrl" | "serviceSessionParams"> & {
|
|
173
187
|
endDate?: number;
|
|
174
188
|
allowMaxTokenApproval?: boolean;
|
|
@@ -1519,6 +1533,32 @@ declare class ActaBatch {
|
|
|
1519
1533
|
createScheduleBatchPayment(params: ScheduleBatchPaymentClassParamsType, serviceParams: {
|
|
1520
1534
|
sessionId: string;
|
|
1521
1535
|
}): Promise<any>;
|
|
1536
|
+
createSingleBatchPaymentWithoutKey(params: SingleBatchPaymentWithoutKeyClassParamsType, serviceParams: {
|
|
1537
|
+
sessionId: string;
|
|
1538
|
+
}): Promise<{
|
|
1539
|
+
senderAddress: `0x${string}` | undefined;
|
|
1540
|
+
chainId: 80002 | 42161 | 8453 | 56 | 1 | 10 | 137 | 84532 | 11155111 | 59144;
|
|
1541
|
+
tokenAddress: `0x${string}`;
|
|
1542
|
+
amount: `0x${string}`;
|
|
1543
|
+
feeInclusive: boolean;
|
|
1544
|
+
serviceType: string;
|
|
1545
|
+
sessionId: string;
|
|
1546
|
+
rpcParameters: viem.RpcUserOperation;
|
|
1547
|
+
}>;
|
|
1548
|
+
createScheduleBatchPaymentWithoutKey(params: ScheduleBatchPaymentWithoutKeyClassParamsType, serviceParams: {
|
|
1549
|
+
sessionId: string;
|
|
1550
|
+
}): Promise<{
|
|
1551
|
+
senderAddress: `0x${string}` | undefined;
|
|
1552
|
+
chainId: 80002 | 42161 | 8453 | 56 | 1 | 10 | 137 | 84532 | 11155111 | 59144;
|
|
1553
|
+
tokenAddress: `0x${string}`;
|
|
1554
|
+
amount: `0x${string}`;
|
|
1555
|
+
feeInclusive: boolean;
|
|
1556
|
+
serviceType: string;
|
|
1557
|
+
amountExclusive: `0x${string}`;
|
|
1558
|
+
approval: string;
|
|
1559
|
+
executionAt: number;
|
|
1560
|
+
sessionId: string;
|
|
1561
|
+
}>;
|
|
1522
1562
|
}
|
|
1523
1563
|
|
|
1524
1564
|
declare class ActaAccount {
|
|
@@ -12022,4 +12062,4 @@ declare function createBatchSessionAPICall(url: string, APIKey: string, params:
|
|
|
12022
12062
|
}): Promise<any>;
|
|
12023
12063
|
declare function fetchBatchInstructionDetails(url: string, APIKey: string): Promise<any>;
|
|
12024
12064
|
|
|
12025
|
-
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
|
12065
|
+
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleBatchPaymentWithoutKeyClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SingleBatchPaymentWithoutKeyClassParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
package/dist/index.js
CHANGED
|
@@ -1119,7 +1119,7 @@ var ActaAccount = class {
|
|
|
1119
1119
|
args: [
|
|
1120
1120
|
fromAddress,
|
|
1121
1121
|
"0x26eeCa5956Bf8C01040BAC9e6D7982a0e87F31B4",
|
|
1122
|
-
|
|
1122
|
+
estimatedTotalFeesInToken
|
|
1123
1123
|
]
|
|
1124
1124
|
}
|
|
1125
1125
|
]
|
|
@@ -2619,6 +2619,125 @@ var ActaBatch = class {
|
|
|
2619
2619
|
}
|
|
2620
2620
|
});
|
|
2621
2621
|
}
|
|
2622
|
+
createSingleBatchPaymentWithoutKey(params, serviceParams) {
|
|
2623
|
+
return __async(this, null, function* () {
|
|
2624
|
+
try {
|
|
2625
|
+
const {
|
|
2626
|
+
chainId,
|
|
2627
|
+
feeInclusive,
|
|
2628
|
+
signerAddress,
|
|
2629
|
+
token: tokenSymbol,
|
|
2630
|
+
walletClient,
|
|
2631
|
+
allowMaxTokenApproval,
|
|
2632
|
+
receivers,
|
|
2633
|
+
totalAmount
|
|
2634
|
+
} = params;
|
|
2635
|
+
let isFeeInclusive = false;
|
|
2636
|
+
if (feeInclusive) {
|
|
2637
|
+
isFeeInclusive = true;
|
|
2638
|
+
}
|
|
2639
|
+
const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
|
|
2640
|
+
if (!tokenData) {
|
|
2641
|
+
throw new Error("Token not supported");
|
|
2642
|
+
}
|
|
2643
|
+
const viemClient = new ViemClient(chainId, walletClient);
|
|
2644
|
+
const account = new ActaAccount(
|
|
2645
|
+
chainId,
|
|
2646
|
+
viemClient.publicClient(),
|
|
2647
|
+
walletClient
|
|
2648
|
+
);
|
|
2649
|
+
console.log("signing");
|
|
2650
|
+
const rpcParameters = yield account.signSingleBatchOperation({
|
|
2651
|
+
signerAddress,
|
|
2652
|
+
chainId,
|
|
2653
|
+
token: tokenSymbol,
|
|
2654
|
+
feeInclusive: isFeeInclusive,
|
|
2655
|
+
receivers,
|
|
2656
|
+
totalAmount,
|
|
2657
|
+
walletClient,
|
|
2658
|
+
allowMaxTokenApproval,
|
|
2659
|
+
feebps: 20
|
|
2660
|
+
});
|
|
2661
|
+
return {
|
|
2662
|
+
senderAddress: signerAddress,
|
|
2663
|
+
chainId,
|
|
2664
|
+
tokenAddress: tokenData.address,
|
|
2665
|
+
amount: toHex4(totalAmount),
|
|
2666
|
+
feeInclusive: isFeeInclusive,
|
|
2667
|
+
serviceType: "batch",
|
|
2668
|
+
sessionId: serviceParams.sessionId,
|
|
2669
|
+
rpcParameters
|
|
2670
|
+
};
|
|
2671
|
+
} catch (error) {
|
|
2672
|
+
if (error instanceof Error) {
|
|
2673
|
+
throw new Error(error.message);
|
|
2674
|
+
}
|
|
2675
|
+
throw new Error("Failed to create payment.");
|
|
2676
|
+
}
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
createScheduleBatchPaymentWithoutKey(params, serviceParams) {
|
|
2680
|
+
return __async(this, null, function* () {
|
|
2681
|
+
try {
|
|
2682
|
+
const {
|
|
2683
|
+
chainId,
|
|
2684
|
+
feeInclusive,
|
|
2685
|
+
signerAddress,
|
|
2686
|
+
token: tokenSymbol,
|
|
2687
|
+
walletClient,
|
|
2688
|
+
allowMaxTokenApproval,
|
|
2689
|
+
executionTime,
|
|
2690
|
+
receivers,
|
|
2691
|
+
totalAmount
|
|
2692
|
+
} = params;
|
|
2693
|
+
let isFeeInclusive = false;
|
|
2694
|
+
if (feeInclusive) {
|
|
2695
|
+
isFeeInclusive = true;
|
|
2696
|
+
}
|
|
2697
|
+
const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
|
|
2698
|
+
if (!tokenData) {
|
|
2699
|
+
throw new Error("Token not supported");
|
|
2700
|
+
}
|
|
2701
|
+
const viemClient = new ViemClient(chainId, walletClient);
|
|
2702
|
+
const account = new ActaAccount(
|
|
2703
|
+
chainId,
|
|
2704
|
+
viemClient.publicClient(),
|
|
2705
|
+
walletClient
|
|
2706
|
+
);
|
|
2707
|
+
console.log("signing");
|
|
2708
|
+
const { amountExclusive, approval } = yield account.signRecurringOrScheduleBatchPayments({
|
|
2709
|
+
signerAddress,
|
|
2710
|
+
chainId,
|
|
2711
|
+
token: tokenSymbol,
|
|
2712
|
+
feeInclusive: isFeeInclusive,
|
|
2713
|
+
receivers,
|
|
2714
|
+
totalAmount,
|
|
2715
|
+
walletClient,
|
|
2716
|
+
allowMaxTokenApproval,
|
|
2717
|
+
count: 1,
|
|
2718
|
+
feebps: 20
|
|
2719
|
+
});
|
|
2720
|
+
return {
|
|
2721
|
+
senderAddress: signerAddress,
|
|
2722
|
+
chainId,
|
|
2723
|
+
tokenAddress: tokenData.address,
|
|
2724
|
+
amount: toHex4(totalAmount),
|
|
2725
|
+
feeInclusive: isFeeInclusive,
|
|
2726
|
+
serviceType: "batch",
|
|
2727
|
+
amountExclusive: toHex4(amountExclusive),
|
|
2728
|
+
approval,
|
|
2729
|
+
executionAt: executionTime,
|
|
2730
|
+
sessionId: serviceParams.sessionId
|
|
2731
|
+
};
|
|
2732
|
+
} catch (error) {
|
|
2733
|
+
console.log(error);
|
|
2734
|
+
if (error instanceof Error) {
|
|
2735
|
+
throw new Error(error.message);
|
|
2736
|
+
}
|
|
2737
|
+
throw new Error("Failed to create payment.");
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2622
2741
|
};
|
|
2623
2742
|
|
|
2624
2743
|
// src/utils.ts
|