@otim/utils 0.0.2 → 0.0.3
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/api/index.js +12 -7
- package/dist/api/index.js.map +2 -2
- package/dist/api/index.mjs +12 -7
- package/dist/api/index.mjs.map +2 -2
- package/dist/api/schemas/payments.d.mts +3 -0
- package/dist/api/schemas/payments.d.ts +3 -0
- package/dist/api/schemas/payments.d.ts.map +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/chains/index.mjs +1 -1
- package/dist/helpers/index.js +21 -1
- package/dist/helpers/index.js.map +2 -2
- package/dist/helpers/index.mjs +21 -1
- package/dist/helpers/index.mjs.map +2 -2
- package/dist/helpers/zod.d.mts +21 -0
- package/dist/helpers/zod.d.ts +21 -0
- package/dist/helpers/zod.d.ts.map +1 -1
- package/dist/payments/build.d.mts +1 -0
- package/dist/payments/build.d.ts +1 -0
- package/dist/payments/build.d.ts.map +1 -1
- package/dist/payments/comprehensive-payment-request.d.mts +1 -0
- package/dist/payments/comprehensive-payment-request.d.ts +1 -0
- package/dist/payments/comprehensive-payment-request.d.ts.map +1 -1
- package/dist/payments/index.js +16 -12
- package/dist/payments/index.js.map +2 -2
- package/dist/payments/index.mjs +16 -12
- package/dist/payments/index.mjs.map +2 -2
- package/dist/server/index.js +4 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +4 -4
- package/dist/server/index.mjs.map +1 -1
- package/dist/wallet/wagmi/index.js +1 -1
- package/dist/wallet/wagmi/index.mjs +1 -1
- package/package.json +3 -3
package/dist/payments/index.js
CHANGED
|
@@ -178,13 +178,15 @@ function createPaymentRequestBuildPayload(params) {
|
|
|
178
178
|
payerAddress = null,
|
|
179
179
|
completionInstructions,
|
|
180
180
|
instructions = [],
|
|
181
|
-
metadata = {}
|
|
181
|
+
metadata = {},
|
|
182
|
+
maxRuns
|
|
182
183
|
} = params;
|
|
183
184
|
return {
|
|
184
185
|
payerAddress,
|
|
185
186
|
completionInstructions: completionInstructions.map(processInstruction),
|
|
186
187
|
instructions: instructions.map(processInstruction),
|
|
187
|
-
metadata
|
|
188
|
+
metadata,
|
|
189
|
+
maxRuns
|
|
188
190
|
};
|
|
189
191
|
}
|
|
190
192
|
function processInstruction(spec) {
|
|
@@ -295,7 +297,8 @@ function createComprehensivePaymentRequest(params) {
|
|
|
295
297
|
payerAddress,
|
|
296
298
|
metadata,
|
|
297
299
|
feeToken,
|
|
298
|
-
cctpConfig = defaultCCTPConfig
|
|
300
|
+
cctpConfig = defaultCCTPConfig,
|
|
301
|
+
maxRuns = 1
|
|
299
302
|
} = params;
|
|
300
303
|
validateSettlementChainSupport(settlementChainId, cctpConfig);
|
|
301
304
|
const settlementConfig = findChainConfig(
|
|
@@ -324,7 +327,8 @@ function createComprehensivePaymentRequest(params) {
|
|
|
324
327
|
payerAddress,
|
|
325
328
|
completionInstructions,
|
|
326
329
|
instructions,
|
|
327
|
-
metadata
|
|
330
|
+
metadata,
|
|
331
|
+
maxRuns
|
|
328
332
|
});
|
|
329
333
|
}
|
|
330
334
|
function validateSettlementChainSupport(chainId, cctpConfig) {
|
|
@@ -382,10 +386,10 @@ function createCompletionInstructions(settlementChainId, settlementUSDCAddress,
|
|
|
382
386
|
function createSettlementSweepInstruction(chainId, tokenAddress, recipient, threshold, fee) {
|
|
383
387
|
return {
|
|
384
388
|
chainId,
|
|
385
|
-
maxExecutions:
|
|
389
|
+
maxExecutions: 0,
|
|
386
390
|
actionArguments: createSweepERC20ActionArguments({
|
|
387
391
|
chainId,
|
|
388
|
-
maxExecutions:
|
|
392
|
+
maxExecutions: 0,
|
|
389
393
|
token: tokenAddress,
|
|
390
394
|
target: recipient,
|
|
391
395
|
threshold,
|
|
@@ -453,10 +457,10 @@ function createSwapInstructionWithFloor(chainId, tokenIn, tokenOut, recipient, t
|
|
|
453
457
|
const floorAmountOut = afterFeeAmount * BigInt(1e4 - slippageBps) / 10000n;
|
|
454
458
|
const instruction = {
|
|
455
459
|
chainId,
|
|
456
|
-
maxExecutions:
|
|
460
|
+
maxExecutions: 0,
|
|
457
461
|
actionArguments: createSweepUniswapV3ActionArguments({
|
|
458
462
|
chainId,
|
|
459
|
-
maxExecutions:
|
|
463
|
+
maxExecutions: 0,
|
|
460
464
|
recipient,
|
|
461
465
|
tokenIn: tokenIn.address,
|
|
462
466
|
tokenOut: tokenOut.address,
|
|
@@ -485,10 +489,10 @@ function createCrossChainSwapInstructions(chainConfig, chainUSDC, ephemeralWalle
|
|
|
485
489
|
const maxPriceDeviationBps = sourceToken.symbol.toUpperCase() === USDT_SYMBOL ? USDT_MAX_PRICE_DEVIATION_BPS : DEFAULT_MAX_PRICE_DEVIATION_BPS;
|
|
486
490
|
const instruction = {
|
|
487
491
|
chainId: chainConfig.chainId,
|
|
488
|
-
maxExecutions:
|
|
492
|
+
maxExecutions: 0,
|
|
489
493
|
actionArguments: createSweepUniswapV3ActionArguments({
|
|
490
494
|
chainId: chainConfig.chainId,
|
|
491
|
-
maxExecutions:
|
|
495
|
+
maxExecutions: 0,
|
|
492
496
|
recipient: ephemeralWalletAddress,
|
|
493
497
|
tokenIn: sourceToken.address,
|
|
494
498
|
tokenOut: chainUSDC.address,
|
|
@@ -541,10 +545,10 @@ function createCrossChainInstructions(chainTokenConfigs, settlementChainId, ephe
|
|
|
541
545
|
function createCCTPBridgeInstruction(sourceChainId, tokenAddress, destinationChainId, ephemeralWalletAddress, threshold, fee, cctpConfig) {
|
|
542
546
|
return {
|
|
543
547
|
chainId: sourceChainId,
|
|
544
|
-
maxExecutions:
|
|
548
|
+
maxExecutions: 0,
|
|
545
549
|
actionArguments: createSweepCCTPActionArguments({
|
|
546
550
|
chainId: sourceChainId,
|
|
547
|
-
maxExecutions:
|
|
551
|
+
maxExecutions: 0,
|
|
548
552
|
token: tokenAddress,
|
|
549
553
|
destinationChainId,
|
|
550
554
|
destinationMintRecipient: ephemeralWalletAddress,
|