@zkp2p/sdk 0.2.0 → 0.2.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/dist/index.cjs +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1990,6 +1990,20 @@ var logger = {
|
|
|
1990
1990
|
};
|
|
1991
1991
|
|
|
1992
1992
|
// src/client/IntentOperations.ts
|
|
1993
|
+
function isV2SignalIntentAbi(abi) {
|
|
1994
|
+
for (const item of abi) {
|
|
1995
|
+
if (item.type === "function" && item.name === "signalIntent" && Array.isArray(item.inputs)) {
|
|
1996
|
+
const inputs = item.inputs;
|
|
1997
|
+
for (const input of inputs) {
|
|
1998
|
+
if (input.components) {
|
|
1999
|
+
if (input.components.some((c) => c.name === "referralFees")) return true;
|
|
2000
|
+
if (input.components.some((c) => c.name === "referrerFee")) return false;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
return true;
|
|
2006
|
+
}
|
|
1993
2007
|
var IntentOperations = class {
|
|
1994
2008
|
constructor(config) {
|
|
1995
2009
|
this.config = config;
|
|
@@ -2015,6 +2029,7 @@ var IntentOperations = class {
|
|
|
2015
2029
|
escrowAddress: escrowContext.address,
|
|
2016
2030
|
preferV2
|
|
2017
2031
|
});
|
|
2032
|
+
const useV2Encoding = isV2SignalIntentAbi(orchestratorContext.abi);
|
|
2018
2033
|
const catalog = getPaymentMethodsCatalog(this.config.getChainId(), this.config.getRuntimeEnv());
|
|
2019
2034
|
const paymentMethod = resolvePaymentMethodHashFromCatalog(params.processorName, catalog);
|
|
2020
2035
|
const fiatCurrency = resolveFiatCurrencyBytes32(params.fiatCurrencyCode);
|
|
@@ -2052,7 +2067,7 @@ var IntentOperations = class {
|
|
|
2052
2067
|
authorizationToken,
|
|
2053
2068
|
timeoutMs: this.config.getApiTimeoutMs()
|
|
2054
2069
|
};
|
|
2055
|
-
const response =
|
|
2070
|
+
const response = useV2Encoding ? await apiSignIntentV3(
|
|
2056
2071
|
{
|
|
2057
2072
|
...baseRequest,
|
|
2058
2073
|
callerAddress: this.config.getWalletClient().account.address,
|
|
@@ -2083,7 +2098,7 @@ var IntentOperations = class {
|
|
|
2083
2098
|
postIntentHook: params.postIntentHook ?? ZERO_ADDRESS,
|
|
2084
2099
|
data: params.data ?? "0x"
|
|
2085
2100
|
};
|
|
2086
|
-
const args =
|
|
2101
|
+
const args = useV2Encoding ? [
|
|
2087
2102
|
{
|
|
2088
2103
|
...commonFields,
|
|
2089
2104
|
referralFees,
|
|
@@ -7101,7 +7116,7 @@ var Zkp2pClient = class {
|
|
|
7101
7116
|
...configuredOrchestratorAddresses
|
|
7102
7117
|
]);
|
|
7103
7118
|
this.orchestratorAddress = this.orchestratorV2Address ?? toAddress(addresses.orchestrator) ?? this.orchestratorAddresses[0];
|
|
7104
|
-
this.orchestratorAbi =
|
|
7119
|
+
this.orchestratorAbi = abis.orchestrator ?? this.orchestratorV2Abi;
|
|
7105
7120
|
this.unifiedPaymentVerifier = toAddress(
|
|
7106
7121
|
addresses.unifiedPaymentVerifierV2 ?? addresses.unifiedPaymentVerifier
|
|
7107
7122
|
);
|