@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.
- package/README.md +92 -32
- package/_cjs/abis/index.js +2 -0
- package/{dist → _cjs}/addresses/base.json +1 -1
- package/{dist → _cjs}/addresses/baseSepolia.json +1 -1
- package/_cjs/addresses/index.js +2 -0
- package/_cjs/constants/index.js +3 -0
- package/_cjs/index.js +2 -0
- package/{dist → _cjs}/paymentMethods/baseSepolia.json +1 -1
- package/_cjs/paymentMethods/index.js +23 -0
- package/_cjs/paymentMethods/index.json +6 -0
- package/_cjs/types/index.js +4 -0
- package/_cjs/utils/index.js +7 -0
- package/_esm/addresses/base.json +20 -0
- package/_esm/addresses/baseSepolia.json +20 -0
- package/_esm/constants/base.json +13 -0
- package/_esm/constants/baseSepolia.json +12 -0
- package/_esm/constants/baseStaging.json +13 -0
- package/_esm/index.js +2 -0
- package/_esm/paymentMethods/baseSepolia.json +234 -0
- package/_esm/paymentMethods/index.json +6 -0
- package/_esm/types/common.js +46 -0
- package/_esm/utils/protocolUtils.js +57 -0
- package/_types/index.d.ts +2 -0
- package/addresses/base.json +20 -0
- package/addresses/baseSepolia.json +20 -0
- package/constants/base.json +13 -0
- package/constants/baseSepolia.json +12 -0
- package/constants/baseStaging.json +13 -0
- package/package.json +38 -27
- package/paymentMethods/baseSepolia.json +234 -0
- package/paymentMethods/index.json +6 -0
- package/paymentMethods/index.ts +23 -0
- package/paymentMethods/types.d.ts +15 -0
- package/types/common.ts +46 -0
- package/types/index.ts +4 -0
- package/utils/index.ts +12 -0
- package/utils/protocolUtils.ts +57 -0
- package/dist/abis/base/index.d.ts +0 -11
- package/dist/abis/baseSepolia/index.d.ts +0 -11
- package/dist/index.esm.js +0 -4
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/paymentMethods/index.d.ts +0 -7
- package/dist/paymentMethods/index.json +0 -6
- package/dist/types/common.d.ts +0 -22
- package/dist/types/contracts/Escrow.d.ts +0 -1277
- package/dist/types/contracts/Orchestrator.d.ts +0 -661
- package/dist/types/contracts/ProtocolViewer.d.ts +0 -300
- package/dist/types/contracts/index.d.ts +0 -9
- package/dist/types/contracts/interfaces/IAttestationVerifier.d.ts +0 -48
- package/dist/types/contracts/interfaces/IEscrow.d.ts +0 -697
- package/dist/types/contracts/interfaces/IEscrowRegistry.d.ts +0 -58
- package/dist/types/contracts/interfaces/INullifierRegistry.d.ts +0 -58
- package/dist/types/contracts/interfaces/IOrchestrator.d.ts +0 -382
- package/dist/types/contracts/interfaces/IPaymentVerifier.d.ts +0 -98
- package/dist/types/contracts/interfaces/IPaymentVerifierRegistry.d.ts +0 -74
- package/dist/types/contracts/interfaces/IPostIntentHook.d.ts +0 -100
- package/dist/types/contracts/interfaces/IPostIntentHookRegistry.d.ts +0 -50
- package/dist/types/contracts/interfaces/IProtocolViewer.d.ts +0 -232
- package/dist/types/contracts/interfaces/IRelayerRegistry.d.ts +0 -50
- package/dist/types/contracts/interfaces/index.d.ts +0 -11
- package/dist/types/contracts/registries/EscrowRegistry.d.ts +0 -206
- package/dist/types/contracts/registries/NullifierRegistry.d.ts +0 -200
- package/dist/types/contracts/registries/PaymentVerifierRegistry.d.ts +0 -270
- package/dist/types/contracts/registries/PostIntentHookRegistry.d.ts +0 -175
- package/dist/types/contracts/registries/RelayerRegistry.d.ts +0 -165
- package/dist/types/contracts/registries/index.d.ts +0 -5
- package/dist/types/contracts/unifiedVerifier/BaseUnifiedPaymentVerifier.d.ts +0 -357
- package/dist/types/contracts/unifiedVerifier/SimpleAttestationVerifier.d.ts +0 -196
- package/dist/types/contracts/unifiedVerifier/UnifiedPaymentVerifier.d.ts +0 -429
- package/dist/types/contracts/unifiedVerifier/index.d.ts +0 -3
- package/dist/types/index.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/protocolUtils.d.ts +0 -30
- /package/{dist → _cjs}/constants/base.json +0 -0
- /package/{dist → _cjs}/constants/baseSepolia.json +0 -0
- /package/{dist → _cjs}/constants/baseStaging.json +0 -0
- /package/{dist/types/common.ts → _cjs/types/common.js} +0 -0
- /package/{dist/utils/protocolUtils.ts → _cjs/utils/protocolUtils.js} +0 -0
- /package/{dist/abis/index.d.ts → _esm/abis/index.js} +0 -0
- /package/{dist/addresses/index.d.ts → _esm/addresses/index.js} +0 -0
- /package/{dist/constants/index.d.ts → _esm/constants/index.js} +0 -0
- /package/{dist/paymentMethods/index.ts → _esm/paymentMethods/index.js} +0 -0
- /package/{dist/types/index.ts → _esm/types/index.js} +0 -0
- /package/{dist/utils/index.ts → _esm/utils/index.js} +0 -0
- /package/{dist → _types}/paymentMethods/types.d.ts +0 -0
- /package/{dist/abis → abis}/base/CashappReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/Escrow.json +0 -0
- /package/{dist/abis → abis}/base/MercadoPagoReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/NullifierRegistry.json +0 -0
- /package/{dist/abis → abis}/base/RevolutReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/VenmoReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/WiseReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/ZelleBaseVerifier.json +0 -0
- /package/{dist/abis → abis}/base/ZelleBoAReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/ZelleChaseReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/ZelleCitiReclaimVerifier.json +0 -0
- /package/{dist/abis → abis}/base/index.ts +0 -0
- /package/{dist/abis → abis}/baseSepolia/Escrow.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/EscrowRegistry.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/NullifierRegistry.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/Orchestrator.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/PaymentVerifierRegistry.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/PostIntentHookRegistry.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/ProtocolViewer.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/RelayerRegistry.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/SimpleAttestationVerifier.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/USDCMock.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/UnifiedPaymentVerifier.json +0 -0
- /package/{dist/abis → abis}/baseSepolia/index.ts +0 -0
- /package/{dist/abis → abis}/index.ts +0 -0
- /package/{dist/addresses → addresses}/index.ts +0 -0
- /package/{dist/constants → constants}/index.ts +0 -0
- /package/{dist/types → types}/contracts/Escrow.ts +0 -0
- /package/{dist/types → types}/contracts/Orchestrator.ts +0 -0
- /package/{dist/types → types}/contracts/ProtocolViewer.ts +0 -0
- /package/{dist/types → types}/contracts/index.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IAttestationVerifier.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IEscrow.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IEscrowRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/INullifierRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IOrchestrator.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IPaymentVerifier.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IPaymentVerifierRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IPostIntentHook.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IPostIntentHookRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IProtocolViewer.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/IRelayerRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/interfaces/index.ts +0 -0
- /package/{dist/types → types}/contracts/registries/EscrowRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/registries/NullifierRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/registries/PaymentVerifierRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/registries/PostIntentHookRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/registries/RelayerRegistry.ts +0 -0
- /package/{dist/types → types}/contracts/registries/index.ts +0 -0
- /package/{dist/types → types}/contracts/unifiedVerifier/BaseUnifiedPaymentVerifier.ts +0 -0
- /package/{dist/types → types}/contracts/unifiedVerifier/SimpleAttestationVerifier.ts +0 -0
- /package/{dist/types → types}/contracts/unifiedVerifier/UnifiedPaymentVerifier.ts +0 -0
- /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
package/dist/index.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/index.js
DELETED
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
|
-
};
|
package/dist/types/common.d.ts
DELETED
|
@@ -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 {};
|