@otim/utils 0.0.2 → 0.0.4

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 (42) hide show
  1. package/dist/api/index.js +41 -7
  2. package/dist/api/index.js.map +2 -2
  3. package/dist/api/index.mjs +41 -7
  4. package/dist/api/index.mjs.map +2 -2
  5. package/dist/api/schemas/payments.d.mts +38 -0
  6. package/dist/api/schemas/payments.d.ts +38 -0
  7. package/dist/api/schemas/payments.d.ts.map +1 -1
  8. package/dist/api/services/payments.d.mts +2 -1
  9. package/dist/api/services/payments.d.ts +2 -1
  10. package/dist/api/services/payments.d.ts.map +1 -1
  11. package/dist/chains/index.js +1 -1
  12. package/dist/chains/index.mjs +1 -1
  13. package/dist/helpers/index.js +23 -1
  14. package/dist/helpers/index.js.map +2 -2
  15. package/dist/helpers/index.mjs +23 -1
  16. package/dist/helpers/index.mjs.map +2 -2
  17. package/dist/helpers/zod.d.mts +21 -0
  18. package/dist/helpers/zod.d.ts +21 -0
  19. package/dist/helpers/zod.d.ts.map +1 -1
  20. package/dist/payments/build.d.mts +1 -0
  21. package/dist/payments/build.d.ts +1 -0
  22. package/dist/payments/build.d.ts.map +1 -1
  23. package/dist/payments/comprehensive-payment-request.d.mts +1 -0
  24. package/dist/payments/comprehensive-payment-request.d.ts +1 -0
  25. package/dist/payments/comprehensive-payment-request.d.ts.map +1 -1
  26. package/dist/payments/index.js +16 -12
  27. package/dist/payments/index.js.map +2 -2
  28. package/dist/payments/index.mjs +16 -12
  29. package/dist/payments/index.mjs.map +2 -2
  30. package/dist/server/index.js +36 -4
  31. package/dist/server/index.js.map +2 -2
  32. package/dist/server/index.mjs +36 -4
  33. package/dist/server/index.mjs.map +2 -2
  34. package/dist/server/routes/bridge.d.mts +62 -0
  35. package/dist/server/routes/bridge.d.ts +62 -0
  36. package/dist/server/routes/bridge.d.ts.map +1 -1
  37. package/dist/server/routes/payments.d.mts +2 -1
  38. package/dist/server/routes/payments.d.ts +2 -1
  39. package/dist/server/routes/payments.d.ts.map +1 -1
  40. package/dist/wallet/wagmi/index.js +1 -1
  41. package/dist/wallet/wagmi/index.mjs +1 -1
  42. package/package.json +9 -5
@@ -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: 1,
389
+ maxExecutions: 0,
386
390
  actionArguments: createSweepERC20ActionArguments({
387
391
  chainId,
388
- maxExecutions: 1,
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: 1,
460
+ maxExecutions: 0,
457
461
  actionArguments: createSweepUniswapV3ActionArguments({
458
462
  chainId,
459
- maxExecutions: 1,
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: 1,
492
+ maxExecutions: 0,
489
493
  actionArguments: createSweepUniswapV3ActionArguments({
490
494
  chainId: chainConfig.chainId,
491
- maxExecutions: 1,
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: 1,
548
+ maxExecutions: 0,
545
549
  actionArguments: createSweepCCTPActionArguments({
546
550
  chainId: sourceChainId,
547
- maxExecutions: 1,
551
+ maxExecutions: 0,
548
552
  token: tokenAddress,
549
553
  destinationChainId,
550
554
  destinationMintRecipient: ephemeralWalletAddress,