1
- // Copyright (C) 2019 Agoric, under Apache License 2.0
2
-
3
1
// @ts -check
4
2
3
+ /* global makeWeakStore */
4
+
5
5
import { assert , details as X } from '@agoric/assert' ;
6
6
import { makeExternalStore } from '@agoric/store' ;
7
7
import { E } from '@agoric/eventual-send' ;
@@ -12,6 +12,7 @@ import { isPromise } from '@agoric/promise-kit';
12
12
import { makeAmountMath , MathKind } from './amountMath' ;
13
13
import { makeFarName , ERTPKind } from './interfaces' ;
14
14
import { coerceDisplayInfo } from './displayInfo' ;
15
+ import { makePaymentMaker } from './payment' ;
15
16
16
17
import './types' ;
17
18
@@ -43,17 +44,10 @@ function makeIssuerKit(
43
44
const { add } = amountMath ;
44
45
const empty = amountMath . getEmpty ( ) ;
45
46
46
- const {
47
- makeInstance : makePayment ,
48
- makeWeakStore : makePaymentWeakStore ,
49
- } = makeExternalStore ( 'payment' , ( ) =>
50
- Far ( makeFarName ( allegedName , ERTPKind . PAYMENT ) , {
51
- getAllegedBrand : ( ) => brand ,
52
- } ) ,
53
- ) ;
47
+ const makePayment = makePaymentMaker ( allegedName , brand ) ;
54
48
55
49
/** @type {WeakStore<Payment, Amount> } */
56
- const paymentLedger = makePaymentWeakStore ( ) ;
50
+ const paymentLedger = makeWeakStore ( 'payment' ) ;
57
51
58
52
function assertKnownPayment ( payment ) {
59
53
assert ( paymentLedger . has ( payment ) , X `payment not found for ${ allegedName } ` ) ;
0 commit comments