tx-indexer 1.4.0 → 1.4.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/advanced.js +31 -4
- package/dist/advanced.js.map +1 -1
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/advanced.js
CHANGED
|
@@ -318,6 +318,8 @@ var CANDY_GUARD_PROGRAM_ID = "Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g";
|
|
|
318
318
|
var BUBBLEGUM_PROGRAM_ID = "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY";
|
|
319
319
|
var MAGIC_EDEN_CANDY_MACHINE_ID = "CMZYPASGWeTz7RNGHaRJfCq2XQ5pYK6nDvVQxzkH51zb";
|
|
320
320
|
var PRIVACY_CASH_PROGRAM_ID = "9fhQBbumKEFuXtMBDw8AaQyAjCorLGJQiS3skWZdQyQD";
|
|
321
|
+
var PRIVACY_CASH_SPL_POOL = "2vV7xhCMWRrcLiwGoTaTRgvx98ku98TRJKPXhsS8jvBV";
|
|
322
|
+
var PRIVACY_CASH_FEE_RECIPIENT = "AWexibGxNFKTa1b5R5MN4PJr9HWnWRwf8EW9g8cLx3dM";
|
|
321
323
|
var WORMHOLE_PROGRAM_ID = "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth";
|
|
322
324
|
var WORMHOLE_TOKEN_BRIDGE_ID = "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb";
|
|
323
325
|
var DEGODS_BRIDGE_PROGRAM_ID = "35iLrpYNNR9ygHLcvE1xKFHbHq6paHthrF6wSovdWgGu";
|
|
@@ -2041,24 +2043,49 @@ function getLargestLeg(legs) {
|
|
|
2041
2043
|
(largest, current) => current.amount.amountUi > largest.amount.amountUi ? current : largest
|
|
2042
2044
|
);
|
|
2043
2045
|
}
|
|
2046
|
+
function hasPrivacyCashPoolAccount(legs) {
|
|
2047
|
+
const privacyCashAccounts = /* @__PURE__ */ new Set([
|
|
2048
|
+
PRIVACY_CASH_SPL_POOL,
|
|
2049
|
+
PRIVACY_CASH_FEE_RECIPIENT
|
|
2050
|
+
]);
|
|
2051
|
+
return legs.some((leg) => {
|
|
2052
|
+
const address4 = leg.accountId.replace(/^(external|wallet|protocol):/, "");
|
|
2053
|
+
return privacyCashAccounts.has(address4);
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
function isPrivacyCashPoolLeg(leg) {
|
|
2057
|
+
const address4 = leg.accountId.replace(/^(external|wallet|protocol):/, "");
|
|
2058
|
+
return address4 === PRIVACY_CASH_SPL_POOL || address4 === PRIVACY_CASH_FEE_RECIPIENT;
|
|
2059
|
+
}
|
|
2044
2060
|
var PrivacyCashClassifier = class {
|
|
2045
2061
|
name = "privacy-cash";
|
|
2046
2062
|
priority = 86;
|
|
2047
2063
|
classify(context) {
|
|
2048
2064
|
const { legs, tx } = context;
|
|
2049
|
-
|
|
2065
|
+
const isPrivacyCashProtocol = isPrivacyCashProtocolById(tx.protocol?.id);
|
|
2066
|
+
const hasPoolAccount = hasPrivacyCashPoolAccount(legs);
|
|
2067
|
+
if (!isPrivacyCashProtocol && !hasPoolAccount) {
|
|
2050
2068
|
return null;
|
|
2051
2069
|
}
|
|
2052
2070
|
const userDebits = legs.filter(
|
|
2053
|
-
(leg) => leg.accountId.startsWith("external:") && leg.side === "debit" && leg.role !== "fee"
|
|
2071
|
+
(leg) => leg.accountId.startsWith("external:") && leg.side === "debit" && leg.role !== "fee" && !isPrivacyCashPoolLeg(leg)
|
|
2054
2072
|
);
|
|
2055
2073
|
const userCredits = legs.filter(
|
|
2056
|
-
(leg) => leg.accountId.startsWith("external:") && leg.side === "credit" && leg.role !== "fee"
|
|
2074
|
+
(leg) => leg.accountId.startsWith("external:") && leg.side === "credit" && leg.role !== "fee" && !isPrivacyCashPoolLeg(leg)
|
|
2075
|
+
);
|
|
2076
|
+
const poolDebits = legs.filter(
|
|
2077
|
+
(leg) => isPrivacyCashPoolLeg(leg) && leg.side === "debit"
|
|
2057
2078
|
);
|
|
2058
2079
|
let primaryType;
|
|
2059
2080
|
let primaryLeg = null;
|
|
2060
2081
|
let participant = null;
|
|
2061
|
-
if (
|
|
2082
|
+
if (poolDebits.length > 0 && userCredits.length > 0) {
|
|
2083
|
+
primaryType = "privacy_withdraw";
|
|
2084
|
+
primaryLeg = getLargestLeg(userCredits);
|
|
2085
|
+
if (primaryLeg) {
|
|
2086
|
+
participant = primaryLeg.accountId.replace("external:", "");
|
|
2087
|
+
}
|
|
2088
|
+
} else if (userDebits.length > 0 && userCredits.length === 0) {
|
|
2062
2089
|
primaryType = "privacy_deposit";
|
|
2063
2090
|
primaryLeg = getLargestLeg(userDebits);
|
|
2064
2091
|
if (primaryLeg) {
|