aboutsummaryrefslogtreecommitdiff
path: root/src/webex/wxApi.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/webex/wxApi.ts')
-rw-r--r--src/webex/wxApi.ts49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts
index 248cb04b5..ff601b6f7 100644
--- a/src/webex/wxApi.ts
+++ b/src/webex/wxApi.ts
@@ -196,9 +196,10 @@ export function hashContract(contract: object): Promise<string> {
}
/**
- * Save an offer in the wallet.
+ * Save an offer in the wallet. Returns the offer id that
+ * the offer is stored under.
*/
-export function saveOffer(offer: object): Promise<void> {
+export function saveOffer(offer: object): Promise<number> {
return callBackend("save-offer", { offer });
}
@@ -208,3 +209,47 @@ export function saveOffer(offer: object): Promise<void> {
export function confirmReserve(reservePub: string): Promise<void> {
return callBackend("confirm-reserve", { reservePub });
}
+
+/**
+ * Query for a payment by fulfillment URL.
+ */
+export function queryPayment(url: string): Promise<any> {
+ return callBackend("query-payment", { url });
+}
+
+/**
+ * Add a new history item.
+ */
+export function putHistory(historyEntry: any): Promise<void> {
+ return callBackend("put-history-entry", { historyEntry });
+}
+
+/**
+ * Mark a payment as succeeded.
+ */
+export function paymentSucceeded(contractTermsHash: string, merchantSig: string): Promise<void> {
+ return callBackend("payment-succeeded", { contractTermsHash, merchantSig });
+}
+
+/**
+ * Mark a payment as succeeded.
+ */
+export function paymentFailed(contractTermsHash: string): Promise<void> {
+ return callBackend("payment-failed", { contractTermsHash });
+}
+
+/**
+ * Get the payment cookie for the current tab, or undefined if no payment
+ * cookie was set.
+ */
+export function getTabCookie(contractTermsHash: string, merchantSig: string): Promise<any> {
+ return callBackend("get-tab-cookie");
+}
+
+/**
+ * Generate a contract nonce (EdDSA key pair), store it in the wallet's
+ * database and return the public key.
+ */
+export function generateNonce(): Promise<string> {
+ return callBackend("generate-nonce");
+}