@zkp2p/contracts-v2 0.0.1-rc4 → 0.0.1

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 (140) hide show
  1. package/README.md +92 -32
  2. package/_cjs/abis/index.js +2 -0
  3. package/{dist → _cjs}/addresses/base.json +1 -1
  4. package/{dist → _cjs}/addresses/baseSepolia.json +1 -1
  5. package/_cjs/addresses/index.js +2 -0
  6. package/_cjs/constants/index.js +3 -0
  7. package/_cjs/index.js +2 -0
  8. package/{dist → _cjs}/paymentMethods/baseSepolia.json +1 -1
  9. package/_cjs/paymentMethods/index.js +23 -0
  10. package/_cjs/paymentMethods/index.json +6 -0
  11. package/_cjs/types/index.js +4 -0
  12. package/_cjs/utils/index.js +7 -0
  13. package/_esm/addresses/base.json +20 -0
  14. package/_esm/addresses/baseSepolia.json +20 -0
  15. package/_esm/constants/base.json +13 -0
  16. package/_esm/constants/baseSepolia.json +12 -0
  17. package/_esm/constants/baseStaging.json +13 -0
  18. package/_esm/index.js +2 -0
  19. package/_esm/paymentMethods/baseSepolia.json +234 -0
  20. package/_esm/paymentMethods/index.json +6 -0
  21. package/_esm/types/common.js +46 -0
  22. package/_esm/utils/protocolUtils.js +57 -0
  23. package/_types/index.d.ts +2 -0
  24. package/addresses/base.json +20 -0
  25. package/addresses/baseSepolia.json +20 -0
  26. package/constants/base.json +13 -0
  27. package/constants/baseSepolia.json +12 -0
  28. package/constants/baseStaging.json +13 -0
  29. package/package.json +38 -27
  30. package/paymentMethods/baseSepolia.json +234 -0
  31. package/paymentMethods/index.json +6 -0
  32. package/paymentMethods/index.ts +23 -0
  33. package/paymentMethods/types.d.ts +15 -0
  34. package/types/common.ts +46 -0
  35. package/types/index.ts +4 -0
  36. package/utils/index.ts +12 -0
  37. package/utils/protocolUtils.ts +57 -0
  38. package/dist/abis/base/index.d.ts +0 -11
  39. package/dist/abis/baseSepolia/index.d.ts +0 -11
  40. package/dist/index.esm.js +0 -4
  41. package/dist/index.esm.js.map +0 -1
  42. package/dist/index.js +0 -6
  43. package/dist/index.js.map +0 -1
  44. package/dist/paymentMethods/index.d.ts +0 -7
  45. package/dist/paymentMethods/index.json +0 -6
  46. package/dist/types/common.d.ts +0 -22
  47. package/dist/types/contracts/Escrow.d.ts +0 -1277
  48. package/dist/types/contracts/Orchestrator.d.ts +0 -661
  49. package/dist/types/contracts/ProtocolViewer.d.ts +0 -300
  50. package/dist/types/contracts/index.d.ts +0 -9
  51. package/dist/types/contracts/interfaces/IAttestationVerifier.d.ts +0 -48
  52. package/dist/types/contracts/interfaces/IEscrow.d.ts +0 -697
  53. package/dist/types/contracts/interfaces/IEscrowRegistry.d.ts +0 -58
  54. package/dist/types/contracts/interfaces/INullifierRegistry.d.ts +0 -58
  55. package/dist/types/contracts/interfaces/IOrchestrator.d.ts +0 -382
  56. package/dist/types/contracts/interfaces/IPaymentVerifier.d.ts +0 -98
  57. package/dist/types/contracts/interfaces/IPaymentVerifierRegistry.d.ts +0 -74
  58. package/dist/types/contracts/interfaces/IPostIntentHook.d.ts +0 -100
  59. package/dist/types/contracts/interfaces/IPostIntentHookRegistry.d.ts +0 -50
  60. package/dist/types/contracts/interfaces/IProtocolViewer.d.ts +0 -232
  61. package/dist/types/contracts/interfaces/IRelayerRegistry.d.ts +0 -50
  62. package/dist/types/contracts/interfaces/index.d.ts +0 -11
  63. package/dist/types/contracts/registries/EscrowRegistry.d.ts +0 -206
  64. package/dist/types/contracts/registries/NullifierRegistry.d.ts +0 -200
  65. package/dist/types/contracts/registries/PaymentVerifierRegistry.d.ts +0 -270
  66. package/dist/types/contracts/registries/PostIntentHookRegistry.d.ts +0 -175
  67. package/dist/types/contracts/registries/RelayerRegistry.d.ts +0 -165
  68. package/dist/types/contracts/registries/index.d.ts +0 -5
  69. package/dist/types/contracts/unifiedVerifier/BaseUnifiedPaymentVerifier.d.ts +0 -357
  70. package/dist/types/contracts/unifiedVerifier/SimpleAttestationVerifier.d.ts +0 -196
  71. package/dist/types/contracts/unifiedVerifier/UnifiedPaymentVerifier.d.ts +0 -429
  72. package/dist/types/contracts/unifiedVerifier/index.d.ts +0 -3
  73. package/dist/types/index.d.ts +0 -1
  74. package/dist/utils/index.d.ts +0 -2
  75. package/dist/utils/protocolUtils.d.ts +0 -30
  76. /package/{dist → _cjs}/constants/base.json +0 -0
  77. /package/{dist → _cjs}/constants/baseSepolia.json +0 -0
  78. /package/{dist → _cjs}/constants/baseStaging.json +0 -0
  79. /package/{dist/types/common.ts → _cjs/types/common.js} +0 -0
  80. /package/{dist/utils/protocolUtils.ts → _cjs/utils/protocolUtils.js} +0 -0
  81. /package/{dist/abis/index.d.ts → _esm/abis/index.js} +0 -0
  82. /package/{dist/addresses/index.d.ts → _esm/addresses/index.js} +0 -0
  83. /package/{dist/constants/index.d.ts → _esm/constants/index.js} +0 -0
  84. /package/{dist/paymentMethods/index.ts → _esm/paymentMethods/index.js} +0 -0
  85. /package/{dist/types/index.ts → _esm/types/index.js} +0 -0
  86. /package/{dist/utils/index.ts → _esm/utils/index.js} +0 -0
  87. /package/{dist → _types}/paymentMethods/types.d.ts +0 -0
  88. /package/{dist/abis → abis}/base/CashappReclaimVerifier.json +0 -0
  89. /package/{dist/abis → abis}/base/Escrow.json +0 -0
  90. /package/{dist/abis → abis}/base/MercadoPagoReclaimVerifier.json +0 -0
  91. /package/{dist/abis → abis}/base/NullifierRegistry.json +0 -0
  92. /package/{dist/abis → abis}/base/RevolutReclaimVerifier.json +0 -0
  93. /package/{dist/abis → abis}/base/VenmoReclaimVerifier.json +0 -0
  94. /package/{dist/abis → abis}/base/WiseReclaimVerifier.json +0 -0
  95. /package/{dist/abis → abis}/base/ZelleBaseVerifier.json +0 -0
  96. /package/{dist/abis → abis}/base/ZelleBoAReclaimVerifier.json +0 -0
  97. /package/{dist/abis → abis}/base/ZelleChaseReclaimVerifier.json +0 -0
  98. /package/{dist/abis → abis}/base/ZelleCitiReclaimVerifier.json +0 -0
  99. /package/{dist/abis → abis}/base/index.ts +0 -0
  100. /package/{dist/abis → abis}/baseSepolia/Escrow.json +0 -0
  101. /package/{dist/abis → abis}/baseSepolia/EscrowRegistry.json +0 -0
  102. /package/{dist/abis → abis}/baseSepolia/NullifierRegistry.json +0 -0
  103. /package/{dist/abis → abis}/baseSepolia/Orchestrator.json +0 -0
  104. /package/{dist/abis → abis}/baseSepolia/PaymentVerifierRegistry.json +0 -0
  105. /package/{dist/abis → abis}/baseSepolia/PostIntentHookRegistry.json +0 -0
  106. /package/{dist/abis → abis}/baseSepolia/ProtocolViewer.json +0 -0
  107. /package/{dist/abis → abis}/baseSepolia/RelayerRegistry.json +0 -0
  108. /package/{dist/abis → abis}/baseSepolia/SimpleAttestationVerifier.json +0 -0
  109. /package/{dist/abis → abis}/baseSepolia/USDCMock.json +0 -0
  110. /package/{dist/abis → abis}/baseSepolia/UnifiedPaymentVerifier.json +0 -0
  111. /package/{dist/abis → abis}/baseSepolia/index.ts +0 -0
  112. /package/{dist/abis → abis}/index.ts +0 -0
  113. /package/{dist/addresses → addresses}/index.ts +0 -0
  114. /package/{dist/constants → constants}/index.ts +0 -0
  115. /package/{dist/types → types}/contracts/Escrow.ts +0 -0
  116. /package/{dist/types → types}/contracts/Orchestrator.ts +0 -0
  117. /package/{dist/types → types}/contracts/ProtocolViewer.ts +0 -0
  118. /package/{dist/types → types}/contracts/index.ts +0 -0
  119. /package/{dist/types → types}/contracts/interfaces/IAttestationVerifier.ts +0 -0
  120. /package/{dist/types → types}/contracts/interfaces/IEscrow.ts +0 -0
  121. /package/{dist/types → types}/contracts/interfaces/IEscrowRegistry.ts +0 -0
  122. /package/{dist/types → types}/contracts/interfaces/INullifierRegistry.ts +0 -0
  123. /package/{dist/types → types}/contracts/interfaces/IOrchestrator.ts +0 -0
  124. /package/{dist/types → types}/contracts/interfaces/IPaymentVerifier.ts +0 -0
  125. /package/{dist/types → types}/contracts/interfaces/IPaymentVerifierRegistry.ts +0 -0
  126. /package/{dist/types → types}/contracts/interfaces/IPostIntentHook.ts +0 -0
  127. /package/{dist/types → types}/contracts/interfaces/IPostIntentHookRegistry.ts +0 -0
  128. /package/{dist/types → types}/contracts/interfaces/IProtocolViewer.ts +0 -0
  129. /package/{dist/types → types}/contracts/interfaces/IRelayerRegistry.ts +0 -0
  130. /package/{dist/types → types}/contracts/interfaces/index.ts +0 -0
  131. /package/{dist/types → types}/contracts/registries/EscrowRegistry.ts +0 -0
  132. /package/{dist/types → types}/contracts/registries/NullifierRegistry.ts +0 -0
  133. /package/{dist/types → types}/contracts/registries/PaymentVerifierRegistry.ts +0 -0
  134. /package/{dist/types → types}/contracts/registries/PostIntentHookRegistry.ts +0 -0
  135. /package/{dist/types → types}/contracts/registries/RelayerRegistry.ts +0 -0
  136. /package/{dist/types → types}/contracts/registries/index.ts +0 -0
  137. /package/{dist/types → types}/contracts/unifiedVerifier/BaseUnifiedPaymentVerifier.ts +0 -0
  138. /package/{dist/types → types}/contracts/unifiedVerifier/SimpleAttestationVerifier.ts +0 -0
  139. /package/{dist/types → types}/contracts/unifiedVerifier/UnifiedPaymentVerifier.ts +0 -0
  140. /package/{dist/types → types}/contracts/unifiedVerifier/index.ts +0 -0
@@ -0,0 +1,57 @@
1
+ import { ethers } from "ethers";
2
+ import { BigNumber } from "ethers";
3
+
4
+ const CIRCOM_FIELD = BigNumber.from("21888242871839275222246405745257275088548364400416034343698204186575808495617");
5
+
6
+ export const getKeccak256Hash = (value: string): string => {
7
+ // Convert the string to UTF-8 bytes
8
+ const bytes = ethers.utils.toUtf8Bytes(value);
9
+
10
+ // Compute keccak256 hash of the packed bytes
11
+ return ethers.utils.keccak256(bytes);
12
+ }
13
+
14
+ export const Currency = {
15
+ AED: getKeccak256Hash("AED"),
16
+ ARS: getKeccak256Hash("ARS"),
17
+ AUD: getKeccak256Hash("AUD"),
18
+ CAD: getKeccak256Hash("CAD"),
19
+ CHF: getKeccak256Hash("CHF"),
20
+ CNY: getKeccak256Hash("CNY"),
21
+ EUR: getKeccak256Hash("EUR"),
22
+ GBP: getKeccak256Hash("GBP"),
23
+ HKD: getKeccak256Hash("HKD"),
24
+ IDR: getKeccak256Hash("IDR"),
25
+ ILS: getKeccak256Hash("ILS"),
26
+ JPY: getKeccak256Hash("JPY"),
27
+ KES: getKeccak256Hash("KES"),
28
+ MXN: getKeccak256Hash("MXN"),
29
+ MYR: getKeccak256Hash("MYR"),
30
+ NZD: getKeccak256Hash("NZD"),
31
+ PLN: getKeccak256Hash("PLN"),
32
+ SAR: getKeccak256Hash("SAR"),
33
+ SGD: getKeccak256Hash("SGD"),
34
+ THB: getKeccak256Hash("THB"),
35
+ TRY: getKeccak256Hash("TRY"),
36
+ USD: getKeccak256Hash("USD"),
37
+ VND: getKeccak256Hash("VND"),
38
+ ZAR: getKeccak256Hash("ZAR"),
39
+ } as const;
40
+
41
+
42
+ export const getCurrencyCodeFromHash = (hash: string): string => {
43
+ return Object.keys(Currency).find(key => Currency[key as keyof typeof Currency] === hash) || "";
44
+ }
45
+
46
+ export const calculateIntentHash = (
47
+ orchestrator: string,
48
+ intentCounter: BigNumber | number,
49
+ ): string => {
50
+
51
+ const intermediateHash = ethers.utils.solidityKeccak256(
52
+ ["address", "uint256"],
53
+ [orchestrator, intentCounter]
54
+ );
55
+
56
+ return ethers.utils.hexZeroPad(BigNumber.from(intermediateHash).mod(CIRCOM_FIELD).toHexString(), 32);
57
+ };
@@ -1,11 +0,0 @@
1
- export { default as CashappReclaimVerifier } from './CashappReclaimVerifier.json';
2
- export { default as Escrow } from './Escrow.json';
3
- export { default as MercadoPagoReclaimVerifier } from './MercadoPagoReclaimVerifier.json';
4
- export { default as NullifierRegistry } from './NullifierRegistry.json';
5
- export { default as RevolutReclaimVerifier } from './RevolutReclaimVerifier.json';
6
- export { default as VenmoReclaimVerifier } from './VenmoReclaimVerifier.json';
7
- export { default as WiseReclaimVerifier } from './WiseReclaimVerifier.json';
8
- export { default as ZelleBaseVerifier } from './ZelleBaseVerifier.json';
9
- export { default as ZelleBoAReclaimVerifier } from './ZelleBoAReclaimVerifier.json';
10
- export { default as ZelleChaseReclaimVerifier } from './ZelleChaseReclaimVerifier.json';
11
- export { default as ZelleCitiReclaimVerifier } from './ZelleCitiReclaimVerifier.json';
@@ -1,11 +0,0 @@
1
- export { default as Escrow } from './Escrow.json';
2
- export { default as EscrowRegistry } from './EscrowRegistry.json';
3
- export { default as NullifierRegistry } from './NullifierRegistry.json';
4
- export { default as Orchestrator } from './Orchestrator.json';
5
- export { default as PaymentVerifierRegistry } from './PaymentVerifierRegistry.json';
6
- export { default as PostIntentHookRegistry } from './PostIntentHookRegistry.json';
7
- export { default as ProtocolViewer } from './ProtocolViewer.json';
8
- export { default as RelayerRegistry } from './RelayerRegistry.json';
9
- export { default as SimpleAttestationVerifier } from './SimpleAttestationVerifier.json';
10
- export { default as USDCMock } from './USDCMock.json';
11
- export { default as UnifiedPaymentVerifier } from './UnifiedPaymentVerifier.json';
package/dist/index.esm.js DELETED
@@ -1,4 +0,0 @@
1
- var version = "0.0.1-rc4";
2
-
3
- export { version };
4
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.0.1-rc4";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,7 +0,0 @@
1
- import type { PaymentMethodConfig, NetworkPaymentMethods } from './types';
2
- export type { PaymentMethodConfig, NetworkPaymentMethods };
3
- export { default as baseSepolia } from './baseSepolia.json';
4
- export declare function getPaymentMethodConfig(network: string, paymentMethod: string): PaymentMethodConfig | undefined;
5
- export declare const paymentMethods: {
6
- baseSepolia: any;
7
- };
@@ -1,6 +0,0 @@
1
- {
2
- "networks": [
3
- "baseSepolia"
4
- ],
5
- "generatedAt": "2025-09-01T17:30:56.218Z"
6
- }
@@ -1,22 +0,0 @@
1
- import type { Listener } from "@ethersproject/providers";
2
- import type { Event, EventFilter } from "ethers";
3
- export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
4
- args: TArgsArray & TArgsObject;
5
- }
6
- export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {
7
- }
8
- export interface TypedListener<TEvent extends TypedEvent> {
9
- (...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
10
- }
11
- type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;
12
- export interface OnEvent<TRes> {
13
- <TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes;
14
- (eventName: string, listener: Listener): TRes;
15
- }
16
- export type MinEthersFactory<C, ARGS> = {
17
- deploy(...a: ARGS[]): Promise<C>;
18
- };
19
- export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
20
- export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
21
- export type PromiseOrValue<T> = T | Promise<T>;
22
- export {};