diff options
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index 01d26c297..50febf946 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -669,27 +669,13 @@ export class Wallet { /** - * Retrieve all necessary information for looking up the contract - * with the given hash. + * Retrieve information required to pay for a contract, where the + * contract is identified via the fulfillment url. */ - async queryPayment(query: any): Promise<any> { - let t: TransactionRecord | undefined; - - console.log("query for payment", query); - - switch (query.type) { - case "fulfillment_url": - t = await this.q().getIndexed(Stores.transactions.fulfillmentUrlIndex, query.value); - break; - case "order_id": - t = await this.q().getIndexed(Stores.transactions.orderIdIndex, query.value); - break; - case "hash": - t = await this.q().get<TransactionRecord>(Stores.transactions, query.value); - break; - default: - throw Error("invalid type"); - } + async queryPayment(url: string): Promise<any> { + console.log("query for payment", url); + + const t = await this.q().getIndexed(Stores.transactions.fulfillmentUrlIndex, url); if (!t) { console.log("query for payment failed"); |