Skip to content

Commit

Permalink
fix: spendNotes args
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlwn123 committed Oct 1, 2024
1 parent d0c97ff commit df36ead
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/core-web/src/services/MintService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { WorkerClient } from '../worker'
import {
Duration,
JSONObject,
JSONValue,
ReissueExternalNotesState,
Expand Down Expand Up @@ -47,14 +48,18 @@ export class MintService {
// after the specified number of milliseconds.
// If the receiver has already redeemed the notes at this time,
// the notes will not be cancelled
tryCancelAfter: number = 0,
tryCancelAfter: number | Duration = 0,
includeInvite: boolean = false,
extraMeta: JSONValue = {},
): Promise<JSONValue> {
console.error('tryCancelAfter', tryCancelAfter)
const duration =
typeof tryCancelAfter === 'number'
? { nanos: 0, secs: tryCancelAfter }
: tryCancelAfter

return await this.client.rpcSingle('mint', 'spend_notes', {
min_amount: minAmount,
try_cancel_after: null,
try_cancel_after: duration,
include_invite: includeInvite,
extra_meta: extraMeta,
})
Expand Down
6 changes: 6 additions & 0 deletions packages/core-web/src/types/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ type ReissueExternalNotesState =
| 'Done'
| { Failed: { error: string } }

type Duration = {
nanos: number
secs: number
}

export {
JSONValue,
JSONObject,
Expand All @@ -118,4 +123,5 @@ export {
ModuleKind,
CancelFunction,
ReissueExternalNotesState,
Duration,
}

0 comments on commit df36ead

Please sign in to comment.