@agoric/zoe 0.27.0-upgrade-20-dev-ef71cfd.0 → 0.27.0-upgrade-19-devnet-dev-5428c4d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/bundle-contractFacet-js-meta.json +275 -270
- package/bundles/bundle-contractFacet.js +1 -1
- package/package.json +29 -29
- package/src/cleanProposal.d.ts +0 -2
- package/src/cleanProposal.d.ts.map +1 -1
- package/src/cleanProposal.js +2 -4
- package/src/contractFacet/exit.d.ts +1 -1
- package/src/contractFacet/exit.d.ts.map +1 -1
- package/src/contractFacet/internal-types.d.ts +8 -0
- package/src/contractFacet/internal-types.d.ts.map +1 -0
- package/src/contractFacet/internal-types.js +15 -0
- package/src/contractFacet/offerHandlerStorage.d.ts +1 -1
- package/src/contractFacet/rightsConservation.d.ts.map +1 -1
- package/src/contractFacet/rightsConservation.js +1 -0
- package/src/contractFacet/{types.ts → types-ambient.d.ts} +29 -66
- package/src/contractFacet/types-ambient.js +1 -0
- package/src/contractFacet/vatRoot.d.ts +2 -8
- package/src/contractFacet/vatRoot.d.ts.map +1 -1
- package/src/contractFacet/vatRoot.js +4 -5
- package/src/contractFacet/zcfMint.d.ts +2 -3
- package/src/contractFacet/zcfMint.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.js +7 -7
- package/src/contractFacet/zcfSeat.js +2 -2
- package/src/contractFacet/zcfZygote.d.ts +1 -9
- package/src/contractFacet/zcfZygote.d.ts.map +1 -1
- package/src/contractFacet/zcfZygote.js +5 -17
- package/src/contractSupport/atomicTransfer.d.ts +0 -6
- package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
- package/src/contractSupport/atomicTransfer.js +0 -4
- package/src/contractSupport/bondingCurves.js +1 -1
- package/src/contractSupport/index.d.ts +2 -2
- package/src/contractSupport/index.js +19 -2
- package/src/contractSupport/priceAuthorityInitial.d.ts +0 -2
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityInitial.js +1 -3
- package/src/contractSupport/ratio.d.ts +37 -0
- package/src/contractSupport/ratio.d.ts.map +1 -0
- package/src/contractSupport/ratio.js +419 -0
- package/src/contractSupport/safeMath.d.ts +11 -0
- package/src/contractSupport/safeMath.d.ts.map +1 -0
- package/src/contractSupport/safeMath.js +49 -0
- package/src/contractSupport/types-ambient.d.ts.map +1 -1
- package/src/contractSupport/types-ambient.js +0 -1
- package/src/contractSupport/zoeHelpers.d.ts +1 -6
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
- package/src/contractSupport/zoeHelpers.js +0 -1
- package/src/contracts/atomicSwap.d.ts +1 -1
- package/src/contracts/auction/index.d.ts +3 -3
- package/src/contracts/automaticRefund.d.ts +3 -3
- package/src/contracts/autoswap.d.ts +0 -4
- package/src/contracts/autoswap.d.ts.map +1 -1
- package/src/contracts/autoswap.js +0 -4
- package/src/contracts/barterExchange.d.ts +2 -2
- package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
- package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
- package/src/contracts/coveredCall-durable.d.ts +1 -1
- package/src/contracts/coveredCall.d.ts +1 -1
- package/src/contracts/loan/index.d.ts +1 -1
- package/src/contracts/loan/types-ambient.d.ts +13 -13
- package/src/contracts/loan/types-ambient.d.ts.map +1 -1
- package/src/contracts/loan/types-ambient.js +17 -17
- package/src/contracts/mintPayments.d.ts +2 -2
- package/src/contracts/oracle.d.ts +0 -3
- package/src/contracts/oracle.d.ts.map +1 -1
- package/src/contracts/oracle.js +0 -1
- package/src/contracts/priceAggregator.d.ts +0 -2
- package/src/contracts/priceAggregator.d.ts.map +1 -1
- package/src/contracts/priceAggregator.js +8 -10
- package/src/contracts/scaledPriceAuthority.d.ts +0 -1
- package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
- package/src/contracts/scaledPriceAuthority.js +0 -1
- package/src/contracts/sellItems.d.ts +1 -1
- package/src/contracts/simpleExchange.d.ts +0 -5
- package/src/contracts/simpleExchange.d.ts.map +1 -1
- package/src/contracts/simpleExchange.js +0 -4
- package/src/contracts/types-ambient.d.ts +7 -7
- package/src/contracts/types-ambient.d.ts.map +1 -1
- package/src/contracts/types-ambient.js +7 -7
- package/src/contracts/valueVow.contract.d.ts +2 -5
- package/src/contracts/valueVow.contract.d.ts.map +1 -1
- package/src/contracts/valueVow.contract.js +0 -1
- package/src/instanceRecordStorage.d.ts.map +1 -1
- package/src/instanceRecordStorage.js +1 -3
- package/src/internal-types.d.ts +5 -15
- package/src/internal-types.d.ts.map +1 -1
- package/src/internal-types.js +4 -9
- package/src/issuerRecord.d.ts +2 -3
- package/src/issuerRecord.d.ts.map +1 -1
- package/src/issuerRecord.js +2 -6
- package/src/issuerStorage.d.ts +2 -3
- package/src/issuerStorage.d.ts.map +1 -1
- package/src/issuerStorage.js +5 -6
- package/src/typeGuards.d.ts +6 -10
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +5 -7
- package/src/types-ambient.d.ts +40 -0
- package/src/types-ambient.d.ts.map +1 -1
- package/src/types-ambient.js +42 -4
- package/src/zoeService/feeMint.d.ts +0 -1
- package/src/zoeService/feeMint.d.ts.map +1 -1
- package/src/zoeService/feeMint.js +0 -4
- package/src/zoeService/installationStorage.d.ts +2 -3
- package/src/zoeService/installationStorage.d.ts.map +1 -1
- package/src/zoeService/installationStorage.js +5 -2
- package/src/zoeService/internal-types.d.ts +3 -11
- package/src/zoeService/internal-types.d.ts.map +1 -1
- package/src/zoeService/internal-types.js +3 -9
- package/src/zoeService/invitationQueries.d.ts +3 -3
- package/src/zoeService/invitationQueries.js +3 -3
- package/src/zoeService/makeInvitation.d.ts +0 -1
- package/src/zoeService/makeInvitation.d.ts.map +1 -1
- package/src/zoeService/makeInvitation.js +0 -3
- package/src/zoeService/offer/offer.d.ts +0 -1
- package/src/zoeService/offer/offer.d.ts.map +1 -1
- package/src/zoeService/offer/offer.js +1 -3
- package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
- package/src/zoeService/originalZoeSeat.js +1 -0
- package/src/zoeService/startInstance.d.ts.map +1 -1
- package/src/zoeService/startInstance.js +2 -0
- package/src/zoeService/types-ambient.d.ts +226 -0
- package/src/zoeService/types-ambient.d.ts.map +1 -1
- package/src/zoeService/types-ambient.js +327 -4
- package/src/zoeService/utils.d.ts +5 -13
- package/src/zoeService/utils.test-d.ts +0 -1
- package/src/zoeService/zoe.d.ts +1 -11
- package/src/zoeService/zoe.d.ts.map +1 -1
- package/src/zoeService/zoe.js +1 -8
- package/src/zoeService/zoeSeat.d.ts.map +1 -1
- package/src/zoeService/zoeSeat.js +2 -1
- package/src/zoeService/zoeStorageManager.d.ts +5 -5
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
- package/src/zoeService/zoeStorageManager.js +3 -4
- package/tools/fakeVatAdmin.d.ts +2 -9
- package/tools/fakeVatAdmin.d.ts.map +1 -1
- package/tools/fakeVatAdmin.js +10 -18
- package/tools/manualPriceAuthority.d.ts +1 -4
- package/tools/manualPriceAuthority.d.ts.map +1 -1
- package/tools/manualPriceAuthority.js +0 -1
- package/tools/scriptedOracle.d.ts +2 -6
- package/tools/scriptedOracle.d.ts.map +1 -1
- package/tools/scriptedOracle.js +0 -4
- package/tools/setup-zoe.d.ts +6 -12
- package/tools/setup-zoe.d.ts.map +1 -1
- package/tools/setup-zoe.js +5 -38
- package/tools/test-utils.d.ts +1 -1
- package/tools/test-utils.js +1 -1
- package/tools/types.d.ts +0 -1
- package/tools/types.d.ts.map +1 -1
- package/tools/types.js +0 -1
- package/src/contractFacet/types.d.ts +0 -184
- package/src/contractFacet/types.d.ts.map +0 -1
- package/src/types-index.d.ts +0 -4
- package/src/types-index.js +0 -2
- package/src/types.d.ts +0 -29
- package/src/types.d.ts.map +0 -1
- package/src/types.ts +0 -44
- package/src/zoeService/types.d.ts +0 -238
- package/src/zoeService/types.d.ts.map +0 -1
- package/src/zoeService/types.ts +0 -307
|
@@ -8,7 +8,7 @@ export {
|
|
|
8
8
|
calcSecondaryRequired,
|
|
9
9
|
} from './bondingCurves.js';
|
|
10
10
|
|
|
11
|
-
export { natSafeMath } from '
|
|
11
|
+
export { natSafeMath } from './safeMath.js';
|
|
12
12
|
|
|
13
13
|
export { makeStateMachine } from './stateMachine.js';
|
|
14
14
|
|
|
@@ -34,7 +34,24 @@ export {
|
|
|
34
34
|
offerTo,
|
|
35
35
|
} from './zoeHelpers.js';
|
|
36
36
|
|
|
37
|
-
export
|
|
37
|
+
export {
|
|
38
|
+
makeRatio,
|
|
39
|
+
makeRatioFromAmounts,
|
|
40
|
+
floorMultiplyBy,
|
|
41
|
+
floorDivideBy,
|
|
42
|
+
ceilMultiplyBy,
|
|
43
|
+
ceilDivideBy,
|
|
44
|
+
assertIsRatio,
|
|
45
|
+
invertRatio,
|
|
46
|
+
oneMinus,
|
|
47
|
+
addRatios,
|
|
48
|
+
multiplyRatios,
|
|
49
|
+
ratiosSame,
|
|
50
|
+
quantize,
|
|
51
|
+
ratioGTE,
|
|
52
|
+
subtractRatios,
|
|
53
|
+
ratioToNumber,
|
|
54
|
+
} from './ratio.js';
|
|
38
55
|
|
|
39
56
|
export * from './durability.js';
|
|
40
57
|
export * from './prepare-ownable.js';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export function makeInitialTransform(priceOutPerIn: Ratio, priceAuthority: PriceAuthority, quoteMint: ERef<Mint<"set", PriceDescription>>, brandIn: Brand<"nat">, brandOut: Brand<"nat">): PriceAuthority;
|
|
2
2
|
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
3
3
|
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
4
|
-
import type { Mint } from '@agoric/ertp';
|
|
5
|
-
import type { Brand } from '@agoric/ertp';
|
|
6
4
|
//# sourceMappingURL=priceAuthorityInitial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceAuthorityInitial.d.ts","sourceRoot":"","sources":["priceAuthorityInitial.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"priceAuthorityInitial.d.ts","sourceRoot":"","sources":["priceAuthorityInitial.js"],"names":[],"mappings":"AA6BO,oDAPI,KAAK,kBACL,cAAc,aACd,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,WACnC,KAAK,CAAC,KAAK,CAAC,YACZ,KAAK,CAAC,KAAK,CAAC,GACV,cAAc,CAyF1B;oCAvG4F,4BAA4B;sCAA5B,4BAA4B"}
|
|
@@ -7,12 +7,10 @@ import { Far } from '@endo/marshal';
|
|
|
7
7
|
import { makeNotifier } from '@agoric/notifier';
|
|
8
8
|
import { AmountMath } from '@agoric/ertp';
|
|
9
9
|
|
|
10
|
-
import { multiplyBy } from '
|
|
10
|
+
import { multiplyBy } from './ratio.js';
|
|
11
11
|
import { mintQuote } from './priceAuthorityTransform.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @import {Amount, Brand, Mint} from '@agoric/ertp';
|
|
15
|
-
* @import {Notifier} from '@agoric/notifier';
|
|
16
14
|
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
17
15
|
*/
|
|
18
16
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function assertIsRatio(ratio: any): void;
|
|
2
|
+
export function makeRatio(numerator: bigint, numeratorBrand: Brand, denominator?: bigint, denominatorBrand?: Brand): Ratio;
|
|
3
|
+
export function makeRatioFromAmounts(numeratorAmount: Amount, denominatorAmount: Amount): Ratio;
|
|
4
|
+
/** @type {ScaleAmount} */
|
|
5
|
+
export const floorMultiplyBy: ScaleAmount;
|
|
6
|
+
/** @type {ScaleAmount} */
|
|
7
|
+
export const ceilMultiplyBy: ScaleAmount;
|
|
8
|
+
/** @type {ScaleAmount} */
|
|
9
|
+
export const multiplyBy: ScaleAmount;
|
|
10
|
+
/**
|
|
11
|
+
* Divide the amount by the ratio, truncating the remainder.
|
|
12
|
+
* @type {ScaleAmount}
|
|
13
|
+
*/
|
|
14
|
+
export const floorDivideBy: ScaleAmount;
|
|
15
|
+
/**
|
|
16
|
+
* Divide the amount by the ratio, rounding up the remainder.
|
|
17
|
+
* @type {ScaleAmount}
|
|
18
|
+
*/
|
|
19
|
+
export const ceilDivideBy: ScaleAmount;
|
|
20
|
+
/**
|
|
21
|
+
* Divide the amount by the ratio, rounding to nearest with ties to even (aka Banker's Rounding) as in IEEE 754 default rounding.
|
|
22
|
+
* @type {ScaleAmount}
|
|
23
|
+
*/
|
|
24
|
+
export const divideBy: ScaleAmount;
|
|
25
|
+
export function invertRatio(ratio: Ratio): Ratio;
|
|
26
|
+
export function addRatios(left: Ratio, right: Ratio): Ratio;
|
|
27
|
+
export function subtractRatios(left: Ratio, right: Ratio): Ratio;
|
|
28
|
+
export function multiplyRatios(left: Ratio, right: Ratio): Ratio;
|
|
29
|
+
export function oneMinus(ratio: Ratio): Ratio;
|
|
30
|
+
export function ratioGTE(left: Ratio, right: Ratio): boolean;
|
|
31
|
+
export function ratiosSame(left: Ratio, right: Ratio): boolean;
|
|
32
|
+
export function quantize(ratio: Ratio, newDen: bigint): Ratio;
|
|
33
|
+
export function parseRatio(numeric: ParsableNumber, numeratorBrand: Brand, denominatorBrand?: Brand): Ratio;
|
|
34
|
+
export function assertParsableNumber(specimen: unknown): asserts specimen is ParsableNumber;
|
|
35
|
+
export function ratioToNumber(ratio: Ratio): number;
|
|
36
|
+
export type ParsableNumber = bigint | number | string;
|
|
37
|
+
//# sourceMappingURL=ratio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ratio.d.ts","sourceRoot":"","sources":["ratio.js"],"names":[],"mappings":"AAwCO,gDAcN;AASM,qCANI,MAAM,kBACN,KAAK,gBACL,MAAM,qBACN,KAAK,GACH,KAAK,CAejB;AAOM,sDAJI,MAAM,qBACN,MAAM,GACJ,KAAK,CAYjB;AA2BD,0BAA0B;AAC1B,8BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,6BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,yBADW,WAAW,CAGpB;AA2BF;;;GAGG;AACH,4BAFU,WAAW,CAInB;AAEF;;;GAGG;AACH,2BAFU,WAAW,CAInB;AAEF;;;GAGG;AACH,uBAFU,WAAW,CAInB;AAMK,mCAHI,KAAK,GACH,KAAK,CAWjB;AAOM,gCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAwBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAmBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CA8BjB;AAQM,gCAHI,KAAK,GACH,KAAK,CAcjB;AAOM,+BAJI,KAAK,SACL,KAAK,GACH,OAAO,CAkBnB;AASM,iCAJI,KAAK,SACL,KAAK,GACH,OAAO,CAOnB;AAUM,gCAJI,KAAK,UACL,MAAM,GACJ,KAAK,CAiBjB;AAaM,oCALI,cAAc,kBACd,KAAK,qBACL,KAAK,GACH,KAAK,CAmBjB;AAMM,+CAHI,OAAO,GACL,QAAQ,QAAQ,IAAI,cAAc,CAK9C;AAQM,qCAHI,KAAK,GACH,MAAM,CAMlB;6BAhDa,MAAM,GAAG,MAAM,GAAG,MAAM"}
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
/// <reference path="./types-ambient.js" />
|
|
2
|
+
import { q, Fail } from '@endo/errors';
|
|
3
|
+
import { AmountMath } from '@agoric/ertp';
|
|
4
|
+
import { assertRecord } from '@endo/marshal';
|
|
5
|
+
import { isNat } from '@endo/nat';
|
|
6
|
+
|
|
7
|
+
import { natSafeMath } from './safeMath.js';
|
|
8
|
+
|
|
9
|
+
const { multiply, floorDivide, ceilDivide, bankersDivide, add, subtract } =
|
|
10
|
+
natSafeMath;
|
|
11
|
+
|
|
12
|
+
// make a Ratio, which represents a fraction. It is a pass-by-copy record.
|
|
13
|
+
//
|
|
14
|
+
// The natural syntax for the most common operations we want to support
|
|
15
|
+
// are Amount * Ratio and Amount / Ratio. Since the operations want to adhere to
|
|
16
|
+
// the ratio rather than the amount, we settled on a calling convention of
|
|
17
|
+
// [ceil|floor]MultiplyBy(Amount, Ratio) and [ceil|floor]DivideBy(Amount, Ratio)
|
|
18
|
+
//
|
|
19
|
+
// The most common kind of Ratio can be applied to Amounts of a particular
|
|
20
|
+
// brand, and produces results of the same brand. This represents a multiplier
|
|
21
|
+
// that is only applicable to that brand. The less common kind of Ratio can be
|
|
22
|
+
// applied to one particular brand of amounts, and produces results of another
|
|
23
|
+
// particular brand. This represents some kind of exchange rate. The
|
|
24
|
+
// brand-checking helps us ensure that normal Ratios aren't applied to amounts
|
|
25
|
+
// of the wrong brand, and that exchange rates are only used in the appropriate
|
|
26
|
+
// direction.
|
|
27
|
+
//
|
|
28
|
+
// Since the ratios are represented by a numerator and a denominator, every
|
|
29
|
+
// multiplication or division operation that produces an amount ends with a
|
|
30
|
+
// division of the underlying bigints, and integer division requires a mode
|
|
31
|
+
// of [rounding to integer](https://en.wikipedia.org/wiki/Rounding#Rounding_to_integer).
|
|
32
|
+
// Because `Ratio` only work with Natural numbers, just three modes suffice:
|
|
33
|
+
// - floor rounds down
|
|
34
|
+
// - ceil rounds up
|
|
35
|
+
// - default (without prefix) minimizes bias by rounding half to even
|
|
36
|
+
|
|
37
|
+
const PERCENT = 100n;
|
|
38
|
+
|
|
39
|
+
const ratioPropertyNames = ['numerator', 'denominator'];
|
|
40
|
+
|
|
41
|
+
export const assertIsRatio = ratio => {
|
|
42
|
+
assertRecord(ratio, 'ratio');
|
|
43
|
+
const keys = Object.keys(ratio);
|
|
44
|
+
keys.length === 2 || Fail`Ratio ${ratio} must be a record with 2 fields.`;
|
|
45
|
+
for (const name of keys) {
|
|
46
|
+
ratioPropertyNames.includes(name) ||
|
|
47
|
+
Fail`Parameter must be a Ratio record, but ${ratio} has ${q(name)}`;
|
|
48
|
+
}
|
|
49
|
+
const numeratorValue = ratio.numerator.value;
|
|
50
|
+
const denominatorValue = ratio.denominator.value;
|
|
51
|
+
isNat(numeratorValue) ||
|
|
52
|
+
Fail`The numerator value must be a NatValue, not ${numeratorValue}`;
|
|
53
|
+
isNat(denominatorValue) ||
|
|
54
|
+
Fail`The denominator value must be a NatValue, not ${denominatorValue}`;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {bigint} numerator
|
|
59
|
+
* @param {Brand} numeratorBrand
|
|
60
|
+
* @param {bigint} [denominator] The default denominator is 100
|
|
61
|
+
* @param {Brand} [denominatorBrand] The default is to reuse the numeratorBrand
|
|
62
|
+
* @returns {Ratio}
|
|
63
|
+
*/
|
|
64
|
+
export const makeRatio = (
|
|
65
|
+
numerator,
|
|
66
|
+
numeratorBrand,
|
|
67
|
+
denominator = PERCENT,
|
|
68
|
+
denominatorBrand = numeratorBrand,
|
|
69
|
+
) => {
|
|
70
|
+
denominator > 0n ||
|
|
71
|
+
Fail`No infinite ratios! Denominator was 0 ${q(denominatorBrand)}`;
|
|
72
|
+
|
|
73
|
+
return harden({
|
|
74
|
+
numerator: AmountMath.make(numeratorBrand, numerator),
|
|
75
|
+
denominator: AmountMath.make(denominatorBrand, denominator),
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {Amount} numeratorAmount
|
|
81
|
+
* @param {Amount} denominatorAmount
|
|
82
|
+
* @returns {Ratio}
|
|
83
|
+
*/
|
|
84
|
+
export const makeRatioFromAmounts = (numeratorAmount, denominatorAmount) => {
|
|
85
|
+
AmountMath.coerce(numeratorAmount.brand, numeratorAmount);
|
|
86
|
+
AmountMath.coerce(denominatorAmount.brand, denominatorAmount);
|
|
87
|
+
return makeRatio(
|
|
88
|
+
// @ts-expect-error value can be any AmountValue but makeRatio() supports only bigint
|
|
89
|
+
numeratorAmount.value,
|
|
90
|
+
numeratorAmount.brand,
|
|
91
|
+
denominatorAmount.value,
|
|
92
|
+
denominatorAmount.brand,
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {Amount<'nat'>} amount
|
|
98
|
+
* @param {Ratio} ratio
|
|
99
|
+
* @param {*} divideOp
|
|
100
|
+
* @returns {Amount<'nat'>}
|
|
101
|
+
*/
|
|
102
|
+
const multiplyHelper = (amount, ratio, divideOp) => {
|
|
103
|
+
AmountMath.coerce(amount.brand, amount);
|
|
104
|
+
assertIsRatio(ratio);
|
|
105
|
+
amount.brand === ratio.denominator.brand ||
|
|
106
|
+
Fail`amount's brand ${q(amount.brand)} must match ratio's denominator ${q(
|
|
107
|
+
ratio.denominator.brand,
|
|
108
|
+
)}`;
|
|
109
|
+
|
|
110
|
+
return /** @type {Amount<'nat'>} */ (
|
|
111
|
+
AmountMath.make(
|
|
112
|
+
ratio.numerator.brand,
|
|
113
|
+
divideOp(
|
|
114
|
+
multiply(amount.value, ratio.numerator.value),
|
|
115
|
+
ratio.denominator.value,
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** @type {ScaleAmount} */
|
|
122
|
+
export const floorMultiplyBy = (amount, ratio) => {
|
|
123
|
+
return multiplyHelper(amount, ratio, floorDivide);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** @type {ScaleAmount} */
|
|
127
|
+
export const ceilMultiplyBy = (amount, ratio) => {
|
|
128
|
+
return multiplyHelper(amount, ratio, ceilDivide);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** @type {ScaleAmount} */
|
|
132
|
+
export const multiplyBy = (amount, ratio) => {
|
|
133
|
+
return multiplyHelper(amount, ratio, bankersDivide);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @param {Amount<'nat'>} amount
|
|
138
|
+
* @param {Ratio} ratio
|
|
139
|
+
* @param {*} divideOp
|
|
140
|
+
* @returns {Amount<'nat'>}
|
|
141
|
+
*/
|
|
142
|
+
const divideHelper = (amount, ratio, divideOp) => {
|
|
143
|
+
AmountMath.coerce(amount.brand, amount);
|
|
144
|
+
assertIsRatio(ratio);
|
|
145
|
+
amount.brand === ratio.numerator.brand ||
|
|
146
|
+
Fail`amount's brand ${q(amount.brand)} must match ratio's numerator ${q(
|
|
147
|
+
ratio.numerator.brand,
|
|
148
|
+
)}`;
|
|
149
|
+
|
|
150
|
+
return /** @type {Amount<'nat'>} */ (
|
|
151
|
+
AmountMath.make(
|
|
152
|
+
ratio.denominator.brand,
|
|
153
|
+
divideOp(
|
|
154
|
+
multiply(amount.value, ratio.denominator.value),
|
|
155
|
+
ratio.numerator.value,
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Divide the amount by the ratio, truncating the remainder.
|
|
163
|
+
* @type {ScaleAmount}
|
|
164
|
+
*/
|
|
165
|
+
export const floorDivideBy = (amount, ratio) => {
|
|
166
|
+
return divideHelper(amount, ratio, floorDivide);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Divide the amount by the ratio, rounding up the remainder.
|
|
171
|
+
* @type {ScaleAmount}
|
|
172
|
+
*/
|
|
173
|
+
export const ceilDivideBy = (amount, ratio) => {
|
|
174
|
+
return divideHelper(amount, ratio, ceilDivide);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Divide the amount by the ratio, rounding to nearest with ties to even (aka Banker's Rounding) as in IEEE 754 default rounding.
|
|
179
|
+
* @type {ScaleAmount}
|
|
180
|
+
*/
|
|
181
|
+
export const divideBy = (amount, ratio) => {
|
|
182
|
+
return divideHelper(amount, ratio, bankersDivide);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {Ratio} ratio
|
|
187
|
+
* @returns {Ratio}
|
|
188
|
+
*/
|
|
189
|
+
export const invertRatio = ratio => {
|
|
190
|
+
assertIsRatio(ratio);
|
|
191
|
+
|
|
192
|
+
return makeRatio(
|
|
193
|
+
/** @type {NatValue} */ (ratio.denominator.value),
|
|
194
|
+
ratio.denominator.brand,
|
|
195
|
+
/** @type {NatValue} */ (ratio.numerator.value),
|
|
196
|
+
ratio.numerator.brand,
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @param {Ratio} left
|
|
202
|
+
* @param {Ratio} right
|
|
203
|
+
* @returns {Ratio}
|
|
204
|
+
*/
|
|
205
|
+
export const addRatios = (left, right) => {
|
|
206
|
+
assertIsRatio(right);
|
|
207
|
+
assertIsRatio(left);
|
|
208
|
+
left.numerator.brand === right.numerator.brand ||
|
|
209
|
+
Fail`numerator brands must match: ${q(left)} ${q(right)}`;
|
|
210
|
+
left.denominator.brand === right.denominator.brand ||
|
|
211
|
+
Fail`denominator brands must match: ${q(left)} ${q(right)}`;
|
|
212
|
+
|
|
213
|
+
// Simplifying the expression:
|
|
214
|
+
// (and + bnd) / y d**2
|
|
215
|
+
// (a + b) nd / y d**2
|
|
216
|
+
// ((a + b) n / y d) * (d / d)
|
|
217
|
+
// (a + b) n / yd
|
|
218
|
+
return makeRatio(
|
|
219
|
+
add(
|
|
220
|
+
multiply(left.numerator.value, right.denominator.value), // a nd
|
|
221
|
+
multiply(left.denominator.value, right.numerator.value), // b nd
|
|
222
|
+
), // (a + b) nd
|
|
223
|
+
left.numerator.brand,
|
|
224
|
+
multiply(left.denominator.value, right.denominator.value), // y d**2
|
|
225
|
+
left.denominator.brand,
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @param {Ratio} left
|
|
231
|
+
* @param {Ratio} right
|
|
232
|
+
* @returns {Ratio}
|
|
233
|
+
*/
|
|
234
|
+
export const subtractRatios = (left, right) => {
|
|
235
|
+
assertIsRatio(right);
|
|
236
|
+
assertIsRatio(left);
|
|
237
|
+
left.numerator.brand === right.numerator.brand ||
|
|
238
|
+
Fail`numerator brands must match: ${q(left)} ${q(right)}`;
|
|
239
|
+
left.denominator.brand === right.denominator.brand ||
|
|
240
|
+
Fail`denominator brands must match: ${q(left)} ${q(right)}`;
|
|
241
|
+
|
|
242
|
+
return makeRatio(
|
|
243
|
+
subtract(
|
|
244
|
+
multiply(left.numerator.value, right.denominator.value), // a nd
|
|
245
|
+
multiply(left.denominator.value, right.numerator.value), // b nd
|
|
246
|
+
), // (a - b) nd
|
|
247
|
+
left.numerator.brand,
|
|
248
|
+
multiply(left.denominator.value, right.denominator.value), // y d**2
|
|
249
|
+
left.denominator.brand,
|
|
250
|
+
);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @param {Ratio} left
|
|
255
|
+
* @param {Ratio} right
|
|
256
|
+
* @returns {Ratio}
|
|
257
|
+
*/
|
|
258
|
+
export const multiplyRatios = (left, right) => {
|
|
259
|
+
assertIsRatio(right);
|
|
260
|
+
assertIsRatio(left);
|
|
261
|
+
|
|
262
|
+
const getRemainingBrands = () => {
|
|
263
|
+
// Prefer results that have the same brand as the left operand.
|
|
264
|
+
if (right.numerator.brand === right.denominator.brand) {
|
|
265
|
+
return [left.numerator.brand, left.denominator.brand];
|
|
266
|
+
}
|
|
267
|
+
if (right.numerator.brand === left.denominator.brand) {
|
|
268
|
+
return [left.numerator.brand, right.denominator.brand];
|
|
269
|
+
}
|
|
270
|
+
if (left.numerator.brand === right.denominator.brand) {
|
|
271
|
+
return [right.numerator.brand, left.denominator.brand];
|
|
272
|
+
}
|
|
273
|
+
if (left.numerator.brand === left.denominator.brand) {
|
|
274
|
+
return [right.numerator.brand, right.denominator.brand];
|
|
275
|
+
}
|
|
276
|
+
throw Fail`at least one brand must cancel out: ${q(left)} ${q(right)}`;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const [numeratorBrand, denominatorBrand] = getRemainingBrands();
|
|
280
|
+
return makeRatio(
|
|
281
|
+
multiply(left.numerator.value, right.numerator.value),
|
|
282
|
+
numeratorBrand,
|
|
283
|
+
multiply(left.denominator.value, right.denominator.value),
|
|
284
|
+
denominatorBrand,
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* If ratio is between 0 and 1, subtract from 1.
|
|
290
|
+
*
|
|
291
|
+
* @param {Ratio} ratio
|
|
292
|
+
* @returns {Ratio}
|
|
293
|
+
*/
|
|
294
|
+
export const oneMinus = ratio => {
|
|
295
|
+
assertIsRatio(ratio);
|
|
296
|
+
ratio.numerator.brand === ratio.denominator.brand ||
|
|
297
|
+
Fail`oneMinus only supports ratios with a single brand, but ${ratio.numerator.brand} doesn't match ${ratio.denominator.brand}`;
|
|
298
|
+
ratio.numerator.value <= ratio.denominator.value ||
|
|
299
|
+
Fail`Parameter must be less than or equal to 1: ${ratio.numerator.value}/${ratio.denominator.value}`;
|
|
300
|
+
return makeRatio(
|
|
301
|
+
subtract(ratio.denominator.value, ratio.numerator.value),
|
|
302
|
+
ratio.numerator.brand,
|
|
303
|
+
ratio.denominator.value,
|
|
304
|
+
ratio.numerator.brand,
|
|
305
|
+
);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @param {Ratio} left
|
|
310
|
+
* @param {Ratio} right
|
|
311
|
+
* @returns {boolean}
|
|
312
|
+
*/
|
|
313
|
+
export const ratioGTE = (left, right) => {
|
|
314
|
+
if (left.numerator.brand === right.numerator.brand) {
|
|
315
|
+
left.denominator.brand === right.denominator.brand ||
|
|
316
|
+
Fail`numerator brands match, but denominator brands don't: ${q(left)} ${q(
|
|
317
|
+
right,
|
|
318
|
+
)}`;
|
|
319
|
+
} else if (left.numerator.brand === left.denominator.brand) {
|
|
320
|
+
right.numerator.brand === right.denominator.brand ||
|
|
321
|
+
Fail`lefthand brands match, but righthand brands don't: ${q(left)} ${q(
|
|
322
|
+
right,
|
|
323
|
+
)}`;
|
|
324
|
+
}
|
|
325
|
+
return natSafeMath.isGTE(
|
|
326
|
+
multiply(left.numerator.value, right.denominator.value),
|
|
327
|
+
multiply(right.numerator.value, left.denominator.value),
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* True iff the ratios are the same values (equal or equivalant may return false)
|
|
333
|
+
*
|
|
334
|
+
* @param {Ratio} left
|
|
335
|
+
* @param {Ratio} right
|
|
336
|
+
* @returns {boolean}
|
|
337
|
+
*/
|
|
338
|
+
export const ratiosSame = (left, right) => {
|
|
339
|
+
return (
|
|
340
|
+
AmountMath.isEqual(left.numerator, right.numerator) &&
|
|
341
|
+
AmountMath.isEqual(left.denominator, right.denominator)
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Make a new ratio with a smaller denominator that approximates the ratio. If
|
|
347
|
+
* the proposed denominator is larger than the current one, return the original.
|
|
348
|
+
*
|
|
349
|
+
* @param {Ratio} ratio
|
|
350
|
+
* @param {bigint} newDen
|
|
351
|
+
* @returns {Ratio}
|
|
352
|
+
*/
|
|
353
|
+
export const quantize = (ratio, newDen) => {
|
|
354
|
+
const oldDen = ratio.denominator.value;
|
|
355
|
+
const oldNum = ratio.numerator.value;
|
|
356
|
+
if (newDen > oldDen) {
|
|
357
|
+
return ratio;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const newNum =
|
|
361
|
+
newDen === oldDen ? oldNum : bankersDivide(oldNum * newDen, oldDen);
|
|
362
|
+
return makeRatio(
|
|
363
|
+
newNum,
|
|
364
|
+
ratio.numerator.brand,
|
|
365
|
+
newDen,
|
|
366
|
+
ratio.denominator.brand,
|
|
367
|
+
);
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const NUMERIC_RE = /^(\d\d*)(?:\.(\d*))?$/;
|
|
371
|
+
/** @typedef {bigint | number | string} ParsableNumber */
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Create a ratio from a given numeric value.
|
|
375
|
+
*
|
|
376
|
+
* @param {ParsableNumber} numeric
|
|
377
|
+
* @param {Brand} numeratorBrand
|
|
378
|
+
* @param {Brand} [denominatorBrand]
|
|
379
|
+
* @returns {Ratio}
|
|
380
|
+
*/
|
|
381
|
+
export const parseRatio = (
|
|
382
|
+
numeric,
|
|
383
|
+
numeratorBrand,
|
|
384
|
+
denominatorBrand = numeratorBrand,
|
|
385
|
+
) => {
|
|
386
|
+
const match = `${numeric}`.match(NUMERIC_RE);
|
|
387
|
+
if (!match) {
|
|
388
|
+
throw Fail`Invalid numeric data: ${numeric}`;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const [_, whole, part = ''] = match;
|
|
392
|
+
return makeRatio(
|
|
393
|
+
BigInt(`${whole}${part}`),
|
|
394
|
+
numeratorBrand,
|
|
395
|
+
10n ** BigInt(part.length),
|
|
396
|
+
denominatorBrand,
|
|
397
|
+
);
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @param {unknown} specimen
|
|
402
|
+
* @returns {asserts specimen is ParsableNumber}
|
|
403
|
+
*/
|
|
404
|
+
export const assertParsableNumber = specimen => {
|
|
405
|
+
const match = `${specimen}`.match(NUMERIC_RE);
|
|
406
|
+
match || Fail`Invalid numeric data: ${specimen}`;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Ratios might be greater or less than one.
|
|
411
|
+
*
|
|
412
|
+
* @param {Ratio} ratio
|
|
413
|
+
* @returns {number}
|
|
414
|
+
*/
|
|
415
|
+
export const ratioToNumber = ratio => {
|
|
416
|
+
const n = Number(ratio.numerator.value);
|
|
417
|
+
const d = Number(ratio.denominator.value);
|
|
418
|
+
return n / d;
|
|
419
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export namespace natSafeMath {
|
|
2
|
+
let add: NatOp;
|
|
3
|
+
let subtract: NatOp;
|
|
4
|
+
let multiply: NatOp;
|
|
5
|
+
let floorDivide: NatOp;
|
|
6
|
+
let ceilDivide: NatOp;
|
|
7
|
+
let bankersDivide: NatOp;
|
|
8
|
+
let isGTE: (x: number | bigint, y: number | bigint) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export type NatOp = (x: number | bigint, y: number | bigint) => NatValue;
|
|
11
|
+
//# sourceMappingURL=safeMath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeMath.d.ts","sourceRoot":"","sources":["safeMath.js"],"names":[],"mappings":";aAYa,KAAK;kBAGL,KAAK;kBAEL,KAAK;qBAEL,KAAK;oBAEL,KAAK;uBAQN,KAAK;eAiBJ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO;;oBA5ClD,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,QAAQ"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Nat } from '@endo/nat';
|
|
2
|
+
|
|
3
|
+
/** @typedef {(x: number | bigint, y: number | bigint) => NatValue} NatOp */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* These operations should be used for calculations with the values of
|
|
7
|
+
* basic fungible tokens.
|
|
8
|
+
*
|
|
9
|
+
* natSafeMath is designed to be used directly, and so it needs to
|
|
10
|
+
* validate the inputs, as well as the outputs when necessary.
|
|
11
|
+
*/
|
|
12
|
+
export const natSafeMath = harden({
|
|
13
|
+
/** @type {NatOp} */
|
|
14
|
+
// BigInts don't observably overflow
|
|
15
|
+
add: (x, y) => Nat(x) + Nat(y),
|
|
16
|
+
/** @type {NatOp} */
|
|
17
|
+
subtract: (x, y) => Nat(Nat(x) - Nat(y)),
|
|
18
|
+
/** @type {NatOp} */
|
|
19
|
+
multiply: (x, y) => Nat(x) * Nat(y),
|
|
20
|
+
/** @type {NatOp} */
|
|
21
|
+
floorDivide: (x, y) => Nat(x) / Nat(y),
|
|
22
|
+
/** @type {NatOp} */
|
|
23
|
+
ceilDivide: (x, y) => {
|
|
24
|
+
y = Nat(y);
|
|
25
|
+
return Nat(Nat(x) + y - 1n) / y;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Divide using half-to-even (aka Banker's Rounding) as in IEEE 774 default rounding
|
|
29
|
+
*
|
|
30
|
+
* @type {NatOp}
|
|
31
|
+
*/
|
|
32
|
+
bankersDivide: (a, b) => {
|
|
33
|
+
a = Nat(a);
|
|
34
|
+
b = Nat(b);
|
|
35
|
+
|
|
36
|
+
const div = a / b;
|
|
37
|
+
const rem = a % b;
|
|
38
|
+
// if remainder > half divisor, should have rounded up instead of down, so add 1
|
|
39
|
+
if (rem * 2n > b) {
|
|
40
|
+
return div + 1n;
|
|
41
|
+
} else if (rem * 2n === b) {
|
|
42
|
+
// Add 1 if result is odd to get an even return value
|
|
43
|
+
if (div % 2n === 1n) return div + 1n;
|
|
44
|
+
}
|
|
45
|
+
return div;
|
|
46
|
+
},
|
|
47
|
+
/** @type {(x: number | bigint, y: number | bigint) => boolean} */
|
|
48
|
+
isGTE: (x, y) => Nat(x) >= Nat(y),
|
|
49
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":";UAMc,OAAO;;;;;WACP,mBAAmB;;;;;;;;YAEnB,mBAAmB;;;;;;;;;;;;;;;kBAqBtB,GAAG,YACH,OAAO,aACP,OAAO,KACL,MAAM;;;;;;;;;;uBAcR,GAAG,YACH,OAAO,aACP,OAAO,KACL,MAAM;;;;4BAIN,MAAM,CAAC,OAAO,EAAC,OAAO,CAAC;;;;;;qEAYvB,oBAAoB;;;;;;;mCAWtB,mBAAmB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,SAAS,kBAC7E,oBAAoB;;eAKjB,MAAM,CAAC,KAAK,CAAC;iBACb,MAAM,CAAC,KAAK,CAAC;;4BAKhB,MAAM,CAAC,KAAK,CAAC,SACb,KAAK,KACH,MAAM,CAAC,KAAK,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {Pattern} from '@endo/patterns';
|
|
3
|
-
* @import {ContractMeta, Invitation, Proposal, ZCF, ZCFSeat} from '@agoric/zoe';
|
|
4
3
|
*/
|
|
5
4
|
export const defaultAcceptanceMsg: "The offer has been accepted. Once the contract has been completed, please check your payout";
|
|
6
5
|
export function assertIssuerKeywords(zcf: any, expected: any): void;
|
|
@@ -15,7 +14,7 @@ export function assertNatAssetKind(zcf: any, brand: any): void;
|
|
|
15
14
|
export const depositToSeatSuccessMsg: "Deposit and reallocation successful.";
|
|
16
15
|
export function depositToSeat(zcf: ZCF, recipientSeat: ZCFSeat, amounts: AmountKeywordRecord, payments: PaymentPKeywordRecord): Promise<string>;
|
|
17
16
|
export function withdrawFromSeat(zcf: ZCF, seat: ZCFSeat, amounts: AmountKeywordRecord): Promise<PaymentPKeywordRecord>;
|
|
18
|
-
export function saveAllIssuers(zcf: ZCF, issuerKeywordRecord?: IssuerKeywordRecord): Promise<(
|
|
17
|
+
export function saveAllIssuers(zcf: ZCF, issuerKeywordRecord?: IssuerKeywordRecord): Promise<(IssuerRecord<any, import("@endo/patterns").Key> | undefined)[]>;
|
|
19
18
|
/** @type {MapKeywords} */
|
|
20
19
|
export const mapKeywords: MapKeywords;
|
|
21
20
|
export function offerTo<Args extends unknown, Result extends unknown>(zcf: ZCF, invitation: ERef<Invitation<Result, Args>>, keywordMapping: KeywordKeywordRecord | undefined, proposal: Proposal, fromSeat: ZCFSeat, toSeat?: ZCFSeat, offerArgs?: Args): Promise<{
|
|
@@ -31,9 +30,5 @@ export type ExpectedRecord = {
|
|
|
31
30
|
give?: Record<string, null> | undefined;
|
|
32
31
|
exit?: Partial<Record<never, null>> | undefined;
|
|
33
32
|
};
|
|
34
|
-
import type { ZCFSeat } from '@agoric/zoe';
|
|
35
33
|
import type { Pattern } from '@endo/patterns';
|
|
36
|
-
import type { ZCF } from '@agoric/zoe';
|
|
37
|
-
import type { Invitation } from '@agoric/zoe';
|
|
38
|
-
import type { Proposal } from '@agoric/zoe';
|
|
39
34
|
//# sourceMappingURL=zoeHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"AASA;;GAEG;AAEH,iIAAkI;AAI3H,oEAON;AAuBM,oCALI,GAAG,QACH,cAAc,UACd,mBAAmB,GACjB,CAAC,GAAC,CAAC,CAOf;AAED,mBAAmB;AACnB,mBADW,IAAI,CAkBb;AAEF,wBAAwB;AACxB,wBADW,SAAS,CAqBlB;AAiBK,uCAHI,OAAO,iBACP,OAAO,QAIgD;AAsB3D,0CAHI,OAAO,YACP,cAAc,QA8BxB;AAGM,+DAGN;AAED,6EAA8E;AAavE,mCANI,GAAG,iBACH,OAAO,WACP,mBAAmB,YACnB,qBAAqB,GACnB,OAAO,CAAC,MAAM,CAAC,CA8B3B;AAYM,sCALI,GAAG,QACH,OAAO,WACP,mBAAmB,GACjB,OAAO,CAAC,qBAAqB,CAAC,CAQ1C;AAWM,oCAJI,GAAG,wBACH,mBAAmB,4EAgB7B;AAED,0BAA0B;AAC1B,0BADW,WAAW,CAYpB;AAiDK,wBAHe,IAAI,kBACJ,MAAM,uBA/BjB,GAAG,cAGH,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,kBAG9B,oBAAoB,GAAG,SAAS,YAKhC,QAAQ,YAGR,OAAO,WAGP,OAAO,cAIP,IAAI,GAGF,OAAO,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAAC,CAAC,CA+D1G;;iBAxVa,MAAM,cAAc;0BACpB,MAAM,UAAU;;;;;;;6BAnBJ,gBAAgB"}
|
|
@@ -9,7 +9,6 @@ import { atomicTransfer, fromOnly, toOnly } from './atomicTransfer.js';
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @import {Pattern} from '@endo/patterns';
|
|
12
|
-
* @import {ContractMeta, Invitation, Proposal, ZCF, ZCFSeat} from '@agoric/zoe';
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
export const defaultAcceptanceMsg = `The offer has been accepted. Once the contract has been completed, please check your payout`;
|
|
@@ -26,8 +26,8 @@ export function start(zcf: ZCF<{
|
|
|
26
26
|
winnerPriceOption?: "first-price" | "second-price";
|
|
27
27
|
bidDuration: bigint;
|
|
28
28
|
}>): {
|
|
29
|
-
creatorInvitation: Promise<
|
|
30
|
-
makeBidInvitation: () => Promise<
|
|
29
|
+
creatorInvitation: Promise<Invitation<{
|
|
30
|
+
makeBidInvitation: () => Promise<Invitation<unknown, never>>;
|
|
31
31
|
getSessionDetails: () => {
|
|
32
32
|
auctionedAssets: any;
|
|
33
33
|
minimumBid: any;
|
|
@@ -38,7 +38,7 @@ export function start(zcf: ZCF<{
|
|
|
38
38
|
bids: string | any[];
|
|
39
39
|
};
|
|
40
40
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
41
|
-
makeBidInvitation: () => Promise<
|
|
41
|
+
makeBidInvitation: () => Promise<Invitation<unknown, never>>;
|
|
42
42
|
getSessionDetails: () => {
|
|
43
43
|
auctionedAssets: any;
|
|
44
44
|
minimumBid: any;
|