-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Durability for ERTP (#5283)
Co-authored-by: Chris Hibbert <hibbert@agoric.com>
- Loading branch information
1 parent
4cca744
commit eab27e4
Showing
47 changed files
with
923 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
// @ts-check | ||
|
||
import { defineKind } from '@agoric/vat-data'; | ||
import { defineDurableKind, provideKindHandle } from '@agoric/vat-data'; | ||
|
||
/** @typedef {import('@agoric/vat-data').Baggage} Baggage */ | ||
|
||
/** | ||
* @template {AssetKind} K | ||
* @param {string} allegedName | ||
* @param {Brand<K>} brand | ||
* @param {Baggage} issuerBaggage | ||
* @param {string} name | ||
* @param {() => Brand<K>} getBrand must not be called before the issuerKit is | ||
* created | ||
* @returns {() => Payment<K>} | ||
*/ | ||
export const definePaymentKind = (allegedName, brand) => { | ||
const makePayment = defineKind(`${allegedName} payment`, () => ({}), { | ||
getAllegedBrand: () => brand, | ||
export const vivifyPaymentKind = (issuerBaggage, name, getBrand) => { | ||
const paymentKindHandle = provideKindHandle(issuerBaggage, `${name} payment`); | ||
const makePayment = defineDurableKind(paymentKindHandle, () => ({}), { | ||
getAllegedBrand: getBrand, | ||
}); | ||
return makePayment; | ||
}; | ||
harden(definePaymentKind); | ||
harden(vivifyPaymentKind); |
Oops, something went wrong.