Skip to content

Commit

Permalink
fix: interface guards
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Aug 28, 2022
1 parent 5455d71 commit e1a5527
Show file tree
Hide file tree
Showing 21 changed files with 1,083 additions and 445 deletions.
45 changes: 0 additions & 45 deletions packages/ERTP/src/interfaces.js

This file was deleted.

23 changes: 15 additions & 8 deletions packages/ERTP/src/payment.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
// @ts-check

import { defineDurableKind, provideKindHandle } from '@agoric/vat-data';
import { vivifyFarClass } from '@agoric/vat-data';

/** @typedef {import('@agoric/vat-data').Baggage} Baggage */

/**
* @template {AssetKind} K
* @param {Baggage} issuerBaggage
* @param {string} name
* @param {() => Brand<K>} getBrand must not be called before the issuerKit is
* created
* @param {Brand<K>} brand
* @param {InterfaceGuard} PaymentI
* @returns {() => Payment<K>}
*/
export const vivifyPaymentKind = (issuerBaggage, name, getBrand) => {
const paymentKindHandle = provideKindHandle(issuerBaggage, `${name} payment`);
const makePayment = defineDurableKind(paymentKindHandle, () => ({}), {
getAllegedBrand: getBrand,
});
export const vivifyPaymentKind = (issuerBaggage, name, brand, PaymentI) => {
const makePayment = vivifyFarClass(
issuerBaggage,
`${name} payment`,
PaymentI,
() => ({}),
{
getAllegedBrand() {
return brand;
},
},
);
return makePayment;
};
harden(vivifyPaymentKind);
Loading

0 comments on commit e1a5527

Please sign in to comment.