How to use the @agoric/eventual-send.E function in @agoric/eventual-send

To help you get started, we’ve selected a few @agoric/eventual-send examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Agoric / ERTP / core / zoe / zoe / zoeUtils.js View on Github external
const escrowPayment = async (payoutRule, offerPayment, purse, extentOps) => {
  // if the user's contractual understanding includes
  // "offerExactly" or "offerAtMost", make sure that they have supplied a
  // payment with that exact balance
  if (['offerExactly', 'offerAtMost'].includes(payoutRule.kind)) {
    const { extent } = await E(purse).depositExactly(
      payoutRule.units,
      offerPayment,
    );
    return extent;
  }
  insist(
    offerPayment === undefined,
  )`payment was included, but the rule kind was ${payoutRule.kind}`;
  return extentOps.empty();
};
github Agoric / ERTP / core / zoe / zoe / state.js View on Github external
recordAssay: async assay => {
      if (!assayToPurse.has(assay)) {
        const unitOpsP = E(assay).getUnitOps();
        const labelP = E(assay).getLabel();
        const purseP = E(assay).makeEmptyPurse();
        const extentOpsDescP = E(assay).getExtentOps();

        const [unitOps, label, purse, extentOpsDesc] = await Promise.all([
          unitOpsP,
          labelP,
          purseP,
          extentOpsDescP,
        ]);

        assayToDescOps.init(assay, unitOps);
        assayToLabel.init(assay, label);
        assayToPurse.init(assay, purse);
        const { name, extentOpArgs = [] } = extentOpsDesc;
        assayToExtentOps.init(assay, extentOpsLib[name](...extentOpArgs));
github Agoric / ERTP / core / zoe / zoe / new-state.js View on Github external
const recordAssayLater = assayP => {
    const extentOpsDescP = E(assayP).getExtentOps();
    const labelP = E(assayP).getLabel();
    const purseP = E(assayP).makeEmptyPurse();
    return Promise.all([assayP, extentOpsDescP, labelP, purseP]).then(
      ([assay, extentOpsDesc, label, purse]) => {
        if (assayToAssayRecord.has(assay)) {
          return assayToAssayRecord.get(assay);
        }
        const { name, extentOpsArgs = [] } = extentOpsDesc;
        const extentOps = extentOpsLib[name](...extentOpsArgs);
        assayToPurse.init(assay, purse);
        return makeAssayRecord(assay, extentOps, label);
      },
    );
  };
github Agoric / ERTP / core / zoe / zoe / new-state.js View on Github external
const recordAssayLater = assayP => {
    const extentOpsDescP = E(assayP).getExtentOps();
    const labelP = E(assayP).getLabel();
    const purseP = E(assayP).makeEmptyPurse();
    return Promise.all([assayP, extentOpsDescP, labelP, purseP]).then(
      ([assay, extentOpsDesc, label, purse]) => {
        if (assayToAssayRecord.has(assay)) {
          return assayToAssayRecord.get(assay);
        }
        const { name, extentOpsArgs = [] } = extentOpsDesc;
        const extentOps = extentOpsLib[name](...extentOpsArgs);
        assayToPurse.init(assay, purse);
        return makeAssayRecord(assay, extentOps, label);
      },
    );
  };
github Agoric / ERTP / core / zoe / zoe / state.js View on Github external
recordAssay: async assay => {
      if (!assayToPurse.has(assay)) {
        const unitOpsP = E(assay).getUnitOps();
        const labelP = E(assay).getLabel();
        const purseP = E(assay).makeEmptyPurse();
        const extentOpsDescP = E(assay).getExtentOps();

        const [unitOps, label, purse, extentOpsDesc] = await Promise.all([
          unitOpsP,
          labelP,
          purseP,
          extentOpsDescP,
        ]);

        assayToDescOps.init(assay, unitOps);
        assayToLabel.init(assay, label);
        assayToPurse.init(assay, purse);
        const { name, extentOpArgs = [] } = extentOpsDesc;
        assayToExtentOps.init(assay, extentOpsLib[name](...extentOpArgs));
      }
      return harden({
github Agoric / ERTP / core / zoe / zoe / state.js View on Github external
recordAssay: async assay => {
      if (!assayToPurse.has(assay)) {
        const unitOpsP = E(assay).getUnitOps();
        const labelP = E(assay).getLabel();
        const purseP = E(assay).makeEmptyPurse();
        const extentOpsDescP = E(assay).getExtentOps();

        const [unitOps, label, purse, extentOpsDesc] = await Promise.all([
          unitOpsP,
          labelP,
          purseP,
          extentOpsDescP,
        ]);

        assayToDescOps.init(assay, unitOps);
        assayToLabel.init(assay, label);
        assayToPurse.init(assay, purse);
        const { name, extentOpArgs = [] } = extentOpsDesc;
        assayToExtentOps.init(assay, extentOpsLib[name](...extentOpArgs));
      }
      return harden({
        unitOps: assayToDescOps.get(assay),
github Agoric / ERTP / core / zoe / zoe / state.js View on Github external
recordAssay: async assay => {
      if (!assayToPurse.has(assay)) {
        const unitOpsP = E(assay).getUnitOps();
        const labelP = E(assay).getLabel();
        const purseP = E(assay).makeEmptyPurse();
        const extentOpsDescP = E(assay).getExtentOps();

        const [unitOps, label, purse, extentOpsDesc] = await Promise.all([
          unitOpsP,
          labelP,
          purseP,
          extentOpsDescP,
        ]);

        assayToDescOps.init(assay, unitOps);
        assayToLabel.init(assay, label);
        assayToPurse.init(assay, purse);
        const { name, extentOpArgs = [] } = extentOpsDesc;
        assayToExtentOps.init(assay, extentOpsLib[name](...extentOpArgs));
      }
github Agoric / ERTP / core / zoe / zoe / new-state.js View on Github external
const recordAssayLater = assayP => {
    const extentOpsDescP = E(assayP).getExtentOps();
    const labelP = E(assayP).getLabel();
    const purseP = E(assayP).makeEmptyPurse();
    return Promise.all([assayP, extentOpsDescP, labelP, purseP]).then(
      ([assay, extentOpsDesc, label, purse]) => {
        if (assayToAssayRecord.has(assay)) {
          return assayToAssayRecord.get(assay);
        }
        const { name, extentOpsArgs = [] } = extentOpsDesc;
        const extentOps = extentOpsLib[name](...extentOpsArgs);
        assayToPurse.init(assay, purse);
        return makeAssayRecord(assay, extentOps, label);
      },
    );
  };
github Agoric / ERTP / core / zoe / zoe / zoeUtils.js View on Github external
      row.map((units, i) => E(purses[i]).withdraw(units, 'payout')),
    );

@agoric/eventual-send

Extend a Promise class to implement the eventual-send API

Apache-2.0
Latest version published 3 years ago

Package Health Score

64 / 100
Full package analysis

Popular @agoric/eventual-send functions

Similar packages