@otim/utils 0.0.11 → 0.0.12

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 (101) hide show
  1. package/dist/api/index.d.mts +5 -5
  2. package/dist/api/index.d.mts.map +1 -1
  3. package/dist/api/index.d.ts +5 -5
  4. package/dist/api/index.d.ts.map +1 -1
  5. package/dist/api/index.js +7 -6
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api/index.mjs +6 -6
  8. package/dist/api/index.mjs.map +1 -1
  9. package/dist/{api-urls-DJcIKBCy.mjs → api-urls-B6RnXSRD.mjs} +1 -1
  10. package/dist/{api-urls-DJcIKBCy.mjs.map → api-urls-B6RnXSRD.mjs.map} +1 -1
  11. package/dist/{api-urls-B-GTEiT3.d.mts → api-urls-DacG9Q5P.d.mts} +1 -1
  12. package/dist/api-urls-DacG9Q5P.d.mts.map +1 -0
  13. package/dist/{api-urls-SKeIQMoZ.d.ts → api-urls-Dgxfefmy.d.ts} +1 -1
  14. package/dist/api-urls-Dgxfefmy.d.ts.map +1 -0
  15. package/dist/chains/index.d.mts +1419 -8870
  16. package/dist/chains/index.d.mts.map +1 -1
  17. package/dist/chains/index.d.ts +1419 -8870
  18. package/dist/chains/index.d.ts.map +1 -1
  19. package/dist/chains/index.js +11 -14
  20. package/dist/chains/index.js.map +1 -1
  21. package/dist/chains/index.mjs +3 -7
  22. package/dist/chains/index.mjs.map +1 -1
  23. package/dist/{chunk-kSYXY2_d.js → chunk-BE-pF4vm.js} +1 -1
  24. package/dist/{client-factory-C3A4RPdj.d.ts → client-factory-B12uLPUI.d.ts} +2 -2
  25. package/dist/client-factory-B12uLPUI.d.ts.map +1 -0
  26. package/dist/{client-factory-7xUSPC9I.mjs → client-factory-DY6UNuuV.mjs} +2 -2
  27. package/dist/{client-factory-7xUSPC9I.mjs.map → client-factory-DY6UNuuV.mjs.map} +1 -1
  28. package/dist/{client-factory-CTI_Nt35.js → client-factory-Drsy2vfF.js} +2 -2
  29. package/dist/{client-factory-CTI_Nt35.js.map → client-factory-Drsy2vfF.js.map} +1 -1
  30. package/dist/{client-factory-DOL0ZTWy.d.mts → client-factory-Dt4S4yZY.d.mts} +2 -2
  31. package/dist/client-factory-Dt4S4yZY.d.mts.map +1 -0
  32. package/dist/constants.d.mts.map +1 -1
  33. package/dist/constants.d.ts.map +1 -1
  34. package/dist/constants.js +1 -0
  35. package/dist/constants.js.map +1 -1
  36. package/dist/{date-gBac-Om9.mjs → date-BGw9dSBT.mjs} +1 -1
  37. package/dist/{date-gBac-Om9.mjs.map → date-BGw9dSBT.mjs.map} +1 -1
  38. package/dist/{date-CFzrYcjE.js → date-G7-DHP8t.js} +2 -2
  39. package/dist/{date-CFzrYcjE.js.map → date-G7-DHP8t.js.map} +1 -1
  40. package/dist/{defineProperty-DbMdhrDE.js → defineProperty-DXYX3Aus.js} +8 -8
  41. package/dist/{defineProperty-DzhmunJg.mjs → defineProperty-D_Wrem5y.mjs} +8 -8
  42. package/dist/helpers/index.d.mts +2 -2
  43. package/dist/helpers/index.d.mts.map +1 -1
  44. package/dist/helpers/index.d.ts +2 -2
  45. package/dist/helpers/index.d.ts.map +1 -1
  46. package/dist/helpers/index.js +69 -68
  47. package/dist/helpers/index.mjs +2 -2
  48. package/dist/instructions/index.d.mts.map +1 -1
  49. package/dist/instructions/index.d.ts.map +1 -1
  50. package/dist/instructions/index.js +2 -1
  51. package/dist/instructions/index.js.map +1 -1
  52. package/dist/payments/index.d.mts +4 -3
  53. package/dist/payments/index.d.mts.map +1 -1
  54. package/dist/payments/index.d.ts +4 -3
  55. package/dist/payments/index.d.ts.map +1 -1
  56. package/dist/payments/index.js +4 -3
  57. package/dist/payments/index.js.map +1 -1
  58. package/dist/payments/index.mjs +2 -2
  59. package/dist/schemas/index.d.mts +1 -1
  60. package/dist/schemas/index.d.ts +1 -1
  61. package/dist/schemas/index.js +4 -3
  62. package/dist/schemas/index.js.map +1 -1
  63. package/dist/schemas/index.mjs +2 -2
  64. package/dist/schemas/index.mjs.map +1 -1
  65. package/dist/server/index.d.mts +2 -3
  66. package/dist/server/index.d.mts.map +1 -1
  67. package/dist/server/index.d.ts +2 -3
  68. package/dist/server/index.d.ts.map +1 -1
  69. package/dist/server/index.js +2 -1
  70. package/dist/server/index.js.map +1 -1
  71. package/dist/server/index.mjs +2 -2
  72. package/dist/server/react.d.mts +1 -1
  73. package/dist/server/react.d.mts.map +1 -1
  74. package/dist/server/react.d.ts +1 -1
  75. package/dist/server/react.d.ts.map +1 -1
  76. package/dist/server/react.js +3 -2
  77. package/dist/server/react.js.map +1 -1
  78. package/dist/server/react.mjs +1 -1
  79. package/dist/{index-Bv0kUz4w.d.ts → user-CbQLjMOC.d.mts} +4 -4
  80. package/dist/user-CbQLjMOC.d.mts.map +1 -0
  81. package/dist/{index-DartTKk2.d.mts → user-ZFlczCh8.d.ts} +4 -4
  82. package/dist/user-ZFlczCh8.d.ts.map +1 -0
  83. package/dist/wallet/wagmi/index.d.mts +0 -1
  84. package/dist/wallet/wagmi/index.d.mts.map +1 -1
  85. package/dist/wallet/wagmi/index.d.ts +0 -1
  86. package/dist/wallet/wagmi/index.d.ts.map +1 -1
  87. package/dist/wallet/wagmi/index.js +2 -1
  88. package/dist/wallet/wagmi/index.js.map +1 -1
  89. package/dist/{helpers-BNiSxjGq.mjs → zod-CFr-iyX9.mjs} +3 -3
  90. package/dist/zod-CFr-iyX9.mjs.map +1 -0
  91. package/dist/{helpers-DoC7Xl12.js → zod-CjftwcOJ.js} +4 -4
  92. package/dist/zod-CjftwcOJ.js.map +1 -0
  93. package/package.json +6 -6
  94. package/dist/api-urls-B-GTEiT3.d.mts.map +0 -1
  95. package/dist/api-urls-SKeIQMoZ.d.ts.map +0 -1
  96. package/dist/client-factory-C3A4RPdj.d.ts.map +0 -1
  97. package/dist/client-factory-DOL0ZTWy.d.mts.map +0 -1
  98. package/dist/helpers-BNiSxjGq.mjs.map +0 -1
  99. package/dist/helpers-DoC7Xl12.js.map +0 -1
  100. package/dist/index-Bv0kUz4w.d.ts.map +0 -1
  101. package/dist/index-DartTKk2.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/payments/types.ts","../../src/payments/config/cctp.ts","../../src/payments/config/tokens.ts","../../src/payments/build.ts","../../src/payments/comprehensive-payment-request.ts","../../src/payments/instruction-registry.ts","../../src/payments/action-names.ts","../../src/payments/validation.ts","../../src/payments/chain-token-config-builder.ts","../../src/payments/payment-request-token-resolver.ts","../../src/payments/payment-metadata.ts","../../src/payments/payment-metadata-builder.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAEa;;;;;;;AAAA,KAOD,aAAA,GADF,CAAA,OAC0B,aAD1B,CAAA,CAAA,MAAA,OACsD,aADtD,CAAA;AACE,UACK,+BAAA,CAD+C;EAC/C,OAAA,EAAA,MAAA;EAIK,aAAA,EAAA,MAAA;EACI,GAAA,EAAA;IACf,gBAAA,EAFW,SAEX;IAAO,oBAAA,EADQ,SACR;IAID,KAAA,EAJN,OAIe;EAUb,CAAA;AAIb;AAOiB,UArBA,SAAA,CAyBG;EAaH,OAAA,EArCN,OAqCM;EAEF,QAAA,EAAA,MAAkB;EAUX,MAAA,EAAA,MAAA;;;;AAqBtB;;AAMgB,cAnEH,iBAmEG,EAAA;EAN0B,SAAA,cAAA,EAAA,gBAAA;EAAM,SAAA,QAAA,EAAA,UAAA;AAchD,CAAA;AAMa,KA7ED,iBAAA,GAkFF,CAAA,OAjFA,iBAiFA,CAAA,CAAA,MAAA,OAjFgC,iBAiFhC,CAAA;AACV;;;;AC1GiB,UD8BA,KAAA,CC9BU;EAqCd,SAAA,IAAA,EAAA,MAAkB;EACV,SAAA,OAAA,EDJD,OCIC;;;;AAerB;;;;ACjDA;;;;ACTiB,UHoDA,sBAAA,SAA+B,MGhDvB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EAIR,IAAA,EAAA,OH8CF,iBAAA,CAAkB,cG9CS;EAChB,KAAA,EA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,SXZT;EACI,SAAA,KAAA,EWaR,KXbQ;EACf,SAAA,IAAA,CAAA,EAAA,MAAA;EAAO,SAAA,MAAA,CAAA,EAAA,MAAA;AAIlB;AAUA;AAIA;AAOA;AAiBA;AAEe,UWrBE,qCAAA,CXqBgB;EAUX,SAAA,WAAA,EAAA,MAAA;EAEZ,SAAA,kBAAA,EW7BqB,SX6BrB;EAdsC,SAAA,KAAA,EWb9B,KXa8B;EAAM,SAAA,eAAA,EWX1B,eXW0B;AAiCtD;;;;;AAcY,UWnDK,0BAAA,CXmDmB;EAMvB,SAAA,eAKH,EW5DkB,eX4DlB;EACE,SAAA,YAAgB,EW3DH,sBX4Df;;;;AC3GV;AAqCA;AACqB,UUgBJ,wBAAA,CVhBI;EAUS,SAAA,OAAA,EAAA,OAAA;EAXY,SAAA,MAAA,EAAA,SAAA,MAAA,EAAA;;AAgB1C;;;;ACjDA;;;iBS+GgB,oBAAA,SACN,6BACP;AR1HH;AAQA;;;;;;;AAiBiB,iBQuID,+BAAA,CRnIA,MAAA,EQoIN,qCRpIM,CAAA,EQqIb,sBRrIa;AAKhB;AAoCA;;;;;;AAcA;iBQoHgB,oBAAA,SACN,6BACP;;;AP9MH;;;;AC6HA;AAGC;AAsDD;;iBMgEgB,uBAAA,WACJ,yBACT"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/payments/types.ts","../../src/payments/config/cctp.ts","../../src/payments/config/tokens.ts","../../src/payments/build.ts","../../src/payments/comprehensive-payment-request.ts","../../src/payments/instruction-registry.ts","../../src/payments/action-names.ts","../../src/payments/validation.ts","../../src/payments/chain-token-config-builder.ts","../../src/payments/payment-request-token-resolver.ts","../../src/payments/payment-metadata.ts","../../src/payments/payment-metadata-builder.ts"],"mappings":";;;;;;;;;cAEa,aAAA;EAAA;;;;;;KAOD,aAAA,WAAwB,aAAA,eAA4B,aAAA;AAAA,UAC/C,+BAAA;EACf,OAAA;EACA,aAAA;EACA,GAAA;IACE,gBAAA,EAAkB,SAAA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A,SAEN,WAAA;EAAA,SAEA,kBAAA,EAAoB,SAAA;EAAA,SAEpB,KAAA,EAAO,KAAA;EAAA,SAEP,eAAA,EAAiB,eAAA;AAAA;;;;;UAOX,0BAAA;EAAA,SAEN,eAAA,EAAiB,eAAA;EAAA,SAEjB,YAAA,EAAc,sBAAA;AAAA;;;;;UAOR,wBAAA;EAAA,SACN,OAAA;EAAA,SACA,MAAA;AAAA;;;AX/CX;;;;;iBW0GgB,oBAAA,CACd,MAAA,EAAQ,0BAAA,GACP,sBAAA;;;;;AXlGH;;;;iBWwIgB,+BAAA,CACd,MAAA,EAAQ,qCAAA,GACP,sBAAA;AXtIH;;;;;AAOA;;;AAPA,iBW4KgB,oBAAA,CACd,MAAA,EAAQ,0BAAA,GACP,sBAAA;;;;;;AXtJH;;;;;iBW8LgB,uBAAA,CACd,QAAA,EAAU,sBAAA,GACT,wBAAA"}
@@ -1,4 +1,5 @@
1
- import { T as Address$2 } from "../index-Bv0kUz4w.js";
1
+ import { T as Address$1 } from "../user-ZFlczCh8.js";
2
+ import "../schemas/index.js";
2
3
  import { Nullable, Nullish } from "@otim/utils/helpers";
3
4
  import { Address, HexString } from "@otim/utils/schemas";
4
5
  import { AbiParameter } from "abitype";
@@ -249,7 +250,7 @@ interface BuildPaymentMetadataParams {
249
250
  readonly tokenSymbol: string;
250
251
  readonly dueDate: string;
251
252
  readonly amountInUSD: number;
252
- readonly fromAccountAddress: Address$2;
253
+ readonly fromAccountAddress: Address$1;
253
254
  readonly payer: Payer;
254
255
  readonly note?: string;
255
256
  readonly source?: string;
@@ -260,7 +261,7 @@ interface BuildPaymentMetadataParams {
260
261
  */
261
262
  interface BuildPaymentMetadataFromInvoiceParams {
262
263
  readonly tokenSymbol: string;
263
- readonly fromAccountAddress: Address$2;
264
+ readonly fromAccountAddress: Address$1;
264
265
  readonly payer: Payer;
265
266
  readonly invoiceMetadata: InvoiceMetadata;
266
267
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/payments/types.ts","../../src/payments/config/cctp.ts","../../src/payments/config/tokens.ts","../../src/payments/build.ts","../../src/payments/comprehensive-payment-request.ts","../../src/payments/instruction-registry.ts","../../src/payments/action-names.ts","../../src/payments/validation.ts","../../src/payments/chain-token-config-builder.ts","../../src/payments/payment-request-token-resolver.ts","../../src/payments/payment-metadata.ts","../../src/payments/payment-metadata-builder.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAEa;;;;;;;AAAA,KAOD,aAAA,GADF,CAAA,OAC0B,aAD1B,CAAA,CAAA,MAAA,OACsD,aADtD,CAAA;AACE,UACK,+BAAA,CAD+C;EAC/C,OAAA,EAAA,MAAA;EAIK,aAAA,EAAA,MAAA;EACI,GAAA,EAAA;IACf,gBAAA,EAFW,SAEX;IAAO,oBAAA,EADQ,SACR;IAID,KAAA,EAJN,OAIe;EAUb,CAAA;AAIb;AAOiB,UArBA,SAAA,CAyBG;EAaH,OAAA,EArCN,OAqCM;EAEF,QAAA,EAAA,MAAkB;EAUX,MAAA,EAAA,MAAA;;;;AAqBtB;;AAMgB,cAnEH,iBAmEG,EAAA;EAN0B,SAAA,cAAA,EAAA,gBAAA;EAAM,SAAA,QAAA,EAAA,UAAA;AAchD,CAAA;AAMa,KA7ED,iBAAA,GAkFF,CAAA,OAjFA,iBAiFA,CAAA,CAAA,MAAA,OAjFgC,iBAiFhC,CAAA;AACV;;;;AC1GiB,UD8BA,KAAA,CC9BU;EAqCd,SAAA,IAAA,EAAA,MAAkB;EACV,SAAA,OAAA,EDJD,OCIC;;;;AAerB;;;;ACjDA;;;;ACTiB,UHoDA,sBAAA,SAA+B,MGhDvB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EAIR,IAAA,EAAA,OH8CF,iBAAA,CAAkB,cG9CS;EAChB,KAAA,EAAA,MAAA;EAAT,SAAA,EAAA,MAAA;EACS,QAAA,EAAA,MAAA;EACT,OAAA,CAAA,EAAA,MAAA;EAEJ,kBAAA,EHmDS,OGnDT;EAA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UA;AAIA;AAOA;AAiBA;AAEe,UWrBE,qCAAA,CXqBgB;EAUX,SAAA,WAAA,EAAA,MAAA;EAEZ,SAAA,kBAAA,EW7BqB,SX6BrB;EAdsC,SAAA,KAAA,EWb9B,KXa8B;EAAM,SAAA,eAAA,EWX1B,eXW0B;AAiCtD;;;;;AAcY,UWnDK,0BAAA,CXmDmB;EAMvB,SAAA,eAKH,EW5DkB,eX4DlB;EACE,SAAA,YAAgB,EW3DH,sBX4Df;;;;AC3GV;AAqCA;AACqB,UUgBJ,wBAAA,CVhBI;EAUS,SAAA,OAAA,EAAA,OAAA;EAXY,SAAA,MAAA,EAAA,SAAA,MAAA,EAAA;;AAgB1C;;;;ACjDA;;;iBS+GgB,oBAAA,SACN,6BACP;AR1HH;AAQA;;;;;;;AAiBiB,iBQuID,+BAAA,CRnIA,MAAA,EQoIN,qCRpIM,CAAA,EQqIb,sBRrIa;AAKhB;AAoCA;;;;;;AAcA;iBQoHgB,oBAAA,SACN,6BACP;;;AP9MH;;;;AC6HA;AAGC;AAsDD;;iBMgEgB,uBAAA,WACJ,yBACT"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/payments/types.ts","../../src/payments/config/cctp.ts","../../src/payments/config/tokens.ts","../../src/payments/build.ts","../../src/payments/comprehensive-payment-request.ts","../../src/payments/instruction-registry.ts","../../src/payments/action-names.ts","../../src/payments/validation.ts","../../src/payments/chain-token-config-builder.ts","../../src/payments/payment-request-token-resolver.ts","../../src/payments/payment-metadata.ts","../../src/payments/payment-metadata-builder.ts"],"mappings":";;;;;;;;;cAEa,aAAA;EAAA;;;;;;KAOD,aAAA,WAAwB,aAAA,eAA4B,aAAA;AAAA,UAC/C,+BAAA;EACf,OAAA;EACA,aAAA;EACA,GAAA;IACE,gBAAA,EAAkB,SAAA;IAClB,oBAAA,EAAsB,SAAA;IACtB,KAAA,EAAO,OAAA;EAAA;AAAA;AAAA,UAIM,SAAA;EACf,OAAA,EAAS,OAAA;EACT,QAAA;EAC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;;UAOX,0BAAA;EAAA,SAEN,eAAA,EAAiB,eAAA;EAAA,SAEjB,YAAA,EAAc,sBAAA;AAAA;;;;;UAOR,wBAAA;EAAA,SACN,OAAA;EAAA,SACA,MAAA;AAAA;;;AX/CX;;;;;iBW0GgB,oBAAA,CACd,MAAA,EAAQ,0BAAA,GACP,sBAAA;;;;;AXlGH;;;;iBWwIgB,+BAAA,CACd,MAAA,EAAQ,qCAAA,GACP,sBAAA;AXtIH;;;;;AAOA;;;AAPA,iBW4KgB,oBAAA,CACd,MAAA,EAAQ,0BAAA,GACP,sBAAA;;;;;;AXtJH;;;;;iBW8LgB,uBAAA,CACd,QAAA,EAAU,sBAAA,GACT,wBAAA"}
@@ -1,6 +1,7 @@
1
- const require_chunk = require('../chunk-kSYXY2_d.js');
2
- const require_defineProperty = require('../defineProperty-DbMdhrDE.js');
3
- const require_date = require('../date-CFzrYcjE.js');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('../chunk-BE-pF4vm.js');
3
+ const require_defineProperty = require('../defineProperty-DXYX3Aus.js');
4
+ const require_date = require('../date-G7-DHP8t.js');
4
5
  let _otim_utils_schemas = require("@otim/utils/schemas");
5
6
  let _otim_utils_helpers = require("@otim/utils/helpers");
6
7
  let viem_chains = require("viem/chains");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["mainnet","optimism","arbitrum","base","sepolia","baseSepolia","DEFAULT_ADDRESS","InstructionAction","eip712TypesMap","DEFAULT_ADDRESS","isValidDate","isNumber"],"sources":["../../src/payments/types.ts","../../src/payments/config/cctp.ts","../../src/payments/config/tokens.ts","../../src/payments/build.ts","../../src/payments/instruction-registry.ts","../../src/payments/action-names.ts","../../src/payments/validation.ts","../../src/payments/chain-token-config-builder.ts","../../src/payments/payment-request-token-resolver.ts","../../src/payments/payment-metadata-builder.ts"],"sourcesContent":["import type { Address, HexString } from \"@otim/utils/schemas\";\n\nexport const PaymentAction = {\n Sweep: \"Sweep\",\n SweepCCTP: \"SweepCCTP\",\n SweepERC20: \"SweepERC20\",\n SweepUniswapV3: \"SweepUniswapV3\",\n SweepDepositERC4626: \"SweepDepositERC4626\",\n} as const;\nexport type PaymentAction = (typeof PaymentAction)[keyof typeof PaymentAction];\nexport interface BaseEphemeralInstructionPayload {\n chainId: number;\n maxExecutions: number;\n fee: {\n maxBaseFeePerGas: HexString;\n maxPriorityFeePerGas: HexString;\n token: Address;\n };\n}\n\nexport interface TokenSpec {\n address: Address;\n decimals: number;\n symbol: string;\n}\n\n/**\n * Orchestration type discriminant.\n * Must match the Rust OrchestrationMetadata enum variants.\n */\nexport const OrchestrationType = {\n PaymentRequest: \"PaymentRequest\",\n AutoEarn: \"AutoEarn\",\n} as const;\nexport type OrchestrationType =\n (typeof OrchestrationType)[keyof typeof OrchestrationType];\n\n/**\n * Payer information for a payment request.\n * Matches Rust `Payer` struct in orchestration.rs.\n */\nexport interface Payer {\n /* Name of the payer (required, can be empty string if unknown) */\n readonly name: string;\n /* Wallet address of the payer */\n readonly address: Address;\n}\n\n/**\n * Payment request metadata stored in orchestration.\n * Matches Rust `PaymentRequestMetadata` struct with serde camelCase renaming.\n *\n * Required fields are enforced at type level to prevent runtime errors.\n * Optional fields match Rust `Option<T>` semantics.\n *\n * Extends Record<string, unknown> for API schema compatibility with\n * `buildSettlementRequestSchema` which expects a flexible metadata object.\n */\nexport interface PaymentRequestMetadata extends Record<string, unknown> {\n /* Discriminant field for backend OrchestrationMetadata enum. Always \"PaymentRequest\". */\n type: typeof OrchestrationType.PaymentRequest;\n /* Token symbol (e.g., \"USDC\", \"USDT\") */\n token: string;\n /* Amount due as a decimal string (e.g., \"150.00\") */\n amountDue: string;\n /* Currency code (e.g., \"USD\") */\n currency: string;\n /* Due date in NaiveDateTime format (YYYY-MM-DDTHH:mm:ss, no timezone) */\n dueDate?: string;\n /* Address of the account receiving payment */\n fromAccountAddress: Address;\n /* Payer information. Optional for payment requests without known payer. */\n payer?: Payer;\n /* Source of the payment request (e.g., \"Manual\", \"Stripe\", \"QuickBooks\") */\n source: string;\n /* Optional note or description for the payment */\n note?: string;\n /* External invoice ID from the source system */\n invoiceId?: string;\n /* Human-readable invoice number */\n invoiceNumber?: string;\n /* URL to the invoice attachment */\n attachmentUrl?: string;\n /* Filename of the attachment */\n attachmentName?: string;\n}\n\n/**\n * Auto-earn metadata stored in orchestration.\n * Matches Rust `AutoEarnMetadata` struct with serde camelCase renaming.\n */\nexport interface AutoEarnMetadata extends Record<string, unknown> {\n /* Discriminant field for backend OrchestrationMetadata enum. Always \"AutoEarn\". */\n type: typeof OrchestrationType.AutoEarn;\n /* Token symbol (e.g., \"USDC\") */\n tokenSymbol: string;\n /* Address of the vault contract */\n vaultAddress: Address;\n /* Human-readable name of the vault */\n vaultName: string;\n}\n\n/**\n * Union type for orchestration metadata.\n */\nexport type OrchestrationMetadata = PaymentRequestMetadata | AutoEarnMetadata;\n\n/**\n * Uniswap V3 fee tiers. Used to specify the fee tier for a Uniswap V3 swap.\n * @see https://docs.uniswap.org/concepts/protocol/fees\n */\nexport const UniswapV3FeeTier = {\n Lowest: \"100\",\n Low: \"500\",\n Medium: \"3000\",\n High: \"10000\",\n} as const;\nexport type UniswapV3FeeTier =\n (typeof UniswapV3FeeTier)[keyof typeof UniswapV3FeeTier];\n","import type { Nullable } from \"@otim/utils/helpers\";\n\nimport {\n arbitrum,\n base,\n baseSepolia,\n mainnet,\n optimism,\n sepolia,\n} from \"viem/chains\";\n\nexport interface CCTPConfig {\n supportedChainIds: Set<number>;\n isSupported(chainId: number): boolean;\n getDomain(chainId: number): Nullable<number>;\n}\n\n/**\n * List of chains that support CCTP\n * Only includes chains that have confirmed CCTP support from Circle\n * @see https://developers.circle.com/stablecoins/docs/supported-domains\n */\nconst cctpSupportedChains = new Set([\n mainnet.id,\n optimism.id,\n arbitrum.id,\n base.id,\n sepolia.id,\n baseSepolia.id,\n]);\n\n/**\n * CCTP Domain Mapping - Maps chain IDs to their Circle CCTP domain identifiers\n * Source: https://developers.circle.com/stablecoins/docs/supported-domains\n *\n * Domain IDs are used by Circle's Cross-Chain Transfer Protocol (CCTP) to\n * identify destination chains when burning and minting USDC across different\n * networks.\n */\nconst cctpDomainMapping: Record<number, number> = {\n [mainnet.id]: 0,\n [optimism.id]: 2,\n [arbitrum.id]: 3,\n [base.id]: 6,\n [sepolia.id]: 0,\n [baseSepolia.id]: 6,\n};\n\nexport class DefaultCCTPConfig implements CCTPConfig {\n supportedChainIds: Set<number>;\n\n constructor() {\n this.supportedChainIds = cctpSupportedChains;\n }\n\n isSupported(chainId: number): boolean {\n return this.supportedChainIds.has(chainId);\n }\n\n getDomain(chainId: number): Nullable<number> {\n return cctpDomainMapping[chainId] ?? null;\n }\n}\n\nexport const defaultCCTPConfig = new DefaultCCTPConfig();\n","import { isStablecoin } from \"@otim/utils/chains\";\n\nimport { UniswapV3FeeTier } from \"../types\";\n\n/**\n * Determines the recommended Uniswap V3 fee tier for a token pair\n *\n * Stable pairs (USDC/USDT swaps) use the Low fee tier (0.05%) since price\n * volatility is minimal. All other pairs use the Medium fee tier (0.3%) to\n * account for higher price volatility\n *\n * @param tokenIn - Symbol of the input token (e.g., \"USDC\", \"USDT\")\n * @param tokenOut - Symbol of the output token (e.g., \"USDC\", \"USDT\")\n * @returns The recommended Uniswap V3 fee tier for the swap\n */\nexport function getRecommendedFeeTier(\n tokenIn: string,\n tokenOut: string,\n): UniswapV3FeeTier {\n if (isStablecoin([tokenIn, tokenOut])) {\n return UniswapV3FeeTier.Low;\n }\n\n return UniswapV3FeeTier.Medium;\n}\n","import type { PaymentRequestBuildRequest } from \"@otim/utils/api\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { Address, HexString } from \"@otim/utils/schemas\";\n\nimport { DEFAULT_ADDRESS } from \"@otim/utils/helpers\";\n\nexport interface EphemeralInstructionSpec {\n chainId: number;\n salt?: number;\n maxExecutions: number;\n actionArguments: Record<string, unknown>;\n setEphemeralTarget?: boolean;\n}\n\nexport interface BuildPaymentRequestParams {\n payerAddress?: Nullable<Address>;\n completionInstructions: EphemeralInstructionSpec[];\n instructions?: EphemeralInstructionSpec[];\n /** Flexible metadata object - matches API schema z.record(z.string(), z.unknown()) */\n metadata?: Record<string, unknown>;\n maxRuns?: number;\n}\n\ninterface ProcessedInstruction {\n chainId: number;\n salt: number;\n maxExecutions: number;\n actionArguments: Record<string, unknown>;\n setEphemeralTarget: boolean;\n}\n\nexport interface FeeConfig {\n executionFee: number;\n maxBaseFeePerGas: `0x${string}`;\n maxPriorityFeePerGas: `0x${string}`;\n token: Address;\n}\n\nconst DEFAULT_SET_EPHEMERAL_TARGET = true;\n\nexport function createPaymentRequestBuildPayload(\n params: BuildPaymentRequestParams,\n): PaymentRequestBuildRequest {\n const {\n payerAddress = null,\n completionInstructions,\n instructions = [],\n metadata = {},\n maxRuns,\n } = params;\n\n return {\n payerAddress,\n completionInstructions: completionInstructions.map(processInstruction),\n instructions: instructions.map(processInstruction),\n metadata,\n maxRuns,\n };\n}\n\nfunction processInstruction(\n spec: EphemeralInstructionSpec,\n): ProcessedInstruction {\n return {\n chainId: spec.chainId,\n salt: spec.salt ?? generateRandomSalt(),\n maxExecutions: spec.maxExecutions,\n actionArguments: spec.actionArguments,\n setEphemeralTarget: spec.setEphemeralTarget ?? DEFAULT_SET_EPHEMERAL_TARGET,\n };\n}\n\nfunction generateRandomSalt(): number {\n return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);\n}\n\nexport function createDefaultFee(\n executionFee = 0,\n maxBaseFeePerGas: HexString = \"0x0\",\n maxPriorityFeePerGas: HexString = \"0x0\",\n token: Address = DEFAULT_ADDRESS,\n): FeeConfig {\n return {\n token,\n executionFee,\n maxBaseFeePerGas,\n maxPriorityFeePerGas,\n };\n}\n\nexport function createFeeWithToken(\n token?: Address,\n maxPriorityFeePerGas?: `0x${string}`,\n): FeeConfig {\n return createDefaultFee(0, \"0x0\", maxPriorityFeePerGas ?? \"0x0\", token);\n}\n","import type { EIP712Types } from \"@otim/utils/instructions\";\nimport type { AbiParameter } from \"abitype\";\n\nimport { eip712TypesMap } from \"@otim/utils/instructions\";\nimport { InstructionAction } from \"@otim/utils/schemas\";\n\nconst feeAbiComponent = {\n name: \"fee\",\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"maxBaseFeePerGas\", type: \"uint256\" },\n { name: \"maxPriorityFeePerGas\", type: \"uint256\" },\n { name: \"executionFee\", type: \"uint256\" },\n ],\n} as const satisfies AbiParameter;\n\nconst sweepAbi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"target\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"gasLimit\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepERC20Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"target\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepCCTPAbi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"destinationDomain\", type: \"uint32\" },\n { name: \"destinationMintRecipient\", type: \"bytes32\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepUniswapV3Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"recipient\", type: \"address\" },\n { name: \"tokenIn\", type: \"address\" },\n { name: \"tokenOut\", type: \"address\" },\n { name: \"feeTier\", type: \"uint24\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"floorAmountOut\", type: \"uint256\" },\n { name: \"meanPriceLookBack\", type: \"uint32\" },\n { name: \"maxPriceDeviationBPS\", type: \"uint32\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepSkipCCTPDepositAccountAbi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"depositor\", type: \"address\" },\n { name: \"destinationDomain\", type: \"uint32\" },\n { name: \"destinationMintRecipient\", type: \"bytes32\" },\n { name: \"threshold\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepDepositERC4626Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"vault\", type: \"address\" },\n { name: \"recipient\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"minDeposit\", type: \"uint256\" },\n { name: \"minTotalShares\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepWithdrawERC4626Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"vault\", type: \"address\" },\n { name: \"recipient\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"minWithdraw\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst actionAbiMap = {\n [InstructionAction.Sweep]: sweepAbi,\n [InstructionAction.SweepERC20]: sweepERC20Abi,\n [InstructionAction.SweepCCTP]: sweepCCTPAbi,\n [InstructionAction.SweepUniswapV3]: sweepUniswapV3Abi,\n [InstructionAction.SweepSkipCCTPDepositAccount]: sweepSkipCCTPDepositAccountAbi,\n [InstructionAction.SweepDepositERC4626]: sweepDepositERC4626Abi,\n [InstructionAction.SweepWithdrawERC4626]: sweepWithdrawERC4626Abi,\n} as const;\n\nexport interface InstructionTypeDefinition {\n abi: readonly AbiParameter[];\n eip712Types: EIP712Types;\n}\n\ntype ActionName = keyof typeof actionAbiMap;\n\nclass InstructionTypeRegistry {\n private registry = new Map<string, InstructionTypeDefinition>();\n\n constructor() {\n this.initializeDefaultTypes();\n }\n\n register(actionName: string, definition: InstructionTypeDefinition): void {\n this.registry.set(actionName, definition);\n }\n\n get(actionName: string): InstructionTypeDefinition {\n const definition = this.registry.get(actionName);\n\n if (!definition) {\n throw this.createUnsupportedTypeError(actionName);\n }\n\n return definition;\n }\n\n has(actionName: string): boolean {\n return this.registry.has(actionName);\n }\n\n getAvailableTypes(): string[] {\n return Array.from(this.registry.keys());\n }\n\n private initializeDefaultTypes(): void {\n const actionNames = Object.keys(actionAbiMap) as ActionName[];\n\n for (const actionName of actionNames) {\n const abi = actionAbiMap[actionName];\n const eip712Types = eip712TypesMap[actionName];\n\n if (abi && eip712Types) {\n this.register(actionName, { abi, eip712Types });\n }\n }\n }\n\n private createUnsupportedTypeError(actionName: string): Error {\n const availableTypes = this.getAvailableTypes().join(\", \");\n return new Error(\n `Unsupported instruction type: ${actionName}. Available: ${availableTypes}`,\n );\n }\n}\n\nexport const instructionRegistry = new InstructionTypeRegistry();\n","import type { PaymentRequestBuildResponse } from \"@otim/utils/api\";\nimport type { Optional } from \"@otim/utils/helpers\";\n\ninterface InstructionWithActionName {\n actionName?: string;\n}\n\nexport interface PaymentResponseWithActionNames extends PaymentRequestBuildResponse {\n completionInstructions: Array<\n PaymentRequestBuildResponse[\"completionInstructions\"][number] &\n InstructionWithActionName\n >;\n instructions: Array<\n PaymentRequestBuildResponse[\"instructions\"][number] &\n InstructionWithActionName\n >;\n}\n\ninterface InstructionWithArguments {\n actionArguments: Record<string, unknown>;\n}\n\ntype ActionNamesMap = Record<number, string>;\n\nexport function addActionNamesToInstructions(\n buildResponse: PaymentRequestBuildResponse,\n actionNames: ActionNamesMap,\n): PaymentResponseWithActionNames {\n const completionInstructionCount =\n buildResponse.completionInstructions.length;\n\n return {\n ...buildResponse,\n completionInstructions: buildResponse.completionInstructions.map(\n (instruction, index) => ({\n ...instruction,\n actionName: actionNames[index],\n }),\n ),\n instructions: buildResponse.instructions.map((instruction, index) => ({\n ...instruction,\n actionName: actionNames[completionInstructionCount + index],\n })),\n };\n}\n\nexport function extractActionNamesMap(\n completionInstructions: InstructionWithArguments[],\n instructions: InstructionWithArguments[] = [],\n): ActionNamesMap {\n const allInstructions = [...completionInstructions, ...instructions];\n\n return allInstructions.reduce<ActionNamesMap>(\n (actionNamesMap, instruction, index) => {\n const actionName = getFirstActionArgumentKey(instruction.actionArguments);\n if (actionName) {\n actionNamesMap[index] = actionName;\n }\n return actionNamesMap;\n },\n {},\n );\n}\n\nfunction getFirstActionArgumentKey(\n actionArguments: Record<string, unknown>,\n): Optional<string> {\n const keys = Object.keys(actionArguments);\n return keys[0];\n}\n","interface SignatureCountAssertion {\n expected: number;\n received: number;\n}\n\n/* Used to validate the number of signatures in a payment request. */\nexport class SignatureValidator {\n static assertExactCount(context: SignatureCountAssertion): void {\n if (context.received !== context.expected) {\n throw new Error(\n `Signature count mismatch: expected ${context.expected}, received ${context.received}`,\n );\n }\n }\n\n static assertMinimumCount(context: SignatureCountAssertion): void {\n if (context.received < context.expected) {\n throw new Error(\n `Insufficient signatures: expected at least ${context.expected}, received ${context.received}`,\n );\n }\n }\n}\n\nexport function assertSignatureCount<T>(\n signatures: T[],\n expectedCount: number,\n): asserts signatures is T[] & { length: typeof expectedCount } {\n SignatureValidator.assertExactCount({\n expected: expectedCount,\n received: signatures.length,\n });\n}\n\nexport function assertMinimumSignatures<T>(\n signatures: T[],\n minimumCount: number,\n): asserts signatures is T[] & { length: number } {\n SignatureValidator.assertMinimumCount({\n expected: minimumCount,\n received: signatures.length,\n });\n}\n","import type { HexString } from \"../schemas\";\nimport type { ChainTokenConfig } from \"./comprehensive-payment-request\";\n\ninterface Token {\n address: string;\n symbol: string;\n chainId: number;\n decimals: number;\n}\n\nexport function createChainTokenConfigs(tokens: Token[]): ChainTokenConfig[] {\n const tokensByChain = groupTokensByChainId(tokens);\n return convertToChainConfigs(tokensByChain);\n}\n\nfunction groupTokensByChainId(tokens: Token[]): Map<number, Token[]> {\n const grouped = new Map<number, Token[]>();\n\n for (const token of tokens) {\n const chainTokens = grouped.get(token.chainId) ?? [];\n chainTokens.push(token);\n grouped.set(token.chainId, chainTokens);\n }\n\n return grouped;\n}\n\nfunction convertToChainConfigs(\n tokensByChain: Map<number, Token[]>,\n): ChainTokenConfig[] {\n return Array.from(tokensByChain.entries()).map(([chainId, tokens]) => ({\n chainId,\n tokens: tokens.map((token) => ({\n symbol: token.symbol,\n address: token.address as HexString,\n decimals: token.decimals,\n })),\n }));\n}\n","import type { Nullish } from \"@otim/utils/helpers\";\nimport type { Address } from \"@otim/utils/schemas\";\n\nimport { DEFAULT_ADDRESS } from \"@otim/utils/helpers\";\n\ninterface Token {\n symbol: string;\n address: string;\n}\n\n/* Checks if a token is the native blockchain token (ETH). */\nexport function isNativeToken<T extends Pick<Token, \"symbol\" | \"address\">>(\n token: Nullish<T>,\n): boolean {\n if (!token) return false;\n\n return (\n token.symbol === \"ETH\" ||\n token.address.toLowerCase() === DEFAULT_ADDRESS.toLowerCase()\n );\n}\n\n/* Creates unique identifier for a token by combining chain ID and address. */\nexport function createTokenIdentifier(\n chainId: number,\n tokenAddress: Address,\n): string {\n return `${chainId}:${tokenAddress}`;\n}\n","import type { InvoiceMetadata } from \"./payment-metadata\";\nimport type { Payer, PaymentRequestMetadata } from \"./types\";\nimport type { Address } from \"../schemas\";\n\nimport { OrchestrationType } from \"./types\";\nimport { isValidDate } from \"../helpers/date\";\nimport { isNumber } from \"../helpers/types\";\n\n/* Default currency for payments. Centralized for easy modification. */\nconst DEFAULT_CURRENCY = \"USD\" as const;\n\n/* Default source for manually created payment requests */\nconst DEFAULT_SOURCE = \"Manual\" as const;\n\n/**\n * Input parameters for building manual payment metadata.\n * All fields are explicit and required unless marked optional.\n */\nexport interface BuildPaymentMetadataParams {\n /* Token symbol (e.g., \"USDC\", \"USDT\") */\n readonly tokenSymbol: string;\n /* Due date in ISO 8601 or parseable date format */\n readonly dueDate: string;\n /* Amount in USD (numeric, will be formatted to 2 decimal places) */\n readonly amountInUSD: number;\n /* Address of the account receiving payment */\n readonly fromAccountAddress: Address;\n /* Payer information */\n readonly payer: Payer;\n /* Optional note for the payment */\n readonly note?: string;\n /* Source of the payment request. Defaults to \"Manual\". */\n readonly source?: string;\n}\n\n/**\n * Input parameters for building payment metadata from invoice integration.\n * Invoice fields take precedence over any manual overrides.\n */\nexport interface BuildPaymentMetadataFromInvoiceParams {\n /* Token symbol (e.g., \"USDC\", \"USDT\") */\n readonly tokenSymbol: string;\n /* Address of the account receiving payment */\n readonly fromAccountAddress: Address;\n /* Payer information */\n readonly payer: Payer;\n /* Invoice metadata from external integration */\n readonly invoiceMetadata: InvoiceMetadata;\n}\n\n/**\n * Input parameters for merging invoice data with existing base metadata.\n * Invoice fields override base metadata to ensure accuracy.\n */\nexport interface BuildInvoiceMetadataParams {\n /* Invoice metadata from external integration */\n readonly invoiceMetadata: InvoiceMetadata;\n /* Base payment metadata to merge with invoice data */\n readonly baseMetadata: PaymentRequestMetadata;\n}\n\n/**\n * Result of metadata validation.\n * Immutable result object for type safety.\n */\nexport interface MetadataValidationResult {\n readonly isValid: boolean;\n readonly errors: readonly string[];\n}\n\n/**\n * Formats a date to NaiveDateTime format expected by Rust backend.\n * Converts ISO 8601 strings like \"2025-01-15T00:00:00.000Z\" to \"2025-01-15T00:00:00\".\n *\n * Rust's chrono::NaiveDateTime expects format without timezone suffix.\n *\n * @param dateInput - Date string or Date object to format\n * @returns Formatted NaiveDateTime string\n * @throws Error if date is invalid\n */\nfunction formatToNaiveDateTime(dateInput: string | Date): string {\n const date = typeof dateInput === \"string\" ? new Date(dateInput) : dateInput;\n\n if (!isValidDate(date)) {\n throw new Error(`Invalid date provided: ${String(dateInput)}`);\n }\n\n const year = date.getUTCFullYear();\n const month = String(date.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(date.getUTCDate()).padStart(2, \"0\");\n const hours = String(date.getUTCHours()).padStart(2, \"0\");\n const minutes = String(date.getUTCMinutes()).padStart(2, \"0\");\n const seconds = String(date.getUTCSeconds()).padStart(2, \"0\");\n\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;\n}\n\n/**\n * Formats a numeric amount to a decimal string with 2 decimal places.\n * Ensures consistent formatting for monetary values.\n *\n * @param amount - Numeric amount to format\n * @returns Formatted amount string (e.g., \"150.00\")\n */\nfunction formatAmount(amount: number): string {\n return amount.toFixed(2);\n}\n\n/**\n * Validates that a value is a safe, finite number suitable for monetary amounts.\n * Excludes NaN and Infinity which could cause calculation errors downstream.\n *\n * @param value - Value to validate\n * @returns True if value is a valid monetary amount\n */\nfunction isValidMonetaryAmount(value: unknown): value is number {\n return isNumber(value) && Number.isFinite(value);\n}\n\n/**\n * Constructs payment metadata for manually created payment requests.\n * Pure function with explicit input/output contract.\n *\n * @param params - Configuration for manual payment request\n * @returns Immutable PaymentRequestMetadata object\n */\nexport function buildPaymentMetadata(\n params: BuildPaymentMetadataParams,\n): PaymentRequestMetadata {\n const {\n tokenSymbol,\n note,\n dueDate,\n amountInUSD,\n fromAccountAddress,\n payer,\n source = DEFAULT_SOURCE,\n } = params;\n\n const baseMetadata: PaymentRequestMetadata = {\n type: OrchestrationType.PaymentRequest,\n token: tokenSymbol,\n amountDue: formatAmount(amountInUSD),\n currency: DEFAULT_CURRENCY,\n dueDate: formatToNaiveDateTime(dueDate),\n fromAccountAddress,\n payer,\n source,\n };\n\n // Conditionally add optional fields (pure spread, no mutation)\n if (note !== undefined && note !== \"\") {\n return { ...baseMetadata, note };\n }\n\n return baseMetadata;\n}\n\n/**\n * Constructs payment metadata from invoice integration data.\n * Invoice fields are authoritative and override any defaults.\n * Pure function ensuring consistent metadata structure for integrations.\n *\n * @param params - Invoice and account configuration\n * @returns Immutable PaymentRequestMetadata object\n */\nexport function buildPaymentMetadataFromInvoice(\n params: BuildPaymentMetadataFromInvoiceParams,\n): PaymentRequestMetadata {\n const { tokenSymbol, fromAccountAddress, payer, invoiceMetadata } = params;\n\n const baseMetadata: PaymentRequestMetadata = {\n type: OrchestrationType.PaymentRequest,\n token: tokenSymbol,\n amountDue: formatAmount(Number(invoiceMetadata.amount)),\n currency: invoiceMetadata.currency,\n dueDate: formatToNaiveDateTime(invoiceMetadata.dueDate),\n fromAccountAddress,\n payer,\n source: invoiceMetadata.source,\n invoiceId: invoiceMetadata.invoiceId,\n invoiceNumber: invoiceMetadata.invoiceNumber,\n };\n\n // Build optional fields immutably\n const optionalFields: Partial<PaymentRequestMetadata> = {\n ...(invoiceMetadata.description && { note: invoiceMetadata.description }),\n ...(invoiceMetadata.attachmentUrl && {\n attachmentUrl: invoiceMetadata.attachmentUrl,\n }),\n ...(invoiceMetadata.attachmentName && {\n attachmentName: invoiceMetadata.attachmentName,\n }),\n };\n\n return { ...baseMetadata, ...optionalFields };\n}\n\n/**\n * Merges invoice data from external integrations with base payment metadata.\n * Invoice fields override manual entries to ensure accuracy and maintain\n * audit trail through source/invoiceId tracking.\n *\n * @param params - Invoice and base metadata configuration\n * @returns Immutable PaymentRequestMetadata with merged fields\n */\nexport function buildInvoiceMetadata(\n params: BuildInvoiceMetadataParams,\n): PaymentRequestMetadata {\n const { invoiceMetadata, baseMetadata } = params;\n\n const mergedMetadata: PaymentRequestMetadata = {\n ...baseMetadata,\n // Invoice amounts/dates are authoritative\n amountDue: formatAmount(Number(invoiceMetadata.amount)),\n currency: invoiceMetadata.currency,\n dueDate: formatToNaiveDateTime(invoiceMetadata.dueDate),\n // Preserve user's manual note if invoice doesn't provide one\n note: invoiceMetadata.description ?? baseMetadata.note,\n // Track integration source for reconciliation and debugging\n source: invoiceMetadata.source,\n invoiceId: invoiceMetadata.invoiceId,\n invoiceNumber: invoiceMetadata.invoiceNumber,\n };\n\n // Build optional attachment fields immutably\n const attachmentFields: Partial<PaymentRequestMetadata> = {\n ...(invoiceMetadata.attachmentUrl && {\n attachmentUrl: invoiceMetadata.attachmentUrl,\n }),\n ...(invoiceMetadata.attachmentName && {\n attachmentName: invoiceMetadata.attachmentName,\n }),\n };\n\n return { ...mergedMetadata, ...attachmentFields };\n}\n\n/**\n * Validates payment metadata structure before sending to backend API.\n * Catches type mismatches and invalid values that would cause payment\n * creation failures or blockchain transaction errors.\n *\n * Pure function returning immutable result object.\n *\n * @param metadata - Metadata to validate\n * @returns Validation result with explicit errors array\n */\nexport function validatePaymentMetadata(\n metadata: PaymentRequestMetadata,\n): MetadataValidationResult {\n const errors: string[] = [];\n\n // Type discriminator validation\n if (metadata.type !== OrchestrationType.PaymentRequest) {\n errors.push(\n `Metadata type must be '${OrchestrationType.PaymentRequest}', got '${String(metadata.type)}'`,\n );\n }\n\n // Token symbol validation\n if (!metadata.token || typeof metadata.token !== \"string\") {\n errors.push(\"Token symbol is required and must be a string\");\n }\n\n // Amount validation - must be valid positive decimal string\n if (!metadata.amountDue || typeof metadata.amountDue !== \"string\") {\n errors.push(\"Amount due is required and must be a string\");\n } else {\n const amount = parseFloat(metadata.amountDue);\n if (!isValidMonetaryAmount(amount) || amount < 0) {\n errors.push(\n `Amount must be a valid non-negative number, got '${metadata.amountDue}'`,\n );\n }\n }\n\n // Currency validation\n if (!metadata.currency || typeof metadata.currency !== \"string\") {\n errors.push(\"Currency is required and must be a string\");\n }\n\n // Due date validation - must be valid date string\n if (!metadata.dueDate || typeof metadata.dueDate !== \"string\") {\n errors.push(\"Due date is required and must be a string\");\n } else {\n const date = new Date(metadata.dueDate);\n if (!isValidDate(date)) {\n errors.push(\n `Due date must be a valid date string, got '${metadata.dueDate}'`,\n );\n }\n }\n\n // From account address validation\n if (\n !metadata.fromAccountAddress ||\n typeof metadata.fromAccountAddress !== \"string\"\n ) {\n errors.push(\"From account address is required and must be a string\");\n }\n\n // Payer validation - required with both name and address\n if (!metadata.payer) {\n errors.push(\"Payer information is required\");\n } else {\n if (typeof metadata.payer.name !== \"string\") {\n errors.push(\"Payer name must be a string\");\n }\n if (!metadata.payer.address || typeof metadata.payer.address !== \"string\") {\n errors.push(\"Payer address is required and must be a string\");\n }\n }\n\n // Source validation\n if (!metadata.source || typeof metadata.source !== \"string\") {\n errors.push(\"Source is required and must be a string\");\n }\n\n return {\n isValid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AC5F;AAIH,KAAI,CAAC,SAAS,SAAS,OAAO,SAAS,UAAU,SAC/C,QAAO,KAAK,gDAAgD;AAI9D,KAAI,CAAC,SAAS,aAAa,OAAO,SAAS,cAAc,SACvD,QAAO,KAAK,8CAA8C;MACrD;EACL,MAAM,SAAS,WAAW,SAAS,UAAU;AAC7C,MAAI,CAAC,sBAAsB,OAAO,IAAI,SAAS,EAC7C,QAAO,KACL,oDAAoD,SAAS,UAAU,GACxE;;AAKL,KAAI,CAAC,SAAS,YAAY,OAAO,SAAS,aAAa,SACrD,QAAO,KAAK,4CAA4C;AAI1D,KAAI,CAAC,SAAS,WAAW,OAAO,SAAS,YAAY,SACnD,QAAO,KAAK,4CAA4C;UAGpD,CAACD,yBADQ,IAAI,KAAK,SAAS,QAAQ,CACjB,CACpB,QAAO,KACL,8CAA8C,SAAS,QAAQ,GAChE;AAKL,KACE,CAAC,SAAS,sBACV,OAAO,SAAS,uBAAuB,SAEvC,QAAO,KAAK,wDAAwD;AAItE,KAAI,CAAC,SAAS,MACZ,QAAO,KAAK,gCAAgC;MACvC;AACL,MAAI,OAAO,SAAS,MAAM,SAAS,SACjC,QAAO,KAAK,8BAA8B;AAE5C,MAAI,CAAC,SAAS,MAAM,WAAW,OAAO,SAAS,MAAM,YAAY,SAC/D,QAAO,KAAK,iDAAiD;;AAKjE,KAAI,CAAC,SAAS,UAAU,OAAO,SAAS,WAAW,SACjD,QAAO,KAAK,0CAA0C;AAGxD,QAAO;EACL,SAAS,OAAO,WAAW;EAC3B;EACD"}
1
+ {"version":3,"file":"index.js","names":["mainnet","optimism","arbitrum","base","sepolia","baseSepolia","DEFAULT_ADDRESS","InstructionAction","eip712TypesMap","DEFAULT_ADDRESS","isValidDate","isNumber"],"sources":["../../src/payments/types.ts","../../src/payments/config/cctp.ts","../../src/payments/config/tokens.ts","../../src/payments/build.ts","../../src/payments/instruction-registry.ts","../../src/payments/action-names.ts","../../src/payments/validation.ts","../../src/payments/chain-token-config-builder.ts","../../src/payments/payment-request-token-resolver.ts","../../src/payments/payment-metadata-builder.ts"],"sourcesContent":["import type { Address, HexString } from \"@otim/utils/schemas\";\n\nexport const PaymentAction = {\n Sweep: \"Sweep\",\n SweepCCTP: \"SweepCCTP\",\n SweepERC20: \"SweepERC20\",\n SweepUniswapV3: \"SweepUniswapV3\",\n SweepDepositERC4626: \"SweepDepositERC4626\",\n} as const;\nexport type PaymentAction = (typeof PaymentAction)[keyof typeof PaymentAction];\nexport interface BaseEphemeralInstructionPayload {\n chainId: number;\n maxExecutions: number;\n fee: {\n maxBaseFeePerGas: HexString;\n maxPriorityFeePerGas: HexString;\n token: Address;\n };\n}\n\nexport interface TokenSpec {\n address: Address;\n decimals: number;\n symbol: string;\n}\n\n/**\n * Orchestration type discriminant.\n * Must match the Rust OrchestrationMetadata enum variants.\n */\nexport const OrchestrationType = {\n PaymentRequest: \"PaymentRequest\",\n AutoEarn: \"AutoEarn\",\n} as const;\nexport type OrchestrationType =\n (typeof OrchestrationType)[keyof typeof OrchestrationType];\n\n/**\n * Payer information for a payment request.\n * Matches Rust `Payer` struct in orchestration.rs.\n */\nexport interface Payer {\n /* Name of the payer (required, can be empty string if unknown) */\n readonly name: string;\n /* Wallet address of the payer */\n readonly address: Address;\n}\n\n/**\n * Payment request metadata stored in orchestration.\n * Matches Rust `PaymentRequestMetadata` struct with serde camelCase renaming.\n *\n * Required fields are enforced at type level to prevent runtime errors.\n * Optional fields match Rust `Option<T>` semantics.\n *\n * Extends Record<string, unknown> for API schema compatibility with\n * `buildSettlementRequestSchema` which expects a flexible metadata object.\n */\nexport interface PaymentRequestMetadata extends Record<string, unknown> {\n /* Discriminant field for backend OrchestrationMetadata enum. Always \"PaymentRequest\". */\n type: typeof OrchestrationType.PaymentRequest;\n /* Token symbol (e.g., \"USDC\", \"USDT\") */\n token: string;\n /* Amount due as a decimal string (e.g., \"150.00\") */\n amountDue: string;\n /* Currency code (e.g., \"USD\") */\n currency: string;\n /* Due date in NaiveDateTime format (YYYY-MM-DDTHH:mm:ss, no timezone) */\n dueDate?: string;\n /* Address of the account receiving payment */\n fromAccountAddress: Address;\n /* Payer information. Optional for payment requests without known payer. */\n payer?: Payer;\n /* Source of the payment request (e.g., \"Manual\", \"Stripe\", \"QuickBooks\") */\n source: string;\n /* Optional note or description for the payment */\n note?: string;\n /* External invoice ID from the source system */\n invoiceId?: string;\n /* Human-readable invoice number */\n invoiceNumber?: string;\n /* URL to the invoice attachment */\n attachmentUrl?: string;\n /* Filename of the attachment */\n attachmentName?: string;\n}\n\n/**\n * Auto-earn metadata stored in orchestration.\n * Matches Rust `AutoEarnMetadata` struct with serde camelCase renaming.\n */\nexport interface AutoEarnMetadata extends Record<string, unknown> {\n /* Discriminant field for backend OrchestrationMetadata enum. Always \"AutoEarn\". */\n type: typeof OrchestrationType.AutoEarn;\n /* Token symbol (e.g., \"USDC\") */\n tokenSymbol: string;\n /* Address of the vault contract */\n vaultAddress: Address;\n /* Human-readable name of the vault */\n vaultName: string;\n}\n\n/**\n * Union type for orchestration metadata.\n */\nexport type OrchestrationMetadata = PaymentRequestMetadata | AutoEarnMetadata;\n\n/**\n * Uniswap V3 fee tiers. Used to specify the fee tier for a Uniswap V3 swap.\n * @see https://docs.uniswap.org/concepts/protocol/fees\n */\nexport const UniswapV3FeeTier = {\n Lowest: \"100\",\n Low: \"500\",\n Medium: \"3000\",\n High: \"10000\",\n} as const;\nexport type UniswapV3FeeTier =\n (typeof UniswapV3FeeTier)[keyof typeof UniswapV3FeeTier];\n","import type { Nullable } from \"@otim/utils/helpers\";\n\nimport {\n arbitrum,\n base,\n baseSepolia,\n mainnet,\n optimism,\n sepolia,\n} from \"viem/chains\";\n\nexport interface CCTPConfig {\n supportedChainIds: Set<number>;\n isSupported(chainId: number): boolean;\n getDomain(chainId: number): Nullable<number>;\n}\n\n/**\n * List of chains that support CCTP\n * Only includes chains that have confirmed CCTP support from Circle\n * @see https://developers.circle.com/stablecoins/docs/supported-domains\n */\nconst cctpSupportedChains = new Set([\n mainnet.id,\n optimism.id,\n arbitrum.id,\n base.id,\n sepolia.id,\n baseSepolia.id,\n]);\n\n/**\n * CCTP Domain Mapping - Maps chain IDs to their Circle CCTP domain identifiers\n * Source: https://developers.circle.com/stablecoins/docs/supported-domains\n *\n * Domain IDs are used by Circle's Cross-Chain Transfer Protocol (CCTP) to\n * identify destination chains when burning and minting USDC across different\n * networks.\n */\nconst cctpDomainMapping: Record<number, number> = {\n [mainnet.id]: 0,\n [optimism.id]: 2,\n [arbitrum.id]: 3,\n [base.id]: 6,\n [sepolia.id]: 0,\n [baseSepolia.id]: 6,\n};\n\nexport class DefaultCCTPConfig implements CCTPConfig {\n supportedChainIds: Set<number>;\n\n constructor() {\n this.supportedChainIds = cctpSupportedChains;\n }\n\n isSupported(chainId: number): boolean {\n return this.supportedChainIds.has(chainId);\n }\n\n getDomain(chainId: number): Nullable<number> {\n return cctpDomainMapping[chainId] ?? null;\n }\n}\n\nexport const defaultCCTPConfig = new DefaultCCTPConfig();\n","import { isStablecoin } from \"@otim/utils/chains\";\n\nimport { UniswapV3FeeTier } from \"../types\";\n\n/**\n * Determines the recommended Uniswap V3 fee tier for a token pair\n *\n * Stable pairs (USDC/USDT swaps) use the Low fee tier (0.05%) since price\n * volatility is minimal. All other pairs use the Medium fee tier (0.3%) to\n * account for higher price volatility\n *\n * @param tokenIn - Symbol of the input token (e.g., \"USDC\", \"USDT\")\n * @param tokenOut - Symbol of the output token (e.g., \"USDC\", \"USDT\")\n * @returns The recommended Uniswap V3 fee tier for the swap\n */\nexport function getRecommendedFeeTier(\n tokenIn: string,\n tokenOut: string,\n): UniswapV3FeeTier {\n if (isStablecoin([tokenIn, tokenOut])) {\n return UniswapV3FeeTier.Low;\n }\n\n return UniswapV3FeeTier.Medium;\n}\n","import type { PaymentRequestBuildRequest } from \"@otim/utils/api\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { Address, HexString } from \"@otim/utils/schemas\";\n\nimport { DEFAULT_ADDRESS } from \"@otim/utils/helpers\";\n\nexport interface EphemeralInstructionSpec {\n chainId: number;\n salt?: number;\n maxExecutions: number;\n actionArguments: Record<string, unknown>;\n setEphemeralTarget?: boolean;\n}\n\nexport interface BuildPaymentRequestParams {\n payerAddress?: Nullable<Address>;\n completionInstructions: EphemeralInstructionSpec[];\n instructions?: EphemeralInstructionSpec[];\n /** Flexible metadata object - matches API schema z.record(z.string(), z.unknown()) */\n metadata?: Record<string, unknown>;\n maxRuns?: number;\n}\n\ninterface ProcessedInstruction {\n chainId: number;\n salt: number;\n maxExecutions: number;\n actionArguments: Record<string, unknown>;\n setEphemeralTarget: boolean;\n}\n\nexport interface FeeConfig {\n executionFee: number;\n maxBaseFeePerGas: `0x${string}`;\n maxPriorityFeePerGas: `0x${string}`;\n token: Address;\n}\n\nconst DEFAULT_SET_EPHEMERAL_TARGET = true;\n\nexport function createPaymentRequestBuildPayload(\n params: BuildPaymentRequestParams,\n): PaymentRequestBuildRequest {\n const {\n payerAddress = null,\n completionInstructions,\n instructions = [],\n metadata = {},\n maxRuns,\n } = params;\n\n return {\n payerAddress,\n completionInstructions: completionInstructions.map(processInstruction),\n instructions: instructions.map(processInstruction),\n metadata,\n maxRuns,\n };\n}\n\nfunction processInstruction(\n spec: EphemeralInstructionSpec,\n): ProcessedInstruction {\n return {\n chainId: spec.chainId,\n salt: spec.salt ?? generateRandomSalt(),\n maxExecutions: spec.maxExecutions,\n actionArguments: spec.actionArguments,\n setEphemeralTarget: spec.setEphemeralTarget ?? DEFAULT_SET_EPHEMERAL_TARGET,\n };\n}\n\nfunction generateRandomSalt(): number {\n return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);\n}\n\nexport function createDefaultFee(\n executionFee = 0,\n maxBaseFeePerGas: HexString = \"0x0\",\n maxPriorityFeePerGas: HexString = \"0x0\",\n token: Address = DEFAULT_ADDRESS,\n): FeeConfig {\n return {\n token,\n executionFee,\n maxBaseFeePerGas,\n maxPriorityFeePerGas,\n };\n}\n\nexport function createFeeWithToken(\n token?: Address,\n maxPriorityFeePerGas?: `0x${string}`,\n): FeeConfig {\n return createDefaultFee(0, \"0x0\", maxPriorityFeePerGas ?? \"0x0\", token);\n}\n","import type { EIP712Types } from \"@otim/utils/instructions\";\nimport type { AbiParameter } from \"abitype\";\n\nimport { eip712TypesMap } from \"@otim/utils/instructions\";\nimport { InstructionAction } from \"@otim/utils/schemas\";\n\nconst feeAbiComponent = {\n name: \"fee\",\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"maxBaseFeePerGas\", type: \"uint256\" },\n { name: \"maxPriorityFeePerGas\", type: \"uint256\" },\n { name: \"executionFee\", type: \"uint256\" },\n ],\n} as const satisfies AbiParameter;\n\nconst sweepAbi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"target\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"gasLimit\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepERC20Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"target\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepCCTPAbi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"destinationDomain\", type: \"uint32\" },\n { name: \"destinationMintRecipient\", type: \"bytes32\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepUniswapV3Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"recipient\", type: \"address\" },\n { name: \"tokenIn\", type: \"address\" },\n { name: \"tokenOut\", type: \"address\" },\n { name: \"feeTier\", type: \"uint24\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"floorAmountOut\", type: \"uint256\" },\n { name: \"meanPriceLookBack\", type: \"uint32\" },\n { name: \"maxPriceDeviationBPS\", type: \"uint32\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepSkipCCTPDepositAccountAbi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"depositor\", type: \"address\" },\n { name: \"destinationDomain\", type: \"uint32\" },\n { name: \"destinationMintRecipient\", type: \"bytes32\" },\n { name: \"threshold\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepDepositERC4626Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"vault\", type: \"address\" },\n { name: \"recipient\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"minDeposit\", type: \"uint256\" },\n { name: \"minTotalShares\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst sweepWithdrawERC4626Abi: readonly AbiParameter[] = [\n {\n type: \"tuple\",\n components: [\n { name: \"vault\", type: \"address\" },\n { name: \"recipient\", type: \"address\" },\n { name: \"threshold\", type: \"uint256\" },\n { name: \"endBalance\", type: \"uint256\" },\n { name: \"minWithdraw\", type: \"uint256\" },\n feeAbiComponent,\n ],\n },\n] as const;\n\nconst actionAbiMap = {\n [InstructionAction.Sweep]: sweepAbi,\n [InstructionAction.SweepERC20]: sweepERC20Abi,\n [InstructionAction.SweepCCTP]: sweepCCTPAbi,\n [InstructionAction.SweepUniswapV3]: sweepUniswapV3Abi,\n [InstructionAction.SweepSkipCCTPDepositAccount]: sweepSkipCCTPDepositAccountAbi,\n [InstructionAction.SweepDepositERC4626]: sweepDepositERC4626Abi,\n [InstructionAction.SweepWithdrawERC4626]: sweepWithdrawERC4626Abi,\n} as const;\n\nexport interface InstructionTypeDefinition {\n abi: readonly AbiParameter[];\n eip712Types: EIP712Types;\n}\n\ntype ActionName = keyof typeof actionAbiMap;\n\nclass InstructionTypeRegistry {\n private registry = new Map<string, InstructionTypeDefinition>();\n\n constructor() {\n this.initializeDefaultTypes();\n }\n\n register(actionName: string, definition: InstructionTypeDefinition): void {\n this.registry.set(actionName, definition);\n }\n\n get(actionName: string): InstructionTypeDefinition {\n const definition = this.registry.get(actionName);\n\n if (!definition) {\n throw this.createUnsupportedTypeError(actionName);\n }\n\n return definition;\n }\n\n has(actionName: string): boolean {\n return this.registry.has(actionName);\n }\n\n getAvailableTypes(): string[] {\n return Array.from(this.registry.keys());\n }\n\n private initializeDefaultTypes(): void {\n const actionNames = Object.keys(actionAbiMap) as ActionName[];\n\n for (const actionName of actionNames) {\n const abi = actionAbiMap[actionName];\n const eip712Types = eip712TypesMap[actionName];\n\n if (abi && eip712Types) {\n this.register(actionName, { abi, eip712Types });\n }\n }\n }\n\n private createUnsupportedTypeError(actionName: string): Error {\n const availableTypes = this.getAvailableTypes().join(\", \");\n return new Error(\n `Unsupported instruction type: ${actionName}. Available: ${availableTypes}`,\n );\n }\n}\n\nexport const instructionRegistry = new InstructionTypeRegistry();\n","import type { PaymentRequestBuildResponse } from \"@otim/utils/api\";\nimport type { Optional } from \"@otim/utils/helpers\";\n\ninterface InstructionWithActionName {\n actionName?: string;\n}\n\nexport interface PaymentResponseWithActionNames extends PaymentRequestBuildResponse {\n completionInstructions: Array<\n PaymentRequestBuildResponse[\"completionInstructions\"][number] &\n InstructionWithActionName\n >;\n instructions: Array<\n PaymentRequestBuildResponse[\"instructions\"][number] &\n InstructionWithActionName\n >;\n}\n\ninterface InstructionWithArguments {\n actionArguments: Record<string, unknown>;\n}\n\ntype ActionNamesMap = Record<number, string>;\n\nexport function addActionNamesToInstructions(\n buildResponse: PaymentRequestBuildResponse,\n actionNames: ActionNamesMap,\n): PaymentResponseWithActionNames {\n const completionInstructionCount =\n buildResponse.completionInstructions.length;\n\n return {\n ...buildResponse,\n completionInstructions: buildResponse.completionInstructions.map(\n (instruction, index) => ({\n ...instruction,\n actionName: actionNames[index],\n }),\n ),\n instructions: buildResponse.instructions.map((instruction, index) => ({\n ...instruction,\n actionName: actionNames[completionInstructionCount + index],\n })),\n };\n}\n\nexport function extractActionNamesMap(\n completionInstructions: InstructionWithArguments[],\n instructions: InstructionWithArguments[] = [],\n): ActionNamesMap {\n const allInstructions = [...completionInstructions, ...instructions];\n\n return allInstructions.reduce<ActionNamesMap>(\n (actionNamesMap, instruction, index) => {\n const actionName = getFirstActionArgumentKey(instruction.actionArguments);\n if (actionName) {\n actionNamesMap[index] = actionName;\n }\n return actionNamesMap;\n },\n {},\n );\n}\n\nfunction getFirstActionArgumentKey(\n actionArguments: Record<string, unknown>,\n): Optional<string> {\n const keys = Object.keys(actionArguments);\n return keys[0];\n}\n","interface SignatureCountAssertion {\n expected: number;\n received: number;\n}\n\n/* Used to validate the number of signatures in a payment request. */\nexport class SignatureValidator {\n static assertExactCount(context: SignatureCountAssertion): void {\n if (context.received !== context.expected) {\n throw new Error(\n `Signature count mismatch: expected ${context.expected}, received ${context.received}`,\n );\n }\n }\n\n static assertMinimumCount(context: SignatureCountAssertion): void {\n if (context.received < context.expected) {\n throw new Error(\n `Insufficient signatures: expected at least ${context.expected}, received ${context.received}`,\n );\n }\n }\n}\n\nexport function assertSignatureCount<T>(\n signatures: T[],\n expectedCount: number,\n): asserts signatures is T[] & { length: typeof expectedCount } {\n SignatureValidator.assertExactCount({\n expected: expectedCount,\n received: signatures.length,\n });\n}\n\nexport function assertMinimumSignatures<T>(\n signatures: T[],\n minimumCount: number,\n): asserts signatures is T[] & { length: number } {\n SignatureValidator.assertMinimumCount({\n expected: minimumCount,\n received: signatures.length,\n });\n}\n","import type { HexString } from \"../schemas\";\nimport type { ChainTokenConfig } from \"./comprehensive-payment-request\";\n\ninterface Token {\n address: string;\n symbol: string;\n chainId: number;\n decimals: number;\n}\n\nexport function createChainTokenConfigs(tokens: Token[]): ChainTokenConfig[] {\n const tokensByChain = groupTokensByChainId(tokens);\n return convertToChainConfigs(tokensByChain);\n}\n\nfunction groupTokensByChainId(tokens: Token[]): Map<number, Token[]> {\n const grouped = new Map<number, Token[]>();\n\n for (const token of tokens) {\n const chainTokens = grouped.get(token.chainId) ?? [];\n chainTokens.push(token);\n grouped.set(token.chainId, chainTokens);\n }\n\n return grouped;\n}\n\nfunction convertToChainConfigs(\n tokensByChain: Map<number, Token[]>,\n): ChainTokenConfig[] {\n return Array.from(tokensByChain.entries()).map(([chainId, tokens]) => ({\n chainId,\n tokens: tokens.map((token) => ({\n symbol: token.symbol,\n address: token.address as HexString,\n decimals: token.decimals,\n })),\n }));\n}\n","import type { Nullish } from \"@otim/utils/helpers\";\nimport type { Address } from \"@otim/utils/schemas\";\n\nimport { DEFAULT_ADDRESS } from \"@otim/utils/helpers\";\n\ninterface Token {\n symbol: string;\n address: string;\n}\n\n/* Checks if a token is the native blockchain token (ETH). */\nexport function isNativeToken<T extends Pick<Token, \"symbol\" | \"address\">>(\n token: Nullish<T>,\n): boolean {\n if (!token) return false;\n\n return (\n token.symbol === \"ETH\" ||\n token.address.toLowerCase() === DEFAULT_ADDRESS.toLowerCase()\n );\n}\n\n/* Creates unique identifier for a token by combining chain ID and address. */\nexport function createTokenIdentifier(\n chainId: number,\n tokenAddress: Address,\n): string {\n return `${chainId}:${tokenAddress}`;\n}\n","import type { InvoiceMetadata } from \"./payment-metadata\";\nimport type { Payer, PaymentRequestMetadata } from \"./types\";\nimport type { Address } from \"../schemas\";\n\nimport { OrchestrationType } from \"./types\";\nimport { isValidDate } from \"../helpers/date\";\nimport { isNumber } from \"../helpers/types\";\n\n/* Default currency for payments. Centralized for easy modification. */\nconst DEFAULT_CURRENCY = \"USD\" as const;\n\n/* Default source for manually created payment requests */\nconst DEFAULT_SOURCE = \"Manual\" as const;\n\n/**\n * Input parameters for building manual payment metadata.\n * All fields are explicit and required unless marked optional.\n */\nexport interface BuildPaymentMetadataParams {\n /* Token symbol (e.g., \"USDC\", \"USDT\") */\n readonly tokenSymbol: string;\n /* Due date in ISO 8601 or parseable date format */\n readonly dueDate: string;\n /* Amount in USD (numeric, will be formatted to 2 decimal places) */\n readonly amountInUSD: number;\n /* Address of the account receiving payment */\n readonly fromAccountAddress: Address;\n /* Payer information */\n readonly payer: Payer;\n /* Optional note for the payment */\n readonly note?: string;\n /* Source of the payment request. Defaults to \"Manual\". */\n readonly source?: string;\n}\n\n/**\n * Input parameters for building payment metadata from invoice integration.\n * Invoice fields take precedence over any manual overrides.\n */\nexport interface BuildPaymentMetadataFromInvoiceParams {\n /* Token symbol (e.g., \"USDC\", \"USDT\") */\n readonly tokenSymbol: string;\n /* Address of the account receiving payment */\n readonly fromAccountAddress: Address;\n /* Payer information */\n readonly payer: Payer;\n /* Invoice metadata from external integration */\n readonly invoiceMetadata: InvoiceMetadata;\n}\n\n/**\n * Input parameters for merging invoice data with existing base metadata.\n * Invoice fields override base metadata to ensure accuracy.\n */\nexport interface BuildInvoiceMetadataParams {\n /* Invoice metadata from external integration */\n readonly invoiceMetadata: InvoiceMetadata;\n /* Base payment metadata to merge with invoice data */\n readonly baseMetadata: PaymentRequestMetadata;\n}\n\n/**\n * Result of metadata validation.\n * Immutable result object for type safety.\n */\nexport interface MetadataValidationResult {\n readonly isValid: boolean;\n readonly errors: readonly string[];\n}\n\n/**\n * Formats a date to NaiveDateTime format expected by Rust backend.\n * Converts ISO 8601 strings like \"2025-01-15T00:00:00.000Z\" to \"2025-01-15T00:00:00\".\n *\n * Rust's chrono::NaiveDateTime expects format without timezone suffix.\n *\n * @param dateInput - Date string or Date object to format\n * @returns Formatted NaiveDateTime string\n * @throws Error if date is invalid\n */\nfunction formatToNaiveDateTime(dateInput: string | Date): string {\n const date = typeof dateInput === \"string\" ? new Date(dateInput) : dateInput;\n\n if (!isValidDate(date)) {\n throw new Error(`Invalid date provided: ${String(dateInput)}`);\n }\n\n const year = date.getUTCFullYear();\n const month = String(date.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(date.getUTCDate()).padStart(2, \"0\");\n const hours = String(date.getUTCHours()).padStart(2, \"0\");\n const minutes = String(date.getUTCMinutes()).padStart(2, \"0\");\n const seconds = String(date.getUTCSeconds()).padStart(2, \"0\");\n\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;\n}\n\n/**\n * Formats a numeric amount to a decimal string with 2 decimal places.\n * Ensures consistent formatting for monetary values.\n *\n * @param amount - Numeric amount to format\n * @returns Formatted amount string (e.g., \"150.00\")\n */\nfunction formatAmount(amount: number): string {\n return amount.toFixed(2);\n}\n\n/**\n * Validates that a value is a safe, finite number suitable for monetary amounts.\n * Excludes NaN and Infinity which could cause calculation errors downstream.\n *\n * @param value - Value to validate\n * @returns True if value is a valid monetary amount\n */\nfunction isValidMonetaryAmount(value: unknown): value is number {\n return isNumber(value) && Number.isFinite(value);\n}\n\n/**\n * Constructs payment metadata for manually created payment requests.\n * Pure function with explicit input/output contract.\n *\n * @param params - Configuration for manual payment request\n * @returns Immutable PaymentRequestMetadata object\n */\nexport function buildPaymentMetadata(\n params: BuildPaymentMetadataParams,\n): PaymentRequestMetadata {\n const {\n tokenSymbol,\n note,\n dueDate,\n amountInUSD,\n fromAccountAddress,\n payer,\n source = DEFAULT_SOURCE,\n } = params;\n\n const baseMetadata: PaymentRequestMetadata = {\n type: OrchestrationType.PaymentRequest,\n token: tokenSymbol,\n amountDue: formatAmount(amountInUSD),\n currency: DEFAULT_CURRENCY,\n dueDate: formatToNaiveDateTime(dueDate),\n fromAccountAddress,\n payer,\n source,\n };\n\n // Conditionally add optional fields (pure spread, no mutation)\n if (note !== undefined && note !== \"\") {\n return { ...baseMetadata, note };\n }\n\n return baseMetadata;\n}\n\n/**\n * Constructs payment metadata from invoice integration data.\n * Invoice fields are authoritative and override any defaults.\n * Pure function ensuring consistent metadata structure for integrations.\n *\n * @param params - Invoice and account configuration\n * @returns Immutable PaymentRequestMetadata object\n */\nexport function buildPaymentMetadataFromInvoice(\n params: BuildPaymentMetadataFromInvoiceParams,\n): PaymentRequestMetadata {\n const { tokenSymbol, fromAccountAddress, payer, invoiceMetadata } = params;\n\n const baseMetadata: PaymentRequestMetadata = {\n type: OrchestrationType.PaymentRequest,\n token: tokenSymbol,\n amountDue: formatAmount(Number(invoiceMetadata.amount)),\n currency: invoiceMetadata.currency,\n dueDate: formatToNaiveDateTime(invoiceMetadata.dueDate),\n fromAccountAddress,\n payer,\n source: invoiceMetadata.source,\n invoiceId: invoiceMetadata.invoiceId,\n invoiceNumber: invoiceMetadata.invoiceNumber,\n };\n\n // Build optional fields immutably\n const optionalFields: Partial<PaymentRequestMetadata> = {\n ...(invoiceMetadata.description && { note: invoiceMetadata.description }),\n ...(invoiceMetadata.attachmentUrl && {\n attachmentUrl: invoiceMetadata.attachmentUrl,\n }),\n ...(invoiceMetadata.attachmentName && {\n attachmentName: invoiceMetadata.attachmentName,\n }),\n };\n\n return { ...baseMetadata, ...optionalFields };\n}\n\n/**\n * Merges invoice data from external integrations with base payment metadata.\n * Invoice fields override manual entries to ensure accuracy and maintain\n * audit trail through source/invoiceId tracking.\n *\n * @param params - Invoice and base metadata configuration\n * @returns Immutable PaymentRequestMetadata with merged fields\n */\nexport function buildInvoiceMetadata(\n params: BuildInvoiceMetadataParams,\n): PaymentRequestMetadata {\n const { invoiceMetadata, baseMetadata } = params;\n\n const mergedMetadata: PaymentRequestMetadata = {\n ...baseMetadata,\n // Invoice amounts/dates are authoritative\n amountDue: formatAmount(Number(invoiceMetadata.amount)),\n currency: invoiceMetadata.currency,\n dueDate: formatToNaiveDateTime(invoiceMetadata.dueDate),\n // Preserve user's manual note if invoice doesn't provide one\n note: invoiceMetadata.description ?? baseMetadata.note,\n // Track integration source for reconciliation and debugging\n source: invoiceMetadata.source,\n invoiceId: invoiceMetadata.invoiceId,\n invoiceNumber: invoiceMetadata.invoiceNumber,\n };\n\n // Build optional attachment fields immutably\n const attachmentFields: Partial<PaymentRequestMetadata> = {\n ...(invoiceMetadata.attachmentUrl && {\n attachmentUrl: invoiceMetadata.attachmentUrl,\n }),\n ...(invoiceMetadata.attachmentName && {\n attachmentName: invoiceMetadata.attachmentName,\n }),\n };\n\n return { ...mergedMetadata, ...attachmentFields };\n}\n\n/**\n * Validates payment metadata structure before sending to backend API.\n * Catches type mismatches and invalid values that would cause payment\n * creation failures or blockchain transaction errors.\n *\n * Pure function returning immutable result object.\n *\n * @param metadata - Metadata to validate\n * @returns Validation result with explicit errors array\n */\nexport function validatePaymentMetadata(\n metadata: PaymentRequestMetadata,\n): MetadataValidationResult {\n const errors: string[] = [];\n\n // Type discriminator validation\n if (metadata.type !== OrchestrationType.PaymentRequest) {\n errors.push(\n `Metadata type must be '${OrchestrationType.PaymentRequest}', got '${String(metadata.type)}'`,\n );\n }\n\n // Token symbol validation\n if (!metadata.token || typeof metadata.token !== \"string\") {\n errors.push(\"Token symbol is required and must be a string\");\n }\n\n // Amount validation - must be valid positive decimal string\n if (!metadata.amountDue || typeof metadata.amountDue !== \"string\") {\n errors.push(\"Amount due is required and must be a string\");\n } else {\n const amount = parseFloat(metadata.amountDue);\n if (!isValidMonetaryAmount(amount) || amount < 0) {\n errors.push(\n `Amount must be a valid non-negative number, got '${metadata.amountDue}'`,\n );\n }\n }\n\n // Currency validation\n if (!metadata.currency || typeof metadata.currency !== \"string\") {\n errors.push(\"Currency is required and must be a string\");\n }\n\n // Due date validation - must be valid date string\n if (!metadata.dueDate || typeof metadata.dueDate !== \"string\") {\n errors.push(\"Due date is required and must be a string\");\n } else {\n const date = new Date(metadata.dueDate);\n if (!isValidDate(date)) {\n errors.push(\n `Due date must be a valid date string, got '${metadata.dueDate}'`,\n );\n }\n }\n\n // From account address validation\n if (\n !metadata.fromAccountAddress ||\n typeof metadata.fromAccountAddress !== \"string\"\n ) {\n errors.push(\"From account address is required and must be a string\");\n }\n\n // Payer validation - required with both name and address\n if (!metadata.payer) {\n errors.push(\"Payer information is required\");\n } else {\n if (typeof metadata.payer.name !== \"string\") {\n errors.push(\"Payer name must be a string\");\n }\n if (!metadata.payer.address || typeof metadata.payer.address !== \"string\") {\n errors.push(\"Payer address is required and must be a string\");\n }\n }\n\n // Source validation\n if (!metadata.source || typeof metadata.source !== \"string\") {\n errors.push(\"Source is required and must be a string\");\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n };\n}\n"],"mappings":";;;;;;;;;;;AAEA,MAAa,gBAAgB;CAC3B,OAAO;CACP,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,qBAAqB;CACtB;;;;;AAsBD,MAAa,oBAAoB;CAC/B,gBAAgB;CAChB,UAAU;CACX;;;;;AA8ED,MAAa,mBAAmB;CAC9B,QAAQ;CACR,KAAK;CACL,QAAQ;CACR,MAAM;CACP;;;;;;;;;AC9FD,MAAM,sBAAsB,IAAI,IAAI;CAClCA,oBAAQ;CACRC,qBAAS;CACTC,qBAAS;CACTC,iBAAK;CACLC,oBAAQ;CACRC,wBAAY;CACb,CAAC;;;;;;;;;AAUF,MAAM,oBAA4C;EAC/CL,oBAAQ,KAAK;EACbC,qBAAS,KAAK;EACdC,qBAAS,KAAK;EACdC,iBAAK,KAAK;EACVC,oBAAQ,KAAK;EACbC,wBAAY,KAAK;CACnB;AAED,IAAa,oBAAb,MAAqD;CAGnD,cAAc;+CAFd;AAGE,OAAK,oBAAoB;;CAG3B,YAAY,SAA0B;AACpC,SAAO,KAAK,kBAAkB,IAAI,QAAQ;;CAG5C,UAAU,SAAmC;AAC3C,SAAO,kBAAkB,YAAY;;;AAIzC,MAAa,oBAAoB,IAAI,mBAAmB;;;;;;;;;;;;;;;ACjDxD,SAAgB,sBACd,SACA,UACkB;AAClB,0CAAiB,CAAC,SAAS,SAAS,CAAC,CACnC,QAAO,iBAAiB;AAG1B,QAAO,iBAAiB;;;;;ACe1B,MAAM,+BAA+B;AAErC,SAAgB,iCACd,QAC4B;CAC5B,MAAM,EACJ,eAAe,MACf,wBACA,eAAe,EAAE,EACjB,WAAW,EAAE,EACb,YACE;AAEJ,QAAO;EACL;EACA,wBAAwB,uBAAuB,IAAI,mBAAmB;EACtE,cAAc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MAAM,SAAmB,EAAE;AAG3B,KAAI,SAAS,SAAS,kBAAkB,eACtC,QAAO,KACL,0BAA0B,kBAAkB,eAAe,UAAU,OAAO,SAAS,KAAK,CAAC,GAC5F;AAIH,KAAI,CAAC,SAAS,SAAS,OAAO,SAAS,UAAU,SAC/C,QAAO,KAAK,gDAAgD;AAI9D,KAAI,CAAC,SAAS,aAAa,OAAO,SAAS,cAAc,SACvD,QAAO,KAAK,8CAA8C;MACrD;EACL,MAAM,SAAS,WAAW,SAAS,UAAU;AAC7C,MAAI,CAAC,sBAAsB,OAAO,IAAI,SAAS,EAC7C,QAAO,KACL,oDAAoD,SAAS,UAAU,GACxE;;AAKL,KAAI,CAAC,SAAS,YAAY,OAAO,SAAS,aAAa,SACrD,QAAO,KAAK,4CAA4C;AAI1D,KAAI,CAAC,SAAS,WAAW,OAAO,SAAS,YAAY,SACnD,QAAO,KAAK,4CAA4C;UAGpD,CAACD,yBADQ,IAAI,KAAK,SAAS,QAAQ,CACjB,CACpB,QAAO,KACL,8CAA8C,SAAS,QAAQ,GAChE;AAKL,KACE,CAAC,SAAS,sBACV,OAAO,SAAS,uBAAuB,SAEvC,QAAO,KAAK,wDAAwD;AAItE,KAAI,CAAC,SAAS,MACZ,QAAO,KAAK,gCAAgC;MACvC;AACL,MAAI,OAAO,SAAS,MAAM,SAAS,SACjC,QAAO,KAAK,8BAA8B;AAE5C,MAAI,CAAC,SAAS,MAAM,WAAW,OAAO,SAAS,MAAM,YAAY,SAC/D,QAAO,KAAK,iDAAiD;;AAKjE,KAAI,CAAC,SAAS,UAAU,OAAO,SAAS,WAAW,SACjD,QAAO,KAAK,0CAA0C;AAGxD,QAAO;EACL,SAAS,OAAO,WAAW;EAC3B;EACD"}
@@ -1,5 +1,5 @@
1
- import { t as _defineProperty } from "../defineProperty-DzhmunJg.mjs";
2
- import { P as isNumber, b as isValidDate } from "../date-gBac-Om9.mjs";
1
+ import { t as _defineProperty } from "../defineProperty-D_Wrem5y.mjs";
2
+ import { P as isNumber, b as isValidDate } from "../date-BGw9dSBT.mjs";
3
3
  import { InstructionAction } from "@otim/utils/schemas";
4
4
  import { DEFAULT_ADDRESS } from "@otim/utils/helpers";
5
5
  import { arbitrum, base, baseSepolia, mainnet, optimism, sepolia } from "viem/chains";
@@ -1,2 +1,2 @@
1
- import { $ as InstructionScheduleRepeat, A as EIP2098Signature, At as instructionsSchema, B as decimalStringSchema, Bt as AccountType, C as paymentRequestSourceValues, Ct as instructionSchema, D as DATE_ISO_8601_REGEX, Dt as instructionSummariesSchema, E as ChainId, Et as instructionSummariesByDateSchema, F as bigintSchema, Ft as Contacts, G as regexSchema, H as hexStringSchema, I as chainIdSchema, It as ContactsSchema, J as vrsSchema, K as sortValues, L as dateISO8601Schema, Lt as Brand, M as Sort, Mt as timeUnitValues, N as TIME_REGEX, Nt as Contact, O as DATE_REGEX, Ot as instructionSummarySchema, P as VRS, Pt as ContactSchema, Q as InstructionId, R as dateSchema, Rt as Valid, S as PaymentsSchema, St as instructionScheduleStartValues, T as Address, Tt as instructionStateValues, U as nonEmptyStringSchema, V as eip2098SignatureSchema, W as numberSchema, X as InstructionAction, Y as Instruction, Z as InstructionExecutionState, _ as tokenSchema, _t as instructionScheduleRepeatSchema, a as userPreferencesSchema, at as InstructionState, b as PaymentStatus, bt as instructionScheduleRetryValues, c as TransactionWithValidAmount, ct as InstructionSummary, d as transactionWithValidAmountSchema, dt as TimeUnit, et as InstructionScheduleRepeatType, f as transactionsSchema, ft as assertInstructionAction, g as assertsOptionalToken, gt as instructionIdSchema, h as assertToken, ht as instructionExecutionStateSchema, i as entityIdSchema, it as InstructionScheduleStartType, j as HexString, jt as timeUnitSchema, k as DATE_STANDARD_REGEX, kt as instructionViewTimescaleValues, l as Transactions, lt as InstructionViewTimescale, m as TokenValues, mt as instructionActionValues, n as UserPreferences, nt as InstructionScheduleRetryType, o as userSchema, ot as InstructionSummaries, p as Token, pt as instructionActionSchema, q as timeSchema, r as addressSchema, rt as InstructionScheduleStart, s as Transaction, st as InstructionSummariesByDate, t as User, tt as InstructionScheduleRetry, u as transactionSchema, ut as Instructions, v as Payment, vt as instructionScheduleRepeatValues, w as paymentSchema, wt as instructionStateSchema, x as Payments, xt as instructionScheduleStartSchema, y as PaymentSource, yt as instructionScheduleRetrySchema, z as dateStandardSchema, zt as AccountConnectionStatus } from "../index-DartTKk2.mjs";
1
+ import { $ as InstructionScheduleRepeat, A as EIP2098Signature, At as instructionsSchema, B as decimalStringSchema, Bt as AccountType, C as paymentRequestSourceValues, Ct as instructionSchema, D as DATE_ISO_8601_REGEX, Dt as instructionSummariesSchema, E as ChainId, Et as instructionSummariesByDateSchema, F as bigintSchema, Ft as Contacts, G as regexSchema, H as hexStringSchema, I as chainIdSchema, It as ContactsSchema, J as vrsSchema, K as sortValues, L as dateISO8601Schema, Lt as Brand, M as Sort, Mt as timeUnitValues, N as TIME_REGEX, Nt as Contact, O as DATE_REGEX, Ot as instructionSummarySchema, P as VRS, Pt as ContactSchema, Q as InstructionId, R as dateSchema, Rt as Valid, S as PaymentsSchema, St as instructionScheduleStartValues, T as Address, Tt as instructionStateValues, U as nonEmptyStringSchema, V as eip2098SignatureSchema, W as numberSchema, X as InstructionAction, Y as Instruction, Z as InstructionExecutionState, _ as tokenSchema, _t as instructionScheduleRepeatSchema, a as userPreferencesSchema, at as InstructionState, b as PaymentStatus, bt as instructionScheduleRetryValues, c as TransactionWithValidAmount, ct as InstructionSummary, d as transactionWithValidAmountSchema, dt as TimeUnit, et as InstructionScheduleRepeatType, f as transactionsSchema, ft as assertInstructionAction, g as assertsOptionalToken, gt as instructionIdSchema, h as assertToken, ht as instructionExecutionStateSchema, i as entityIdSchema, it as InstructionScheduleStartType, j as HexString, jt as timeUnitSchema, k as DATE_STANDARD_REGEX, kt as instructionViewTimescaleValues, l as Transactions, lt as InstructionViewTimescale, m as TokenValues, mt as instructionActionValues, n as UserPreferences, nt as InstructionScheduleRetryType, o as userSchema, ot as InstructionSummaries, p as Token, pt as instructionActionSchema, q as timeSchema, r as addressSchema, rt as InstructionScheduleStart, s as Transaction, st as InstructionSummariesByDate, t as User, tt as InstructionScheduleRetry, u as transactionSchema, ut as Instructions, v as Payment, vt as instructionScheduleRepeatValues, w as paymentSchema, wt as instructionStateSchema, x as Payments, xt as instructionScheduleStartSchema, y as PaymentSource, yt as instructionScheduleRetrySchema, z as dateStandardSchema, zt as AccountConnectionStatus } from "../user-CbQLjMOC.mjs";
2
2
  export { AccountConnectionStatus, AccountType, Address, Brand, ChainId, Contact, ContactSchema, Contacts, ContactsSchema, DATE_ISO_8601_REGEX, DATE_REGEX, DATE_STANDARD_REGEX, EIP2098Signature, HexString, Instruction, InstructionAction, InstructionExecutionState, InstructionId, InstructionScheduleRepeat, InstructionScheduleRepeatType, InstructionScheduleRetry, InstructionScheduleRetryType, InstructionScheduleStart, InstructionScheduleStartType, InstructionState, InstructionSummaries, InstructionSummariesByDate, InstructionSummary, InstructionViewTimescale, Instructions, Payment, PaymentSource, PaymentStatus, Payments, PaymentsSchema, Sort, TIME_REGEX, TimeUnit, Token, TokenValues, Transaction, TransactionWithValidAmount, Transactions, User, UserPreferences, VRS, Valid, addressSchema, assertInstructionAction, assertToken, assertsOptionalToken, bigintSchema, chainIdSchema, dateISO8601Schema, dateSchema, dateStandardSchema, decimalStringSchema, eip2098SignatureSchema, entityIdSchema, hexStringSchema, instructionActionSchema, instructionActionValues, instructionExecutionStateSchema, instructionIdSchema, instructionScheduleRepeatSchema, instructionScheduleRepeatValues, instructionScheduleRetrySchema, instructionScheduleRetryValues, instructionScheduleStartSchema, instructionScheduleStartValues, instructionSchema, instructionStateSchema, instructionStateValues, instructionSummariesByDateSchema, instructionSummariesSchema, instructionSummarySchema, instructionViewTimescaleValues, instructionsSchema, nonEmptyStringSchema, numberSchema, paymentRequestSourceValues, paymentSchema, regexSchema, sortValues, timeSchema, timeUnitSchema, timeUnitValues, tokenSchema, transactionSchema, transactionWithValidAmountSchema, transactionsSchema, userPreferencesSchema, userSchema, vrsSchema };
@@ -1,2 +1,2 @@
1
- import { $ as InstructionScheduleRepeat, A as EIP2098Signature, At as instructionsSchema, B as decimalStringSchema, Bt as AccountType, C as paymentRequestSourceValues, Ct as instructionSchema, D as DATE_ISO_8601_REGEX, Dt as instructionSummariesSchema, E as ChainId, Et as instructionSummariesByDateSchema, F as bigintSchema, Ft as Contacts, G as regexSchema, H as hexStringSchema, I as chainIdSchema, It as ContactsSchema, J as vrsSchema, K as sortValues, L as dateISO8601Schema, Lt as Brand, M as Sort, Mt as timeUnitValues, N as TIME_REGEX, Nt as Contact, O as DATE_REGEX, Ot as instructionSummarySchema, P as VRS, Pt as ContactSchema, Q as InstructionId, R as dateSchema, Rt as Valid, S as PaymentsSchema, St as instructionScheduleStartValues, T as Address, Tt as instructionStateValues, U as nonEmptyStringSchema, V as eip2098SignatureSchema, W as numberSchema, X as InstructionAction, Y as Instruction, Z as InstructionExecutionState, _ as tokenSchema, _t as instructionScheduleRepeatSchema, a as userPreferencesSchema, at as InstructionState, b as PaymentStatus, bt as instructionScheduleRetryValues, c as TransactionWithValidAmount, ct as InstructionSummary, d as transactionWithValidAmountSchema, dt as TimeUnit, et as InstructionScheduleRepeatType, f as transactionsSchema, ft as assertInstructionAction, g as assertsOptionalToken, gt as instructionIdSchema, h as assertToken, ht as instructionExecutionStateSchema, i as entityIdSchema, it as InstructionScheduleStartType, j as HexString, jt as timeUnitSchema, k as DATE_STANDARD_REGEX, kt as instructionViewTimescaleValues, l as Transactions, lt as InstructionViewTimescale, m as TokenValues, mt as instructionActionValues, n as UserPreferences, nt as InstructionScheduleRetryType, o as userSchema, ot as InstructionSummaries, p as Token, pt as instructionActionSchema, q as timeSchema, r as addressSchema, rt as InstructionScheduleStart, s as Transaction, st as InstructionSummariesByDate, t as User, tt as InstructionScheduleRetry, u as transactionSchema, ut as Instructions, v as Payment, vt as instructionScheduleRepeatValues, w as paymentSchema, wt as instructionStateSchema, x as Payments, xt as instructionScheduleStartSchema, y as PaymentSource, yt as instructionScheduleRetrySchema, z as dateStandardSchema, zt as AccountConnectionStatus } from "../index-Bv0kUz4w.js";
1
+ import { $ as InstructionScheduleRepeat, A as EIP2098Signature, At as instructionsSchema, B as decimalStringSchema, Bt as AccountType, C as paymentRequestSourceValues, Ct as instructionSchema, D as DATE_ISO_8601_REGEX, Dt as instructionSummariesSchema, E as ChainId, Et as instructionSummariesByDateSchema, F as bigintSchema, Ft as Contacts, G as regexSchema, H as hexStringSchema, I as chainIdSchema, It as ContactsSchema, J as vrsSchema, K as sortValues, L as dateISO8601Schema, Lt as Brand, M as Sort, Mt as timeUnitValues, N as TIME_REGEX, Nt as Contact, O as DATE_REGEX, Ot as instructionSummarySchema, P as VRS, Pt as ContactSchema, Q as InstructionId, R as dateSchema, Rt as Valid, S as PaymentsSchema, St as instructionScheduleStartValues, T as Address, Tt as instructionStateValues, U as nonEmptyStringSchema, V as eip2098SignatureSchema, W as numberSchema, X as InstructionAction, Y as Instruction, Z as InstructionExecutionState, _ as tokenSchema, _t as instructionScheduleRepeatSchema, a as userPreferencesSchema, at as InstructionState, b as PaymentStatus, bt as instructionScheduleRetryValues, c as TransactionWithValidAmount, ct as InstructionSummary, d as transactionWithValidAmountSchema, dt as TimeUnit, et as InstructionScheduleRepeatType, f as transactionsSchema, ft as assertInstructionAction, g as assertsOptionalToken, gt as instructionIdSchema, h as assertToken, ht as instructionExecutionStateSchema, i as entityIdSchema, it as InstructionScheduleStartType, j as HexString, jt as timeUnitSchema, k as DATE_STANDARD_REGEX, kt as instructionViewTimescaleValues, l as Transactions, lt as InstructionViewTimescale, m as TokenValues, mt as instructionActionValues, n as UserPreferences, nt as InstructionScheduleRetryType, o as userSchema, ot as InstructionSummaries, p as Token, pt as instructionActionSchema, q as timeSchema, r as addressSchema, rt as InstructionScheduleStart, s as Transaction, st as InstructionSummariesByDate, t as User, tt as InstructionScheduleRetry, u as transactionSchema, ut as Instructions, v as Payment, vt as instructionScheduleRepeatValues, w as paymentSchema, wt as instructionStateSchema, x as Payments, xt as instructionScheduleStartSchema, y as PaymentSource, yt as instructionScheduleRetrySchema, z as dateStandardSchema, zt as AccountConnectionStatus } from "../user-ZFlczCh8.js";
2
2
  export { AccountConnectionStatus, AccountType, Address, Brand, ChainId, Contact, ContactSchema, Contacts, ContactsSchema, DATE_ISO_8601_REGEX, DATE_REGEX, DATE_STANDARD_REGEX, EIP2098Signature, HexString, Instruction, InstructionAction, InstructionExecutionState, InstructionId, InstructionScheduleRepeat, InstructionScheduleRepeatType, InstructionScheduleRetry, InstructionScheduleRetryType, InstructionScheduleStart, InstructionScheduleStartType, InstructionState, InstructionSummaries, InstructionSummariesByDate, InstructionSummary, InstructionViewTimescale, Instructions, Payment, PaymentSource, PaymentStatus, Payments, PaymentsSchema, Sort, TIME_REGEX, TimeUnit, Token, TokenValues, Transaction, TransactionWithValidAmount, Transactions, User, UserPreferences, VRS, Valid, addressSchema, assertInstructionAction, assertToken, assertsOptionalToken, bigintSchema, chainIdSchema, dateISO8601Schema, dateSchema, dateStandardSchema, decimalStringSchema, eip2098SignatureSchema, entityIdSchema, hexStringSchema, instructionActionSchema, instructionActionValues, instructionExecutionStateSchema, instructionIdSchema, instructionScheduleRepeatSchema, instructionScheduleRepeatValues, instructionScheduleRetrySchema, instructionScheduleRetryValues, instructionScheduleStartSchema, instructionScheduleStartValues, instructionSchema, instructionStateSchema, instructionStateValues, instructionSummariesByDateSchema, instructionSummariesSchema, instructionSummarySchema, instructionViewTimescaleValues, instructionsSchema, nonEmptyStringSchema, numberSchema, paymentRequestSourceValues, paymentSchema, regexSchema, sortValues, timeSchema, timeUnitSchema, timeUnitValues, tokenSchema, transactionSchema, transactionWithValidAmountSchema, transactionsSchema, userPreferencesSchema, userSchema, vrsSchema };
@@ -1,4 +1,5 @@
1
- const require_chunk = require('../chunk-kSYXY2_d.js');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('../chunk-BE-pF4vm.js');
2
3
  let zod = require("zod");
3
4
 
4
5
  //#region src/schemas/account.ts
@@ -36,9 +37,9 @@ const TIME_REGEX = /^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (AM|PM)$/;
36
37
  const regexSchema = (regex, message) => zod.z.string().regex(regex, message);
37
38
  const nonEmptyStringSchema = zod.z.string().min(1);
38
39
  const numberSchema = zod.z.union([zod.z.number().finite(), zod.z.string().regex(/^-?\d*\.?\d+(?:[eE][-+]?\d+)?$/).transform(Number)]);
39
- const decimalStringSchema = zod.z.string().regex(/^-?\d*\.?\d+$/).refine((val) => !isNaN(parseFloat(val)), { message: "Must be a valid decimal number" });
40
+ const decimalStringSchema = zod.z.string({ error: "This field is required" }).regex(/^-?\d*\.?\d+$/).refine((val) => !isNaN(parseFloat(val)), { message: "Must be a valid decimal number" });
40
41
  const bigintSchema = zod.z.union([zod.z.bigint(), zod.z.string().regex(/^-?\d+$/).transform(BigInt)]);
41
- const hexStringSchema = zod.z.string().startsWith("0x").transform((val) => val);
42
+ const hexStringSchema = zod.z.string({ error: "This field is required" }).startsWith("0x").transform((val) => val);
42
43
  const chainIdSchema = zod.z.number().positive();
43
44
  const dateSchema = regexSchema(DATE_REGEX);
44
45
  const dateISO8601Schema = regexSchema(DATE_ISO_8601_REGEX);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["z","z","z","z","z","z","z"],"sources":["../../src/schemas/account.ts","../../src/schemas/contact.ts","../../src/schemas/misc.ts","../../src/schemas/instruction.ts","../../src/schemas/payment.ts","../../src/schemas/token.ts","../../src/schemas/transaction.ts","../../src/schemas/user.ts"],"sourcesContent":["export const AccountType = {\n Otim: \"otim\",\n Bank: \"bank\",\n Ephemeral: \"ephemeral\",\n Custodian: \"custodian\",\n Wallet: \"wallet\",\n} as const;\nexport type AccountType = (typeof AccountType)[keyof typeof AccountType];\n\nexport const AccountConnectionStatus = {\n Connected: \"connected\",\n Disconnected: \"disconnected\",\n Connecting: \"connecting\",\n Reconnecting: \"reconnecting\",\n} as const;\nexport type AccountConnectionStatus =\n (typeof AccountConnectionStatus)[keyof typeof AccountConnectionStatus];\n","import { z } from \"zod\";\n\nexport const ContactSchema = z.object({\n userId: z.string(),\n name: z.string(),\n address: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nexport const ContactsSchema = z.array(ContactSchema);\n\nexport type Contact = z.infer<typeof ContactSchema>;\nexport type Contacts = z.infer<typeof ContactsSchema>;\n","import { z } from \"zod\";\n\nexport const DATE_REGEX =\n /^(19|20)\\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\nexport const DATE_ISO_8601_REGEX =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?$/;\nexport const DATE_STANDARD_REGEX =\n /^(0[1-9]|1[0-2])\\/(0[1-9]|[12][0-9]|3[01])\\/(19|20)\\d{2}$/;\nexport const TIME_REGEX = /^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (AM|PM)$/;\n\nexport const regexSchema = (regex: RegExp, message?: string) =>\n z.string().regex(regex, message);\n\nexport const nonEmptyStringSchema = z.string().min(1);\n\nexport const numberSchema = z.union([\n z.number().finite(),\n z\n .string()\n .regex(/^-?\\d*\\.?\\d+(?:[eE][-+]?\\d+)?$/)\n .transform(Number),\n]);\n\nexport const decimalStringSchema = z\n .string()\n .regex(/^-?\\d*\\.?\\d+$/)\n .refine((val) => !isNaN(parseFloat(val)), {\n message: \"Must be a valid decimal number\",\n });\n\nexport const bigintSchema = z.union([\n z.bigint(),\n z\n .string()\n .regex(/^-?\\d+$/)\n .transform(BigInt),\n]);\n\nexport const hexStringSchema = z\n .string()\n .startsWith(\"0x\")\n .transform((val): `0x${string}` => val as `0x${string}`);\n\nexport const chainIdSchema = z.number().positive();\n\nexport const dateSchema = regexSchema(DATE_REGEX);\nexport const dateISO8601Schema = regexSchema(DATE_ISO_8601_REGEX);\nexport const dateStandardSchema = regexSchema(DATE_STANDARD_REGEX);\n\nexport const timeSchema = regexSchema(TIME_REGEX);\n\nexport const Sort = {\n Asc: \"asc\",\n Desc: \"desc\",\n} as const;\nexport type Sort = (typeof Sort)[keyof typeof Sort];\nexport const sortValues = Object.values(Sort) as [Sort, ...Sort[]];\n\nexport const vrsSchema = z.object({\n v: z.number(),\n r: z.string(),\n s: z.string(),\n});\n\nexport const eip2098SignatureSchema = z.object({\n yParity: z.number(),\n r: z.string(),\n s: z.string(),\n});\n\nexport type HexString = z.infer<typeof hexStringSchema>;\nexport type Address = z.infer<typeof hexStringSchema>;\nexport type VRS = z.infer<typeof vrsSchema>;\nexport type EIP2098Signature = z.infer<typeof eip2098SignatureSchema>;\nexport type ChainId = z.infer<typeof chainIdSchema>;\n","import { z } from \"zod\";\n\nimport { dateStandardSchema, hexStringSchema, numberSchema } from \"./misc\";\n\nexport const instructionIdSchema = hexStringSchema;\nexport type InstructionId = z.infer<typeof instructionIdSchema>;\n\nexport const InstructionState = {\n PendingActivation: \"PendingActivation\",\n Active: \"Active\",\n PendingDeactivation: \"PendingDeactivation\",\n Deactivated: \"Deactivated\",\n Errored: \"Errored\",\n Completed: \"Completed\",\n UserNotDelegated: \"UserNotDelegated\",\n InFlight: \"InFlight\",\n NotifyUser: \"NotifyUser\",\n} as const;\nexport type InstructionState =\n (typeof InstructionState)[keyof typeof InstructionState];\nexport const instructionStateValues = Object.values(InstructionState) as [\n InstructionState,\n ...InstructionState[],\n];\nexport const instructionStateSchema = z.enum(instructionStateValues);\n\nexport const InstructionAction = {\n Refuel: \"Refuel\",\n RefuelERC20: \"RefuelERC20\",\n Transfer: \"Transfer\",\n TransferERC20: \"TransferERC20\",\n TransferCCTP: \"TransferCCTP\",\n UniswapV3ExactInput: \"UniswapV3ExactInput\",\n Sweep: \"Sweep\",\n SweepERC20: \"SweepERC20\",\n SweepCCTP: \"SweepCCTP\",\n SweepUniswapV3: \"SweepUniswapV3\",\n DeactivateInstruction: \"DeactivateInstruction\",\n SweepSkipCCTPDepositAccount: \"SweepSkipCCTPDepositAccount\",\n DepositERC4626: \"DepositERC4626\",\n SweepDepositERC4626: \"SweepDepositERC4626\",\n WithdrawERC4626: \"WithdrawERC4626\",\n SweepWithdrawERC4626: \"SweepWithdrawERC4626\",\n SweepDepositAccount: \"SweepDepositAccount\",\n SweepDepositAccountERC20: \"SweepDepositAccountERC20\",\n CallOnce: \"CallOnce\",\n} as const;\nexport type InstructionAction =\n (typeof InstructionAction)[keyof typeof InstructionAction];\nexport const instructionActionValues = Object.values(InstructionAction) as [\n InstructionAction,\n ...InstructionAction[],\n];\nexport const instructionActionSchema = z.enum(instructionActionValues);\n\nexport const InstructionScheduleStartType = {\n Now: \"now\",\n DateTime: \"datetime\",\n} as const;\nexport type InstructionScheduleStartType =\n (typeof InstructionScheduleStartType)[keyof typeof InstructionScheduleStartType];\nexport const instructionScheduleStartValues = Object.values(\n InstructionScheduleStartType,\n) as [InstructionScheduleStartType, ...InstructionScheduleStartType[]];\nconst baseStartSchema = z.object({\n type: z.enum(instructionScheduleStartValues),\n});\nconst nowStartSchema = baseStartSchema.extend({\n type: z.literal(InstructionScheduleStartType.Now),\n});\nconst dateTimeStartSchema = baseStartSchema.extend({\n type: z.literal(InstructionScheduleStartType.DateTime),\n startDate: dateStandardSchema,\n startTime: z.string(),\n});\nexport const instructionScheduleStartSchema = z.discriminatedUnion(\"type\", [\n nowStartSchema,\n dateTimeStartSchema,\n]);\nexport type InstructionScheduleStart = z.infer<\n typeof instructionScheduleStartSchema\n>;\n\nexport const InstructionScheduleRepeatType = {\n UntilDeactivated: \"until-deactivated\",\n MaxExecutions: \"max-executions\",\n} as const;\nexport type InstructionScheduleRepeatType =\n (typeof InstructionScheduleRepeatType)[keyof typeof InstructionScheduleRepeatType];\nexport const instructionScheduleRepeatValues = Object.values(\n InstructionScheduleRepeatType,\n) as [InstructionScheduleRepeatType, ...InstructionScheduleRepeatType[]];\nconst baseRepeatSchema = z.object({});\nconst untilDeactivatedRepeatSchema = baseRepeatSchema.extend({\n type: z.literal(InstructionScheduleRepeatType.UntilDeactivated),\n});\nconst maxExecutionsRepeatSchema = baseRepeatSchema.extend({\n type: z.literal(InstructionScheduleRepeatType.MaxExecutions),\n maxExecutions: numberSchema,\n});\nexport const instructionScheduleRepeatSchema = z.discriminatedUnion(\"type\", [\n untilDeactivatedRepeatSchema,\n maxExecutionsRepeatSchema,\n]);\nexport type InstructionScheduleRepeat = z.infer<\n typeof instructionScheduleRepeatSchema\n>;\n\nexport const InstructionScheduleRetryType = {\n UntilDeactivated: \"until-deactivated\",\n TimeLimited: \"time-limited\",\n} as const;\nexport type InstructionScheduleRetryType =\n (typeof InstructionScheduleRetryType)[keyof typeof InstructionScheduleRetryType];\nexport const instructionScheduleRetryValues = Object.values(\n InstructionScheduleRetryType,\n) as [InstructionScheduleRetryType, ...InstructionScheduleRetryType[]];\nconst baseRetrySchema = z.object({});\nconst untilDeactivatedRetrySchema = baseRetrySchema.extend({\n type: z.literal(InstructionScheduleRetryType.UntilDeactivated),\n});\nconst timeLimitedRetrySchema = baseRetrySchema.extend({\n type: z.literal(InstructionScheduleRetryType.TimeLimited),\n retryCount: numberSchema,\n});\nexport const instructionScheduleRetrySchema = z.discriminatedUnion(\"type\", [\n untilDeactivatedRetrySchema,\n timeLimitedRetrySchema,\n]);\nexport type InstructionScheduleRetry = z.infer<\n typeof instructionScheduleRetrySchema\n>;\n\nexport const TimeUnit = {\n None: \"none\",\n Second: \"second\",\n Minute: \"minute\",\n Hour: \"hour\",\n Day: \"day\",\n Week: \"week\",\n Month: \"month\",\n} as const;\nexport type TimeUnit = (typeof TimeUnit)[keyof typeof TimeUnit];\nexport const timeUnitValues = Object.values(TimeUnit) as [\n TimeUnit,\n ...TimeUnit[],\n];\nexport const timeUnitSchema = z.enum(timeUnitValues);\n\nconst instructionExecutionStateRawSchema = z.object({\n execution_status: instructionStateSchema.optional(),\n execution_counter: z.number().int().optional(),\n last_executed: z.number().int().optional(),\n});\n\nexport const instructionExecutionStateSchema =\n instructionExecutionStateRawSchema.transform((data) => ({\n executionStatus: data.execution_status,\n executionCounter: data.execution_counter,\n lastExecuted: data.last_executed,\n }));\n\nexport type InstructionExecutionState = z.infer<\n typeof instructionExecutionStateSchema\n>;\n\nexport const instructionSchema = z.object({\n instructionId: hexStringSchema,\n createdAt: z.number().optional(),\n startAt: z.string().nullish(),\n interval: z.number().nullish(),\n timeout: z.number().nullish(),\n maxExecutions: z.number().nullish(),\n executionState: instructionExecutionStateSchema,\n actionName: z.string().optional(),\n arguments: z.any(),\n nickname: z.string().nullish(),\n lastInstructedValue: z.string().optional(),\n lastErrorCode: z.number().nullish(),\n lastErrorMessage: z.string().nullish(),\n totalInstructedValue: z.string().optional(),\n instructedTokenAddress: hexStringSchema.nullish(),\n chainId: z.number().nullish(),\n chain: z.string().optional(),\n});\nexport type Instruction = z.infer<typeof instructionSchema>;\n\nexport const instructionsSchema = z.array(instructionSchema);\nexport type Instructions = z.infer<typeof instructionsSchema>;\n\nexport const instructionSummarySchema = z.object({\n instructionId: hexStringSchema,\n chainId: z.number().int(),\n executionCount: z.number().int(),\n onTimeCount: z.number().int(),\n lateCount: z.number().int(),\n wasActivatedDuring: z.boolean(),\n amount: z.number().default(0),\n instructedValue: z.string().nullish().default(\"0\"),\n instructedTokenAddress: z.string().nullish().default(null),\n});\nexport type InstructionSummary = z.infer<typeof instructionSummarySchema>;\n\nexport const instructionSummariesSchema = z.array(instructionSummarySchema);\nexport type InstructionSummaries = z.infer<typeof instructionSummariesSchema>;\n\nexport const instructionSummariesByDateSchema = z.record(\n z.string(),\n instructionSummariesSchema,\n);\nexport type InstructionSummariesByDate = z.infer<\n typeof instructionSummariesByDateSchema\n>;\n\nexport const InstructionViewTimescale = {\n Days: \"days\",\n Hours: \"hours\",\n Minutes: \"minutes\",\n Seconds: \"seconds\",\n} as const;\nexport type InstructionViewTimescale =\n (typeof InstructionViewTimescale)[keyof typeof InstructionViewTimescale];\nexport const instructionViewTimescaleValues = Object.values(\n InstructionViewTimescale,\n) as [InstructionViewTimescale, ...InstructionViewTimescale[]];\n\nexport function assertInstructionAction(\n action: unknown,\n): asserts action is InstructionAction {\n if (!instructionActionValues.includes(action as InstructionAction)) {\n throw new Error(`Invalid instruction action: ${action}`);\n }\n}\n","import { z } from \"zod\";\n\nexport const PaymentStatus = {\n Due: \"due\",\n NotDue: \"not-due\",\n Paid: \"paid\",\n} as const;\nexport type PaymentStatus = (typeof PaymentStatus)[keyof typeof PaymentStatus];\n\nexport const PaymentSource = {\n Bill: \"Bill\",\n Stripe: \"Stripe\",\n Clio: \"Clio\",\n QuickBooks: \"QuickBooks\",\n} as const;\nexport type PaymentSource = (typeof PaymentSource)[keyof typeof PaymentSource];\n\nexport const paymentRequestSourceValues = [\n PaymentSource.Bill,\n PaymentSource.Stripe,\n PaymentSource.Clio,\n PaymentSource.QuickBooks,\n] satisfies ReadonlyArray<PaymentSource>;\n\nexport const paymentSchema = z.object({\n id: z.string(),\n fromUserId: z.string().nullable().optional(),\n toUserId: z.string().nullable().optional(),\n payerAddress: z.string().nullable().optional(),\n ephemeralWalletAddress: z.string(),\n ephemeralWalletId: z.string().optional(),\n instructions: z\n .object({\n ids: z.array(z.string()),\n completionIds: z.array(z.string()),\n })\n .optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n // UI-derived fields\n status: z.union([\n z.literal(PaymentStatus.Due),\n z.literal(PaymentStatus.NotDue),\n z.literal(PaymentStatus.Paid),\n ]),\n dueDate: z.string(),\n amountDue: z.number(),\n note: z.string().nullable().optional(),\n address: z.string().nullable().optional(),\n addedOn: z.string(),\n source: z\n .union([\n z.literal(PaymentSource.Bill),\n z.literal(PaymentSource.Stripe),\n z.literal(PaymentSource.Clio),\n z.literal(PaymentSource.QuickBooks),\n ])\n .nullish(),\n attachmentUrl: z.string().url().nullable().optional(),\n attachmentName: z.string().nullable().optional(),\n fromAccountAddress: z.string().nullable().optional(),\n});\n\nexport type Payment = z.infer<typeof paymentSchema>;\n\nexport const PaymentsSchema = z.array(paymentSchema);\nexport type Payments = z.infer<typeof PaymentsSchema>;\n","import type { Optional } from \"@otim/utils/helpers\";\n\nimport { z } from \"zod\";\n\nexport const Token = {\n ETH: \"ETH\",\n USDC: \"USDC\",\n USDT: \"USDT\",\n} as const;\nexport type Token = (typeof Token)[keyof typeof Token];\nexport const TokenValues = Object.values(Token) as [Token, ...Token[]];\n\nexport const tokenSchema = z.enum(TokenValues);\n\nexport function assertToken(token: unknown): asserts token is Token {\n if (!TokenValues.includes(token as Token)) {\n throw new Error(`Invalid token: ${token}`);\n }\n}\n\nexport function assertsOptionalToken(\n token: unknown,\n): asserts token is Optional<Token> {\n if (token !== undefined) {\n assertToken(token);\n }\n}\n","import { z } from \"zod\";\n\nimport { instructionIdSchema } from \"./instruction\";\nimport { hexStringSchema } from \"./misc\";\n\nexport type Transaction = z.infer<typeof transactionSchema>;\nexport type TransactionWithValidAmount = z.infer<\n typeof transactionWithValidAmountSchema\n>;\nexport type Transactions = z.infer<typeof transactionsSchema>;\n\nexport const transactionSchema = z.object({\n instructionId: instructionIdSchema,\n transactionHash: hexStringSchema.optional(),\n blockHash: z.string().nullable(),\n transactionStatus: z.string(),\n error: z.string().nullish(),\n startedAt: z.string(),\n startedAtBlock: z.number(),\n finishedAt: z.string().nullable(),\n finishedAtBlock: z.number().nullable(),\n amount: z.object({ value: z.number(), token: z.string() }).nullish(),\n instructedValue: z.string(),\n instructedTokenAddress: z.string().nullable(),\n executionNum: z.number(),\n chainId: z.number().nullish(),\n chain: z.string().optional(),\n});\nexport const transactionWithValidAmountSchema = transactionSchema.extend({\n amount: z.object({\n value: z.number(),\n token: z.string(),\n }),\n});\nexport const transactionsSchema = z.array(transactionSchema);\n","import { z } from \"zod\";\n\nexport const entityIdSchema = z.string().uuid();\n\nexport const addressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/)\n .transform((v) => v.toLowerCase());\n\nexport const userPreferencesSchema = z.object({\n chainId: z.number().optional(),\n tokenSymbol: z.string().optional(),\n localCurrency: z.string().optional(),\n});\n\nexport const userSchema = z.object({\n id: entityIdSchema,\n address: addressSchema,\n email: z.string().email().nullable().optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n preferences: userPreferencesSchema.optional(),\n isDeveloper: z.boolean(),\n developerPublicKey: z.string().nullable().optional(),\n});\n\nexport type UserPreferences = z.infer<typeof userPreferencesSchema>;\nexport type User = z.infer<typeof userSchema>;\n"],"mappings":";;;;AAAA,MAAa,cAAc;CACzB,MAAM;CACN,MAAM;CACN,WAAW;CACX,WAAW;CACX,QAAQ;CACT;AAGD,MAAa,0BAA0B;CACrC,WAAW;CACX,cAAc;CACd,YAAY;CACZ,cAAc;CACf;;;;ACZD,MAAa,gBAAgBA,MAAE,OAAO;CACpC,QAAQA,MAAE,QAAQ;CAClB,MAAMA,MAAE,QAAQ;CAChB,SAASA,MAAE,QAAQ;CACnB,WAAWA,MAAE,QAAQ;CACrB,WAAWA,MAAE,QAAQ;CACtB,CAAC;AAEF,MAAa,iBAAiBA,MAAE,MAAM,cAAc;;;;ACRpD,MAAa,aACX;AACF,MAAa,sBACX;AACF,MAAa,sBACX;AACF,MAAa,aAAa;AAE1B,MAAa,eAAe,OAAe,YACzCC,MAAE,QAAQ,CAAC,MAAM,OAAO,QAAQ;AAElC,MAAa,uBAAuBA,MAAE,QAAQ,CAAC,IAAI,EAAE;AAErD,MAAa,eAAeA,MAAE,MAAM,CAClCA,MAAE,QAAQ,CAAC,QAAQ,EACnBA,MACG,QAAQ,CACR,MAAM,iCAAiC,CACvC,UAAU,OAAO,CACrB,CAAC;AAEF,MAAa,sBAAsBA,MAChC,QAAQ,CACR,MAAM,gBAAgB,CACtB,QAAQ,QAAQ,CAAC,MAAM,WAAW,IAAI,CAAC,EAAE,EACxC,SAAS,kCACV,CAAC;AAEJ,MAAa,eAAeA,MAAE,MAAM,CAClCA,MAAE,QAAQ,EACVA,MACG,QAAQ,CACR,MAAM,UAAU,CAChB,UAAU,OAAO,CACrB,CAAC;AA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,UAAU;CACrD,CAAC"}
1
+ {"version":3,"file":"index.js","names":["z","z","z","z","z","z","z"],"sources":["../../src/schemas/account.ts","../../src/schemas/contact.ts","../../src/schemas/misc.ts","../../src/schemas/instruction.ts","../../src/schemas/payment.ts","../../src/schemas/token.ts","../../src/schemas/transaction.ts","../../src/schemas/user.ts"],"sourcesContent":["export const AccountType = {\n Otim: \"otim\",\n Bank: \"bank\",\n Ephemeral: \"ephemeral\",\n Custodian: \"custodian\",\n Wallet: \"wallet\",\n} as const;\nexport type AccountType = (typeof AccountType)[keyof typeof AccountType];\n\nexport const AccountConnectionStatus = {\n Connected: \"connected\",\n Disconnected: \"disconnected\",\n Connecting: \"connecting\",\n Reconnecting: \"reconnecting\",\n} as const;\nexport type AccountConnectionStatus =\n (typeof AccountConnectionStatus)[keyof typeof AccountConnectionStatus];\n","import { z } from \"zod\";\n\nexport const ContactSchema = z.object({\n userId: z.string(),\n name: z.string(),\n address: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nexport const ContactsSchema = z.array(ContactSchema);\n\nexport type Contact = z.infer<typeof ContactSchema>;\nexport type Contacts = z.infer<typeof ContactsSchema>;\n","import { z } from \"zod\";\n\nexport const DATE_REGEX =\n /^(19|20)\\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\nexport const DATE_ISO_8601_REGEX =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?$/;\nexport const DATE_STANDARD_REGEX =\n /^(0[1-9]|1[0-2])\\/(0[1-9]|[12][0-9]|3[01])\\/(19|20)\\d{2}$/;\nexport const TIME_REGEX = /^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (AM|PM)$/;\n\nexport const regexSchema = (regex: RegExp, message?: string) =>\n z.string().regex(regex, message);\n\nexport const nonEmptyStringSchema = z.string().min(1);\n\nexport const numberSchema = z.union([\n z.number().finite(),\n z\n .string()\n .regex(/^-?\\d*\\.?\\d+(?:[eE][-+]?\\d+)?$/)\n .transform(Number),\n]);\n\nexport const decimalStringSchema = z\n .string({ error: \"This field is required\" })\n .regex(/^-?\\d*\\.?\\d+$/)\n .refine((val) => !isNaN(parseFloat(val)), {\n message: \"Must be a valid decimal number\",\n });\n\nexport const bigintSchema = z.union([\n z.bigint(),\n z\n .string()\n .regex(/^-?\\d+$/)\n .transform(BigInt),\n]);\n\nexport const hexStringSchema = z\n .string({ error: \"This field is required\" })\n .startsWith(\"0x\")\n .transform((val): `0x${string}` => val as `0x${string}`);\n\nexport const chainIdSchema = z.number().positive();\n\nexport const dateSchema = regexSchema(DATE_REGEX);\nexport const dateISO8601Schema = regexSchema(DATE_ISO_8601_REGEX);\nexport const dateStandardSchema = regexSchema(DATE_STANDARD_REGEX);\n\nexport const timeSchema = regexSchema(TIME_REGEX);\n\nexport const Sort = {\n Asc: \"asc\",\n Desc: \"desc\",\n} as const;\nexport type Sort = (typeof Sort)[keyof typeof Sort];\nexport const sortValues = Object.values(Sort) as [Sort, ...Sort[]];\n\nexport const vrsSchema = z.object({\n v: z.number(),\n r: z.string(),\n s: z.string(),\n});\n\nexport const eip2098SignatureSchema = z.object({\n yParity: z.number(),\n r: z.string(),\n s: z.string(),\n});\n\nexport type HexString = z.infer<typeof hexStringSchema>;\nexport type Address = z.infer<typeof hexStringSchema>;\nexport type VRS = z.infer<typeof vrsSchema>;\nexport type EIP2098Signature = z.infer<typeof eip2098SignatureSchema>;\nexport type ChainId = z.infer<typeof chainIdSchema>;\n","import { z } from \"zod\";\n\nimport { dateStandardSchema, hexStringSchema, numberSchema } from \"./misc\";\n\nexport const instructionIdSchema = hexStringSchema;\nexport type InstructionId = z.infer<typeof instructionIdSchema>;\n\nexport const InstructionState = {\n PendingActivation: \"PendingActivation\",\n Active: \"Active\",\n PendingDeactivation: \"PendingDeactivation\",\n Deactivated: \"Deactivated\",\n Errored: \"Errored\",\n Completed: \"Completed\",\n UserNotDelegated: \"UserNotDelegated\",\n InFlight: \"InFlight\",\n NotifyUser: \"NotifyUser\",\n} as const;\nexport type InstructionState =\n (typeof InstructionState)[keyof typeof InstructionState];\nexport const instructionStateValues = Object.values(InstructionState) as [\n InstructionState,\n ...InstructionState[],\n];\nexport const instructionStateSchema = z.enum(instructionStateValues);\n\nexport const InstructionAction = {\n Refuel: \"Refuel\",\n RefuelERC20: \"RefuelERC20\",\n Transfer: \"Transfer\",\n TransferERC20: \"TransferERC20\",\n TransferCCTP: \"TransferCCTP\",\n UniswapV3ExactInput: \"UniswapV3ExactInput\",\n Sweep: \"Sweep\",\n SweepERC20: \"SweepERC20\",\n SweepCCTP: \"SweepCCTP\",\n SweepUniswapV3: \"SweepUniswapV3\",\n DeactivateInstruction: \"DeactivateInstruction\",\n SweepSkipCCTPDepositAccount: \"SweepSkipCCTPDepositAccount\",\n DepositERC4626: \"DepositERC4626\",\n SweepDepositERC4626: \"SweepDepositERC4626\",\n WithdrawERC4626: \"WithdrawERC4626\",\n SweepWithdrawERC4626: \"SweepWithdrawERC4626\",\n SweepDepositAccount: \"SweepDepositAccount\",\n SweepDepositAccountERC20: \"SweepDepositAccountERC20\",\n CallOnce: \"CallOnce\",\n} as const;\nexport type InstructionAction =\n (typeof InstructionAction)[keyof typeof InstructionAction];\nexport const instructionActionValues = Object.values(InstructionAction) as [\n InstructionAction,\n ...InstructionAction[],\n];\nexport const instructionActionSchema = z.enum(instructionActionValues);\n\nexport const InstructionScheduleStartType = {\n Now: \"now\",\n DateTime: \"datetime\",\n} as const;\nexport type InstructionScheduleStartType =\n (typeof InstructionScheduleStartType)[keyof typeof InstructionScheduleStartType];\nexport const instructionScheduleStartValues = Object.values(\n InstructionScheduleStartType,\n) as [InstructionScheduleStartType, ...InstructionScheduleStartType[]];\nconst baseStartSchema = z.object({\n type: z.enum(instructionScheduleStartValues),\n});\nconst nowStartSchema = baseStartSchema.extend({\n type: z.literal(InstructionScheduleStartType.Now),\n});\nconst dateTimeStartSchema = baseStartSchema.extend({\n type: z.literal(InstructionScheduleStartType.DateTime),\n startDate: dateStandardSchema,\n startTime: z.string(),\n});\nexport const instructionScheduleStartSchema = z.discriminatedUnion(\"type\", [\n nowStartSchema,\n dateTimeStartSchema,\n]);\nexport type InstructionScheduleStart = z.infer<\n typeof instructionScheduleStartSchema\n>;\n\nexport const InstructionScheduleRepeatType = {\n UntilDeactivated: \"until-deactivated\",\n MaxExecutions: \"max-executions\",\n} as const;\nexport type InstructionScheduleRepeatType =\n (typeof InstructionScheduleRepeatType)[keyof typeof InstructionScheduleRepeatType];\nexport const instructionScheduleRepeatValues = Object.values(\n InstructionScheduleRepeatType,\n) as [InstructionScheduleRepeatType, ...InstructionScheduleRepeatType[]];\nconst baseRepeatSchema = z.object({});\nconst untilDeactivatedRepeatSchema = baseRepeatSchema.extend({\n type: z.literal(InstructionScheduleRepeatType.UntilDeactivated),\n});\nconst maxExecutionsRepeatSchema = baseRepeatSchema.extend({\n type: z.literal(InstructionScheduleRepeatType.MaxExecutions),\n maxExecutions: numberSchema,\n});\nexport const instructionScheduleRepeatSchema = z.discriminatedUnion(\"type\", [\n untilDeactivatedRepeatSchema,\n maxExecutionsRepeatSchema,\n]);\nexport type InstructionScheduleRepeat = z.infer<\n typeof instructionScheduleRepeatSchema\n>;\n\nexport const InstructionScheduleRetryType = {\n UntilDeactivated: \"until-deactivated\",\n TimeLimited: \"time-limited\",\n} as const;\nexport type InstructionScheduleRetryType =\n (typeof InstructionScheduleRetryType)[keyof typeof InstructionScheduleRetryType];\nexport const instructionScheduleRetryValues = Object.values(\n InstructionScheduleRetryType,\n) as [InstructionScheduleRetryType, ...InstructionScheduleRetryType[]];\nconst baseRetrySchema = z.object({});\nconst untilDeactivatedRetrySchema = baseRetrySchema.extend({\n type: z.literal(InstructionScheduleRetryType.UntilDeactivated),\n});\nconst timeLimitedRetrySchema = baseRetrySchema.extend({\n type: z.literal(InstructionScheduleRetryType.TimeLimited),\n retryCount: numberSchema,\n});\nexport const instructionScheduleRetrySchema = z.discriminatedUnion(\"type\", [\n untilDeactivatedRetrySchema,\n timeLimitedRetrySchema,\n]);\nexport type InstructionScheduleRetry = z.infer<\n typeof instructionScheduleRetrySchema\n>;\n\nexport const TimeUnit = {\n None: \"none\",\n Second: \"second\",\n Minute: \"minute\",\n Hour: \"hour\",\n Day: \"day\",\n Week: \"week\",\n Month: \"month\",\n} as const;\nexport type TimeUnit = (typeof TimeUnit)[keyof typeof TimeUnit];\nexport const timeUnitValues = Object.values(TimeUnit) as [\n TimeUnit,\n ...TimeUnit[],\n];\nexport const timeUnitSchema = z.enum(timeUnitValues);\n\nconst instructionExecutionStateRawSchema = z.object({\n execution_status: instructionStateSchema.optional(),\n execution_counter: z.number().int().optional(),\n last_executed: z.number().int().optional(),\n});\n\nexport const instructionExecutionStateSchema =\n instructionExecutionStateRawSchema.transform((data) => ({\n executionStatus: data.execution_status,\n executionCounter: data.execution_counter,\n lastExecuted: data.last_executed,\n }));\n\nexport type InstructionExecutionState = z.infer<\n typeof instructionExecutionStateSchema\n>;\n\nexport const instructionSchema = z.object({\n instructionId: hexStringSchema,\n createdAt: z.number().optional(),\n startAt: z.string().nullish(),\n interval: z.number().nullish(),\n timeout: z.number().nullish(),\n maxExecutions: z.number().nullish(),\n executionState: instructionExecutionStateSchema,\n actionName: z.string().optional(),\n arguments: z.any(),\n nickname: z.string().nullish(),\n lastInstructedValue: z.string().optional(),\n lastErrorCode: z.number().nullish(),\n lastErrorMessage: z.string().nullish(),\n totalInstructedValue: z.string().optional(),\n instructedTokenAddress: hexStringSchema.nullish(),\n chainId: z.number().nullish(),\n chain: z.string().optional(),\n});\nexport type Instruction = z.infer<typeof instructionSchema>;\n\nexport const instructionsSchema = z.array(instructionSchema);\nexport type Instructions = z.infer<typeof instructionsSchema>;\n\nexport const instructionSummarySchema = z.object({\n instructionId: hexStringSchema,\n chainId: z.number().int(),\n executionCount: z.number().int(),\n onTimeCount: z.number().int(),\n lateCount: z.number().int(),\n wasActivatedDuring: z.boolean(),\n amount: z.number().default(0),\n instructedValue: z.string().nullish().default(\"0\"),\n instructedTokenAddress: z.string().nullish().default(null),\n});\nexport type InstructionSummary = z.infer<typeof instructionSummarySchema>;\n\nexport const instructionSummariesSchema = z.array(instructionSummarySchema);\nexport type InstructionSummaries = z.infer<typeof instructionSummariesSchema>;\n\nexport const instructionSummariesByDateSchema = z.record(\n z.string(),\n instructionSummariesSchema,\n);\nexport type InstructionSummariesByDate = z.infer<\n typeof instructionSummariesByDateSchema\n>;\n\nexport const InstructionViewTimescale = {\n Days: \"days\",\n Hours: \"hours\",\n Minutes: \"minutes\",\n Seconds: \"seconds\",\n} as const;\nexport type InstructionViewTimescale =\n (typeof InstructionViewTimescale)[keyof typeof InstructionViewTimescale];\nexport const instructionViewTimescaleValues = Object.values(\n InstructionViewTimescale,\n) as [InstructionViewTimescale, ...InstructionViewTimescale[]];\n\nexport function assertInstructionAction(\n action: unknown,\n): asserts action is InstructionAction {\n if (!instructionActionValues.includes(action as InstructionAction)) {\n throw new Error(`Invalid instruction action: ${action}`);\n }\n}\n","import { z } from \"zod\";\n\nexport const PaymentStatus = {\n Due: \"due\",\n NotDue: \"not-due\",\n Paid: \"paid\",\n} as const;\nexport type PaymentStatus = (typeof PaymentStatus)[keyof typeof PaymentStatus];\n\nexport const PaymentSource = {\n Bill: \"Bill\",\n Stripe: \"Stripe\",\n Clio: \"Clio\",\n QuickBooks: \"QuickBooks\",\n} as const;\nexport type PaymentSource = (typeof PaymentSource)[keyof typeof PaymentSource];\n\nexport const paymentRequestSourceValues = [\n PaymentSource.Bill,\n PaymentSource.Stripe,\n PaymentSource.Clio,\n PaymentSource.QuickBooks,\n] satisfies ReadonlyArray<PaymentSource>;\n\nexport const paymentSchema = z.object({\n id: z.string(),\n fromUserId: z.string().nullable().optional(),\n toUserId: z.string().nullable().optional(),\n payerAddress: z.string().nullable().optional(),\n ephemeralWalletAddress: z.string(),\n ephemeralWalletId: z.string().optional(),\n instructions: z\n .object({\n ids: z.array(z.string()),\n completionIds: z.array(z.string()),\n })\n .optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n // UI-derived fields\n status: z.union([\n z.literal(PaymentStatus.Due),\n z.literal(PaymentStatus.NotDue),\n z.literal(PaymentStatus.Paid),\n ]),\n dueDate: z.string(),\n amountDue: z.number(),\n note: z.string().nullable().optional(),\n address: z.string().nullable().optional(),\n addedOn: z.string(),\n source: z\n .union([\n z.literal(PaymentSource.Bill),\n z.literal(PaymentSource.Stripe),\n z.literal(PaymentSource.Clio),\n z.literal(PaymentSource.QuickBooks),\n ])\n .nullish(),\n attachmentUrl: z.string().url().nullable().optional(),\n attachmentName: z.string().nullable().optional(),\n fromAccountAddress: z.string().nullable().optional(),\n});\n\nexport type Payment = z.infer<typeof paymentSchema>;\n\nexport const PaymentsSchema = z.array(paymentSchema);\nexport type Payments = z.infer<typeof PaymentsSchema>;\n","import type { Optional } from \"@otim/utils/helpers\";\n\nimport { z } from \"zod\";\n\nexport const Token = {\n ETH: \"ETH\",\n USDC: \"USDC\",\n USDT: \"USDT\",\n} as const;\nexport type Token = (typeof Token)[keyof typeof Token];\nexport const TokenValues = Object.values(Token) as [Token, ...Token[]];\n\nexport const tokenSchema = z.enum(TokenValues);\n\nexport function assertToken(token: unknown): asserts token is Token {\n if (!TokenValues.includes(token as Token)) {\n throw new Error(`Invalid token: ${token}`);\n }\n}\n\nexport function assertsOptionalToken(\n token: unknown,\n): asserts token is Optional<Token> {\n if (token !== undefined) {\n assertToken(token);\n }\n}\n","import { z } from \"zod\";\n\nimport { instructionIdSchema } from \"./instruction\";\nimport { hexStringSchema } from \"./misc\";\n\nexport type Transaction = z.infer<typeof transactionSchema>;\nexport type TransactionWithValidAmount = z.infer<\n typeof transactionWithValidAmountSchema\n>;\nexport type Transactions = z.infer<typeof transactionsSchema>;\n\nexport const transactionSchema = z.object({\n instructionId: instructionIdSchema,\n transactionHash: hexStringSchema.optional(),\n blockHash: z.string().nullable(),\n transactionStatus: z.string(),\n error: z.string().nullish(),\n startedAt: z.string(),\n startedAtBlock: z.number(),\n finishedAt: z.string().nullable(),\n finishedAtBlock: z.number().nullable(),\n amount: z.object({ value: z.number(), token: z.string() }).nullish(),\n instructedValue: z.string(),\n instructedTokenAddress: z.string().nullable(),\n executionNum: z.number(),\n chainId: z.number().nullish(),\n chain: z.string().optional(),\n});\nexport const transactionWithValidAmountSchema = transactionSchema.extend({\n amount: z.object({\n value: z.number(),\n token: z.string(),\n }),\n});\nexport const transactionsSchema = z.array(transactionSchema);\n","import { z } from \"zod\";\n\nexport const entityIdSchema = z.string().uuid();\n\nexport const addressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/)\n .transform((v) => v.toLowerCase());\n\nexport const userPreferencesSchema = z.object({\n chainId: z.number().optional(),\n tokenSymbol: z.string().optional(),\n localCurrency: z.string().optional(),\n});\n\nexport const userSchema = z.object({\n id: entityIdSchema,\n address: addressSchema,\n email: z.string().email().nullable().optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n preferences: userPreferencesSchema.optional(),\n isDeveloper: z.boolean(),\n developerPublicKey: z.string().nullable().optional(),\n});\n\nexport type UserPreferences = z.infer<typeof userPreferencesSchema>;\nexport type User = z.infer<typeof userSchema>;\n"],"mappings":";;;;;AAAA,MAAa,cAAc;CACzB,MAAM;CACN,MAAM;CACN,WAAW;CACX,WAAW;CACX,QAAQ;CACT;AAGD,MAAa,0BAA0B;CACrC,WAAW;CACX,cAAc;CACd,YAAY;CACZ,cAAc;CACf;;;;ACZD,MAAa,gBAAgBA,MAAE,OAAO;CACpC,QAAQA,MAAE,QAAQ;CAClB,MAAMA,MAAE,QAAQ;CAChB,SAASA,MAAE,QAAQ;CACnB,WAAWA,MAAE,QAAQ;CACrB,WAAWA,MAAE,QAAQ;CACtB,CAAC;AAEF,MAAa,iBAAiBA,MAAE,MAAM,cAAc;;;;ACRpD,MAAa,aACX;AACF,MAAa,sBACX;AACF,MAAa,sBACX;AACF,MAAa,aAAa;AAE1B,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BAAiBC,MAAE,QAAQ,CAAC,MAAM;AAE/C,MAAa,gBAAgBA,MAC1B,QAAQ,CACR,MAAM,sBAAsB,CAC5B,WAAW,MAAM,EAAE,aAAa,CAAC;AAEpC,MAAa,wBAAwBA,MAAE,OAAO;CAC5C,SAASA,MAAE,QAAQ,CAAC,UAAU;CAC9B,aAAaA,MAAE,QAAQ,CAAC,UAAU;CAClC,eAAeA,MAAE,QAAQ,CAAC,UAAU;CACrC,CAAC;AAEF,MAAa,aAAaA,MAAE,OAAO;CACjC,IAAI;CACJ,SAAS;CACT,OAAOA,MAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU;CAC/C,WAAWA,MAAE,QAAQ;CACrB,WAAWA,MAAE,QAAQ;CACrB,aAAa,sBAAsB,UAAU;CAC7C,aAAaA,MAAE,SAAS;CACxB,oBAAoBA,MAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACrD,CAAC"}
@@ -35,9 +35,9 @@ const TIME_REGEX = /^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (AM|PM)$/;
35
35
  const regexSchema = (regex, message) => z$1.string().regex(regex, message);
36
36
  const nonEmptyStringSchema = z$1.string().min(1);
37
37
  const numberSchema = z$1.union([z$1.number().finite(), z$1.string().regex(/^-?\d*\.?\d+(?:[eE][-+]?\d+)?$/).transform(Number)]);
38
- const decimalStringSchema = z$1.string().regex(/^-?\d*\.?\d+$/).refine((val) => !isNaN(parseFloat(val)), { message: "Must be a valid decimal number" });
38
+ const decimalStringSchema = z$1.string({ error: "This field is required" }).regex(/^-?\d*\.?\d+$/).refine((val) => !isNaN(parseFloat(val)), { message: "Must be a valid decimal number" });
39
39
  const bigintSchema = z$1.union([z$1.bigint(), z$1.string().regex(/^-?\d+$/).transform(BigInt)]);
40
- const hexStringSchema = z$1.string().startsWith("0x").transform((val) => val);
40
+ const hexStringSchema = z$1.string({ error: "This field is required" }).startsWith("0x").transform((val) => val);
41
41
  const chainIdSchema = z$1.number().positive();
42
42
  const dateSchema = regexSchema(DATE_REGEX);
43
43
  const dateISO8601Schema = regexSchema(DATE_ISO_8601_REGEX);