Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return preimage for intraledger payments in galoy connector #2997

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions src/extension/background-script/connectors/galoy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ class Galoy implements Connector {
}
}
... on SettlementViaIntraLedger {
__typename
counterPartyWalletId
counterPartyUsername
${
this.config.apiCompatibilityMode
? "counterPartyWalletId"
: "preImage"
}
}
}
}
Expand Down Expand Up @@ -203,7 +205,10 @@ class Galoy implements Connector {
transactions.push({
id: edge.cursor,
memo: tx.memo,
preimage: tx.settlementVia.preImage || "",
preimage:
tx.settlementVia.preImage ||
tx.settlementVia.paymentSecret ||
"",
payment_hash: tx.initiationVia.paymentHash || "",
settled: tx.status === "SUCCESS",
settleDate: createdAtDate.getTime(),
Expand Down Expand Up @@ -283,8 +288,11 @@ class Galoy implements Connector {
}
}
... on SettlementViaIntraLedger {
counterPartyUsername
counterPartyWalletId
${
this.config.apiCompatibilityMode
? "counterPartyWalletId"
: "preImage"
}
}
}
}
Expand Down Expand Up @@ -321,10 +329,7 @@ class Galoy implements Connector {
preimageMessage =
transaction.settlementVia.preImage ||
transaction.settlementVia.paymentSecret;
} else if (
"counterPartyUsername" in transaction.settlementVia ||
"counterPartyWalletId" in transaction.settlementVia
) {
} else if ("counterPartyWalletId" in transaction.settlementVia) {
preimageMessage = "No preimage, the payment was settled intraledger";
}
}
Expand Down Expand Up @@ -382,9 +387,11 @@ class Galoy implements Connector {
}
}
... on SettlementViaIntraLedger {
__typename
counterPartyWalletId
counterPartyUsername
${
this.config.apiCompatibilityMode
? "counterPartyWalletId"
: "preImage"
}
}
}
}
Expand Down Expand Up @@ -424,7 +431,7 @@ class Galoy implements Connector {
return {
data: {
paid: tx.node.status === "SUCCESS",
preimage: tx.node.settlementVia.__typename
preimage: tx.node.settlementVia.counterPartyWalletId
? "Payment executed internally"
: tx.node.settlementVia.preImage || "No preimage received",
},
Expand Down Expand Up @@ -531,9 +538,8 @@ type TransactionNode = {
};
settlementVia: {
preImage?: string;
__typename?: string;
paymentSecret?: string;
counterPartyWalletId?: string;
counterPartyUsername?: string;
};
};

Expand Down
Loading