-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
105 additions
and
20 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 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,13 +1,36 @@ | ||
import { makeTracer } from '@agoric/internal'; | ||
import { makePublishKit } from '@agoric/notifier'; | ||
|
||
/** | ||
* @import {Zone} from '@agoric/zone'; | ||
* @import {CctpTxEvidence} from '../types.js'; | ||
*/ | ||
|
||
const trace = makeTracer('TxFeed', true); | ||
|
||
export const INVITATION_MAKERS_DESC = 'transaction oracle invitation'; | ||
|
||
/** | ||
* @param {Zone} zone | ||
*/ | ||
export const prepareTransactionFeed = zone => { | ||
return zone.exo('Fast USDC Feed', undefined, {}); | ||
export const prepareTransactionFeedKit = zone => { | ||
/** @type {PublishKit<CctpTxEvidence>} */ | ||
const { publisher, subscriber } = makePublishKit(); | ||
|
||
return zone.exoClassKit('Fast USDC Feed', undefined, () => ({}), { | ||
admin: { | ||
/** @param {CctpTxEvidence } evidence */ | ||
addEvidence: evidence => { | ||
trace('TEMPORARY: Add evidence:', evidence); | ||
// TODO decentralize | ||
publisher.publish(evidence); | ||
}, | ||
}, | ||
public: { | ||
getEvidenceStream: () => subscriber, | ||
}, | ||
}); | ||
}; | ||
harden(prepareTransactionFeed); | ||
harden(prepareTransactionFeedKit); | ||
|
||
/** @typedef {ReturnType<typeof prepareTransactionFeed>} TransactionFeed */ | ||
/** @typedef {ReturnType<typeof prepareTransactionFeedKit>} TransactionFeedKit */ |
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { makeHeapZone } from '@agoric/zone'; | ||
import test from 'ava'; | ||
import { prepareTransactionFeedKit } from '../../src/exos/transaction-feed.js'; | ||
|
||
test('basics', t => { | ||
const zone = makeHeapZone(); | ||
const kit = prepareTransactionFeedKit(zone); | ||
t.deepEqual(Object.values(kit), []); | ||
}); |
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