@otim/utils 0.0.2-development.0 → 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.
Files changed (36) hide show
  1. package/dist/api/index.js +11 -6
  2. package/dist/api/index.js.map +2 -2
  3. package/dist/api/index.mjs +11 -6
  4. package/dist/api/index.mjs.map +2 -2
  5. package/dist/api/schemas/payments.d.mts +3 -0
  6. package/dist/api/schemas/payments.d.ts +3 -0
  7. package/dist/api/schemas/payments.d.ts.map +1 -1
  8. package/dist/chains/config/all-chains.d.mts +4 -4
  9. package/dist/chains/config/all-chains.d.ts +4 -4
  10. package/dist/chains/config/all-chains.d.ts.map +1 -1
  11. package/dist/chains/index.js +8 -2
  12. package/dist/chains/index.js.map +2 -2
  13. package/dist/chains/index.mjs +8 -2
  14. package/dist/chains/index.mjs.map +2 -2
  15. package/dist/helpers/index.js +20 -0
  16. package/dist/helpers/index.js.map +2 -2
  17. package/dist/helpers/index.mjs +20 -0
  18. package/dist/helpers/index.mjs.map +2 -2
  19. package/dist/helpers/zod.d.mts +21 -0
  20. package/dist/helpers/zod.d.ts +21 -0
  21. package/dist/helpers/zod.d.ts.map +1 -1
  22. package/dist/payments/build.d.mts +1 -0
  23. package/dist/payments/build.d.ts +1 -0
  24. package/dist/payments/build.d.ts.map +1 -1
  25. package/dist/payments/comprehensive-payment-request.d.mts +1 -0
  26. package/dist/payments/comprehensive-payment-request.d.ts +1 -0
  27. package/dist/payments/comprehensive-payment-request.d.ts.map +1 -1
  28. package/dist/payments/index.js +16 -12
  29. package/dist/payments/index.js.map +2 -2
  30. package/dist/payments/index.mjs +16 -12
  31. package/dist/payments/index.mjs.map +2 -2
  32. package/dist/server/index.js +3 -3
  33. package/dist/server/index.js.map +1 -1
  34. package/dist/server/index.mjs +3 -3
  35. package/dist/server/index.mjs.map +1 -1
  36. package/package.json +2 -2
@@ -128,13 +128,15 @@ function createPaymentRequestBuildPayload(params) {
128
128
  payerAddress = null,
129
129
  completionInstructions,
130
130
  instructions = [],
131
- metadata = {}
131
+ metadata = {},
132
+ maxRuns
132
133
  } = params;
133
134
  return {
134
135
  payerAddress,
135
136
  completionInstructions: completionInstructions.map(processInstruction),
136
137
  instructions: instructions.map(processInstruction),
137
- metadata
138
+ metadata,
139
+ maxRuns
138
140
  };
139
141
  }
140
142
  function processInstruction(spec) {
@@ -245,7 +247,8 @@ function createComprehensivePaymentRequest(params) {
245
247
  payerAddress,
246
248
  metadata,
247
249
  feeToken,
248
- cctpConfig = defaultCCTPConfig
250
+ cctpConfig = defaultCCTPConfig,
251
+ maxRuns = 1
249
252
  } = params;
250
253
  validateSettlementChainSupport(settlementChainId, cctpConfig);
251
254
  const settlementConfig = findChainConfig(
@@ -274,7 +277,8 @@ function createComprehensivePaymentRequest(params) {
274
277
  payerAddress,
275
278
  completionInstructions,
276
279
  instructions,
277
- metadata
280
+ metadata,
281
+ maxRuns
278
282
  });
279
283
  }
280
284
  function validateSettlementChainSupport(chainId, cctpConfig) {
@@ -332,10 +336,10 @@ function createCompletionInstructions(settlementChainId, settlementUSDCAddress,
332
336
  function createSettlementSweepInstruction(chainId, tokenAddress, recipient, threshold, fee) {
333
337
  return {
334
338
  chainId,
335
- maxExecutions: 1,
339
+ maxExecutions: 0,
336
340
  actionArguments: createSweepERC20ActionArguments({
337
341
  chainId,
338
- maxExecutions: 1,
342
+ maxExecutions: 0,
339
343
  token: tokenAddress,
340
344
  target: recipient,
341
345
  threshold,
@@ -403,10 +407,10 @@ function createSwapInstructionWithFloor(chainId, tokenIn, tokenOut, recipient, t
403
407
  const floorAmountOut = afterFeeAmount * BigInt(1e4 - slippageBps) / 10000n;
404
408
  const instruction = {
405
409
  chainId,
406
- maxExecutions: 1,
410
+ maxExecutions: 0,
407
411
  actionArguments: createSweepUniswapV3ActionArguments({
408
412
  chainId,
409
- maxExecutions: 1,
413
+ maxExecutions: 0,
410
414
  recipient,
411
415
  tokenIn: tokenIn.address,
412
416
  tokenOut: tokenOut.address,
@@ -435,10 +439,10 @@ function createCrossChainSwapInstructions(chainConfig, chainUSDC, ephemeralWalle
435
439
  const maxPriceDeviationBps = sourceToken.symbol.toUpperCase() === USDT_SYMBOL ? USDT_MAX_PRICE_DEVIATION_BPS : DEFAULT_MAX_PRICE_DEVIATION_BPS;
436
440
  const instruction = {
437
441
  chainId: chainConfig.chainId,
438
- maxExecutions: 1,
442
+ maxExecutions: 0,
439
443
  actionArguments: createSweepUniswapV3ActionArguments({
440
444
  chainId: chainConfig.chainId,
441
- maxExecutions: 1,
445
+ maxExecutions: 0,
442
446
  recipient: ephemeralWalletAddress,
443
447
  tokenIn: sourceToken.address,
444
448
  tokenOut: chainUSDC.address,
@@ -491,10 +495,10 @@ function createCrossChainInstructions(chainTokenConfigs, settlementChainId, ephe
491
495
  function createCCTPBridgeInstruction(sourceChainId, tokenAddress, destinationChainId, ephemeralWalletAddress, threshold, fee, cctpConfig) {
492
496
  return {
493
497
  chainId: sourceChainId,
494
- maxExecutions: 1,
498
+ maxExecutions: 0,
495
499
  actionArguments: createSweepCCTPActionArguments({
496
500
  chainId: sourceChainId,
497
- maxExecutions: 1,
501
+ maxExecutions: 0,
498
502
  token: tokenAddress,
499
503
  destinationChainId,
500
504
  destinationMintRecipient: ephemeralWalletAddress,