Skip to content

Commit

Permalink
fix(captp): use new @agoric/eventual-send interface
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Dec 10, 2019
1 parent 341718b commit d1201a1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@agoric/bundle-source": "^1.0.3",
"@agoric/captp": "^1.1.0",
"@agoric/captp": "^1.2.0",
"@agoric/evaluate": "^2.1.3",
"@agoric/eventual-send": "^0.5.0",
"chalk": "^2.4.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/captp/lib/captp.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) {
let slot;
if (!valToSlot.has(val)) {
// new export
if (Promise.resolve(val) === val) {
if (HandledPromise.resolve(val) === val) {
lastPromiseID += 1;
const promiseID = lastPromiseID;
slot = `p+${promiseID}`;
Expand Down Expand Up @@ -82,7 +82,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) {

function makeRemote(target) {
const handler = {
GET(_o, prop) {
get(_o, prop) {
const [questionID, pr] = makeQuestion();
send({
type: 'CTP_CALL',
Expand All @@ -92,7 +92,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) {
});
return harden(pr.p);
},
POST(_o, prop, args) {
applyMethod(_o, prop, args) {
// Support: o~.[prop](...args) remote method invocation
const [questionID, pr] = makeQuestion();
send({
Expand All @@ -106,7 +106,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) {
};

const pr = {};
pr.p = Promise.makeHandled((res, rej, resolveWithPresence) => {
pr.p = new HandledPromise((res, rej, resolveWithPresence) => {
pr.rej = rej;
pr.resPres = () => resolveWithPresence(handler);
pr.res = res;
Expand Down
2 changes: 1 addition & 1 deletion packages/captp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoric/captp",
"version": "1.1.0",
"version": "1.2.0",
"description": "Capability Transfer Protocol for distributed objects",
"keywords": [
"agoric",
Expand Down
7 changes: 3 additions & 4 deletions packages/captp/test/loopback.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ test('try loopback captp', async t => {
}),
));
const rightRef = leftBootstrap();
const { comment, bang } = await E.C(rightRef).G.encourager.M.encourage(
const { comment, bang } = await E(E.G(rightRef).encourager).encourage(
'buddy',
).P;
);
t.equal(comment, 'good work, buddy', 'got encouragement');
t.equal(await E(bang).trigger(), 'buddy BANG!', 'called on promise');
pr.res('resolution');
t.equal(await E.G(rightRef).promise, 'resolution', 'got resolution');
t.equal(await E.C(rightRef).G.promise.P, 'resolution', 'chained resolution');
t.equal(await E.G(rightRef).promise, 'resolution', 'get resolution');
} catch (e) {
t.isNot(e, e, 'unexpected exception');
} finally {
Expand Down
6 changes: 3 additions & 3 deletions packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"license": "Apache-2.0",
"dependencies": {
"@agoric/bundle-source": "^1.0.4",
"@agoric/captp": "^1.0.2",
"@agoric/captp": "^1.2.0",
"@agoric/ertp": "^0.2.0",
"@agoric/evaluate": "^2.1.3",
"@agoric/eventual-send": "^0.4.4",
"@agoric/evaluate": "^2.2.0",
"@agoric/eventual-send": "^0.5.0",
"@agoric/harden": "0.0.4",
"@agoric/swingset-vat": "^0.3.0",
"@agoric/zoe": "^0.1.0",
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
resolved "https://registry.yarnpkg.com/@agoric/babel-parser/-/babel-parser-7.6.4.tgz#8dd5d36554cc758c29042713b5aa57dc58ee5273"
integrity sha512-3FQC3eP2hekhz1zn+2LcSL7tAG2dGgSqbmCeRfIFqhVS8bbE1hR7EvrC6jYlvqdU6yzlly43VykyRy9MHBvUAw==

"@agoric/eventual-send@^0.4.4", "@agoric/eventual-send@^0.4.5":
version "0.4.5"
resolved "https://registry.yarnpkg.com/@agoric/eventual-send/-/eventual-send-0.4.5.tgz#73d4238b856eef6086b45e3bcf219aeb9e516056"
integrity sha512-d4jngAU8LWmntZ3PXcFoOygC/tqHOl+JlA318LXuxK1/3/oU5UfNoYboa0Bm8xms8KEtcKFtPpcD5EgGzXO1NQ==

"@agoric/harden@0.0.4", "@agoric/harden@^0.0.4":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@agoric/harden/-/harden-0.0.4.tgz#b0d0b2fdfc1a8c7e60454374824442f5b37ea8bd"
Expand Down

0 comments on commit d1201a1

Please sign in to comment.