@agoric/smart-wallet 0.5.4-dev-8879538.0 → 0.5.4-dev-35d20eb.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/package.json +14 -14
- package/src/invitations.d.ts +7 -3
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +29 -20
- package/src/marshal-contexts.d.ts +5 -7
- package/src/marshal-contexts.d.ts.map +1 -1
- package/src/marshal-contexts.js +36 -33
- package/src/offerWatcher.d.ts +5 -4
- package/src/offerWatcher.d.ts.map +1 -1
- package/src/offerWatcher.js +20 -15
- package/src/offers.d.ts +4 -4
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +8 -8
- package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +1 -1
- package/src/proposals/upgrade-walletFactory-proposal.js +3 -4
- package/src/smartWallet.d.ts +66 -41
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +143 -100
- package/src/utils.d.ts +9 -6
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +17 -4
- package/src/walletFactory.d.ts +7 -5
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +53 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/smart-wallet",
|
|
3
|
-
"version": "0.5.4-dev-
|
|
3
|
+
"version": "0.5.4-dev-35d20eb.0+35d20eb",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"lint:eslint": "eslint ."
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
20
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
21
|
-
"@agoric/zone": "0.2.3-dev-
|
|
19
|
+
"@agoric/cosmic-proto": "0.4.1-dev-35d20eb.0+35d20eb",
|
|
20
|
+
"@agoric/swingset-vat": "0.32.3-dev-35d20eb.0+35d20eb",
|
|
21
|
+
"@agoric/zone": "0.2.3-dev-35d20eb.0+35d20eb",
|
|
22
22
|
"@endo/bundle-source": "^3.2.3",
|
|
23
23
|
"@endo/captp": "^4.2.0",
|
|
24
24
|
"@endo/init": "^1.1.2",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"import-meta-resolve": "^2.2.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@agoric/assert": "0.6.1-dev-
|
|
30
|
-
"@agoric/casting": "0.4.3-dev-
|
|
31
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
32
|
-
"@agoric/internal": "0.3.3-dev-
|
|
33
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
34
|
-
"@agoric/store": "0.9.3-dev-
|
|
35
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
36
|
-
"@agoric/vats": "0.15.2-dev-
|
|
37
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
29
|
+
"@agoric/assert": "0.6.1-dev-35d20eb.0+35d20eb",
|
|
30
|
+
"@agoric/casting": "0.4.3-dev-35d20eb.0+35d20eb",
|
|
31
|
+
"@agoric/ertp": "0.16.3-dev-35d20eb.0+35d20eb",
|
|
32
|
+
"@agoric/internal": "0.3.3-dev-35d20eb.0+35d20eb",
|
|
33
|
+
"@agoric/notifier": "0.6.3-dev-35d20eb.0+35d20eb",
|
|
34
|
+
"@agoric/store": "0.9.3-dev-35d20eb.0+35d20eb",
|
|
35
|
+
"@agoric/vat-data": "0.5.3-dev-35d20eb.0+35d20eb",
|
|
36
|
+
"@agoric/vats": "0.15.2-dev-35d20eb.0+35d20eb",
|
|
37
|
+
"@agoric/zoe": "0.26.3-dev-35d20eb.0+35d20eb",
|
|
38
38
|
"@endo/eventual-send": "^1.2.2",
|
|
39
39
|
"@endo/far": "^1.1.2",
|
|
40
40
|
"@endo/marshal": "^1.5.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"typeCoverage": {
|
|
71
71
|
"atLeast": 94.35
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "35d20ebc6d57520d19faea3f6e507e6f9bf1682e"
|
|
74
74
|
}
|
package/src/invitations.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<i
|
|
|
5
5
|
export type InvitationSpec = AgoricContractInvitationSpec | ContractInvitationSpec | PurseInvitationSpec | ContinuingInvitationSpec;
|
|
6
6
|
/**
|
|
7
7
|
* source of invitation is a chain of calls starting with an agoricName
|
|
8
|
+
*
|
|
8
9
|
* - the start of the pipe is a lookup of instancePath within agoricNames
|
|
9
10
|
* - each entry in the callPipe executes a call on the preceding result
|
|
10
11
|
* - the end of the pipe is expected to return an Invitation
|
|
@@ -12,7 +13,7 @@ export type InvitationSpec = AgoricContractInvitationSpec | ContractInvitationSp
|
|
|
12
13
|
export type AgoricContractInvitationSpec = {
|
|
13
14
|
source: "agoricContract";
|
|
14
15
|
instancePath: string[];
|
|
15
|
-
callPipe:
|
|
16
|
+
callPipe: [methodName: string, methodArgs?: any[]][];
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* source is a contract (in which case this takes an Instance to look up in zoe)
|
|
@@ -24,7 +25,9 @@ export type ContractInvitationSpec = {
|
|
|
24
25
|
invitationArgs?: any[];
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
|
-
* the invitation is already in your Zoe "invitation" purse so we need to query
|
|
28
|
+
* the invitation is already in your Zoe "invitation" purse so we need to query
|
|
29
|
+
* it
|
|
30
|
+
*
|
|
28
31
|
* - use the find/query invitation by kvs thing
|
|
29
32
|
*/
|
|
30
33
|
export type PurseInvitationSpec = {
|
|
@@ -33,7 +36,8 @@ export type PurseInvitationSpec = {
|
|
|
33
36
|
description: string;
|
|
34
37
|
};
|
|
35
38
|
/**
|
|
36
|
-
* continuing invitation in which the offer result from a previous invitation
|
|
39
|
+
* continuing invitation in which the offer result from a previous invitation
|
|
40
|
+
* had an `invitationMakers` property
|
|
37
41
|
*/
|
|
38
42
|
export type ContinuingInvitationSpec = {
|
|
39
43
|
source: "continuing";
|
package/src/invitations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"AAwEO,2CANI,IAAI,CAAC,UAAU,CAAC,eAChB,IAAI,CAAC,OAAO,cAAc,EAAE,OAAO,CAAC,mBACpC,KAAK,CAAC,KAAK,CAAC,oBACZ,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,6BAC/B,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,YAAY,EAAE,gBAAgB,UAoFrD,cAAc,KAAK,IAAI,CAAC,UAAU,CAAC,CAgBtD;;;;6BA9JY,4BAA4B,GAClC,sBAAsB,GACtB,mBAAmB,GACnB,wBAAwB;;;;;;;;2CAKlB;IACZ,MAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;CACtD;;;;qCAQS;IACZ,MAAU,EAAE,UAAU,CAAC;IACvB,QAAY,EAAE,QAAQ,CAAC;IACvB,qBAAyB,EAAE,MAAM,CAAC;IAClC,cAAkB,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;;;;;;;kCAGS;IACZ,MAAU,EAAE,OAAO,CAAC;IACpB,QAAY,EAAE,QAAQ,CAAC;IACvB,WAAe,EAAE,MAAM,CAAC;CACrB;;;;;uCAOS;IACZ,MAAU,EAAE,YAAY,CAAC;IACzB,aAAiB,EAAE,OAAO,aAAa,EAAE,OAAO,CAAC;IACjD,mBAAuB,EAAE,MAAM,CAAC;IAChC,cAAkB,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;oCAMS,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC"}
|
package/src/invitations.js
CHANGED
|
@@ -10,44 +10,53 @@ const { Fail } = assert;
|
|
|
10
10
|
const MAX_PIPE_LENGTH = 2;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @typedef {AgoricContractInvitationSpec
|
|
14
|
-
*
|
|
13
|
+
* @typedef {AgoricContractInvitationSpec
|
|
14
|
+
* | ContractInvitationSpec
|
|
15
|
+
* | PurseInvitationSpec
|
|
16
|
+
* | ContinuingInvitationSpec} InvitationSpec
|
|
17
|
+
* Specify how to produce an invitation. See each type in the union for details.
|
|
15
18
|
*/
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* @typedef {{
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
+
* source: 'agoricContract';
|
|
23
|
+
* instancePath: string[];
|
|
24
|
+
* callPipe: [methodName: string, methodArgs?: any[]][];
|
|
22
25
|
* }} AgoricContractInvitationSpec
|
|
23
|
-
*
|
|
26
|
+
* source of invitation is a chain of calls starting with an agoricName
|
|
27
|
+
*
|
|
24
28
|
* - the start of the pipe is a lookup of instancePath within agoricNames
|
|
25
29
|
* - each entry in the callPipe executes a call on the preceding result
|
|
26
30
|
* - the end of the pipe is expected to return an Invitation
|
|
27
31
|
*
|
|
32
|
+
*
|
|
28
33
|
* @typedef {{
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
34
|
+
* source: 'contract';
|
|
35
|
+
* instance: Instance;
|
|
36
|
+
* publicInvitationMaker: string;
|
|
37
|
+
* invitationArgs?: any[];
|
|
33
38
|
* }} ContractInvitationSpec
|
|
34
|
-
*
|
|
39
|
+
* source is a contract (in which case this takes an Instance to look up in zoe)
|
|
35
40
|
*
|
|
36
41
|
* @typedef {{
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
42
|
+
* source: 'purse';
|
|
43
|
+
* instance: Instance;
|
|
44
|
+
* description: string;
|
|
40
45
|
* }} PurseInvitationSpec
|
|
41
|
-
*
|
|
46
|
+
* the invitation is already in your Zoe "invitation" purse so we need to query
|
|
47
|
+
* it
|
|
48
|
+
*
|
|
42
49
|
* - use the find/query invitation by kvs thing
|
|
43
50
|
*
|
|
51
|
+
*
|
|
44
52
|
* @typedef {{
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
53
|
+
* source: 'continuing';
|
|
54
|
+
* previousOffer: import('./offers.js').OfferId;
|
|
55
|
+
* invitationMakerName: string;
|
|
56
|
+
* invitationArgs?: any[];
|
|
49
57
|
* }} ContinuingInvitationSpec
|
|
50
|
-
*
|
|
58
|
+
* continuing invitation in which the offer result from a previous invitation
|
|
59
|
+
* had an `invitationMakers` property
|
|
51
60
|
*/
|
|
52
61
|
|
|
53
62
|
/**
|
|
@@ -58,8 +58,7 @@ export function makeImportContext(makePresence?: ((iface: string) => PassableCap
|
|
|
58
58
|
};
|
|
59
59
|
export function makeLoggingPresence(iface: string, log: (parts: unknown[]) => void): any;
|
|
60
60
|
/**
|
|
61
|
-
* When marshaling a purse, payment, etc. we partition the slots
|
|
62
|
-
* using prefixes.
|
|
61
|
+
* When marshaling a purse, payment, etc. we partition the slots using prefixes.
|
|
63
62
|
*/
|
|
64
63
|
export type WalletSlot<T extends Record<string, IdTable<any, any>>> = `${string & keyof T}:${Digits}`;
|
|
65
64
|
/**
|
|
@@ -67,14 +66,13 @@ export type WalletSlot<T extends Record<string, IdTable<any, any>>> = `${string
|
|
|
67
66
|
*/
|
|
68
67
|
export type KindSlot<K extends string> = `${K}:${Digits}`;
|
|
69
68
|
/**
|
|
70
|
-
* Since KindSlots always include a colon and BoardIds never do,
|
|
71
|
-
*
|
|
69
|
+
* Since KindSlots always include a colon and BoardIds never do, we an mix them
|
|
70
|
+
* without confusion.
|
|
72
71
|
*/
|
|
73
72
|
export type MixedSlot<T extends Record<string, IdTable<any, any>>> = string;
|
|
74
73
|
/**
|
|
75
|
-
* - 1 or more digits.
|
|
76
|
-
*
|
|
77
|
-
* actual usage.
|
|
74
|
+
* - 1 or more digits. NOTE: the typescript
|
|
75
|
+
* definition here is more restrictive than actual usage.
|
|
78
76
|
*/
|
|
79
77
|
export type Digits = `1` | `12` | `123`;
|
|
80
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marshal-contexts.d.ts","sourceRoot":"","sources":["marshal-contexts.js"],"names":[],"mappings":"AAuHO;;;;;;;
|
|
1
|
+
{"version":3,"file":"marshal-contexts.d.ts","sourceRoot":"","sources":["marshal-contexts.js"],"names":[],"mappings":"AAuHO;;;;;;;IAoFH;;;OAGG;sBAFQ,MAAM,SACN,KAAK;;IAMhB;;;OAGG;;IAIH;;;OAGG;;EAUN;AAcM,0DAFY,MAAM;IA8FrB;;;OAGG;;IAIH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;EAWN;AA4BM,2CAHI,MAAM,OACN,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,OAapC;;;;uBAjX8B,CAAC,8CAAnB,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE;;;;qBAI5B,CAAC,mBAAJ,GAAG,CAAC,IAAI,MAAM,EAAE;;;;;sBA2CL,CAAC;;;;;qBAGZ,GAAG,GAAG,IAAI,GAAG,KAAK;;;;oBASL,IAAI,cAAT,GAAG,wBAFX;IACZ,MAAU,EAAE,QAAQ,CACK,IAAI,AADJ,EACL,GAAG,AADO,CAAC,CAAC;IAChC,KAAS,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;CAC5B;4BAgJU,UAAU,CAAC,OAAO,iBAAiB,CAAC;4BA+HpC,UAAU,CAAC,OAAO,iBAAiB,CAAC;qCA9VH,eAAe;iCAAf,eAAe;yBACxC,gBAAgB"}
|
package/src/marshal-contexts.js
CHANGED
|
@@ -23,10 +23,9 @@ const isDefaultBoardId = specimen => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* When marshaling a purse, payment, etc. we partition the slots
|
|
27
|
-
* using prefixes.
|
|
26
|
+
* When marshaling a purse, payment, etc. we partition the slots using prefixes.
|
|
28
27
|
*
|
|
29
|
-
* @template {Record<string, IdTable
|
|
28
|
+
* @template {Record<string, IdTable<any, any>>} T
|
|
30
29
|
* @typedef {`${string & keyof T}:${Digits}`} WalletSlot
|
|
31
30
|
*/
|
|
32
31
|
/**
|
|
@@ -35,7 +34,7 @@ const isDefaultBoardId = specimen => {
|
|
|
35
34
|
*/
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
|
-
* @template {Record<string, IdTable
|
|
37
|
+
* @template {Record<string, IdTable<any, any>>} T
|
|
39
38
|
* @param {T} _tables
|
|
40
39
|
* @param {string & keyof T} kind
|
|
41
40
|
* @param {number} id
|
|
@@ -47,10 +46,10 @@ const makeWalletSlot = (_tables, kind, id) => {
|
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
|
-
* @template {Record<string, IdTable
|
|
49
|
+
* @template {Record<string, IdTable<any, any>>} T
|
|
51
50
|
* @param {T} record
|
|
52
51
|
* @param {(value: string, index: number, obj: string[]) => boolean} predicate
|
|
53
|
-
* @returns {string & keyof T | undefined}
|
|
52
|
+
* @returns {(string & keyof T) | undefined}
|
|
54
53
|
*/
|
|
55
54
|
const findKey = (record, predicate) => {
|
|
56
55
|
const key = Object.keys(record).find(predicate);
|
|
@@ -58,10 +57,10 @@ const findKey = (record, predicate) => {
|
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
/**
|
|
61
|
-
* @template {Record<string, IdTable
|
|
60
|
+
* @template {Record<string, IdTable<any, any>>} T
|
|
62
61
|
* @param {T} tables
|
|
63
62
|
* @param {string} slot
|
|
64
|
-
* @returns {{ kind: undefined | string & keyof T
|
|
63
|
+
* @returns {{ kind: undefined | (string & keyof T); id: number }}
|
|
65
64
|
*/
|
|
66
65
|
const parseWalletSlot = (tables, slot) => {
|
|
67
66
|
const kind = findKey(tables, k => slot.startsWith(`${k}:`));
|
|
@@ -70,25 +69,23 @@ const parseWalletSlot = (tables, slot) => {
|
|
|
70
69
|
};
|
|
71
70
|
|
|
72
71
|
/**
|
|
73
|
-
* Since KindSlots always include a colon and BoardIds never do,
|
|
74
|
-
*
|
|
72
|
+
* Since KindSlots always include a colon and BoardIds never do, we an mix them
|
|
73
|
+
* without confusion.
|
|
75
74
|
*
|
|
76
|
-
* @template {Record<string, IdTable
|
|
75
|
+
* @template {Record<string, IdTable<any, any>>} T
|
|
77
76
|
* @typedef {WalletSlot<T> | BoardId} MixedSlot
|
|
78
77
|
*/
|
|
79
78
|
/**
|
|
80
|
-
* @typedef {`1` | `12` | `123`} Digits - 1 or more digits.
|
|
81
|
-
*
|
|
82
|
-
* actual usage.
|
|
79
|
+
* @typedef {`1` | `12` | `123`} Digits - 1 or more digits. NOTE: the typescript
|
|
80
|
+
* definition here is more restrictive than actual usage.
|
|
83
81
|
*/
|
|
84
82
|
|
|
85
83
|
/**
|
|
86
84
|
* @template {Key} Slot
|
|
87
85
|
* @template {PassableCap} Val
|
|
88
|
-
*
|
|
89
86
|
* @typedef {{
|
|
90
|
-
* bySlot: MapStore<Slot, Val
|
|
91
|
-
* byVal: MapStore<Val, Slot
|
|
87
|
+
* bySlot: MapStore<Slot, Val>;
|
|
88
|
+
* byVal: MapStore<Val, Slot>;
|
|
92
89
|
* }} IdTable<Value>
|
|
93
90
|
*/
|
|
94
91
|
|
|
@@ -105,17 +102,20 @@ const initSlotVal = (table, slot, val) => {
|
|
|
105
102
|
};
|
|
106
103
|
|
|
107
104
|
/**
|
|
108
|
-
* Make context for exporting wallet data where brands etc. can be recognized by
|
|
109
|
-
* Export for use outside the smart wallet.
|
|
105
|
+
* Make context for exporting wallet data where brands etc. can be recognized by
|
|
106
|
+
* boardId. Export for use outside the smart wallet.
|
|
110
107
|
*
|
|
111
108
|
* When serializing wallet state for, there's a tension between
|
|
112
109
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
110
|
+
* - keeping purses etc. closely held
|
|
111
|
+
* - recognizing identity of brands also referenced in the state of contracts such
|
|
112
|
+
* as the AMM
|
|
113
|
+
*
|
|
114
|
+
* `makeMarshal()` is parameterized by the type of slots. Here we use a disjoint
|
|
115
|
+
* union of
|
|
115
116
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* - kind:seq ids for closely held objects; for example purse:123
|
|
117
|
+
* - board ids for widely shared objects
|
|
118
|
+
* - kind:seq ids for closely held objects; for example purse:123
|
|
119
119
|
*/
|
|
120
120
|
export const makeExportContext = () => {
|
|
121
121
|
const walletObjects = {
|
|
@@ -143,14 +143,13 @@ export const makeExportContext = () => {
|
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
|
-
* Look up the slot in mappings from published data
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* @throws if not found (a slotToVal function typically
|
|
150
|
-
* conjures a new identity)
|
|
146
|
+
* Look up the slot in mappings from published data else try walletObjects
|
|
147
|
+
* that we have seen.
|
|
151
148
|
*
|
|
152
149
|
* @param {MixedSlot<typeof walletObjects>} slot
|
|
153
150
|
* @param {string} _iface
|
|
151
|
+
* @throws if not found (a slotToVal function typically conjures a new
|
|
152
|
+
* identity)
|
|
154
153
|
*/
|
|
155
154
|
const slotToVal = (slot, _iface) => {
|
|
156
155
|
if (isDefaultBoardId(slot) && boardObjects.bySlot.has(slot)) {
|
|
@@ -239,8 +238,8 @@ const defaultMakePresence = iface => {
|
|
|
239
238
|
};
|
|
240
239
|
|
|
241
240
|
/**
|
|
242
|
-
* Make context for marshalling wallet or board data.
|
|
243
|
-
*
|
|
241
|
+
* Make context for marshalling wallet or board data. To be imported into the
|
|
242
|
+
* client, which never exports objects.
|
|
244
243
|
*
|
|
245
244
|
* @param {(iface: string) => PassableCap} [makePresence]
|
|
246
245
|
*/
|
|
@@ -363,8 +362,12 @@ export const makeImportContext = (makePresence = defaultMakePresence) => {
|
|
|
363
362
|
/**
|
|
364
363
|
* @param {string} iface
|
|
365
364
|
* @param {{
|
|
366
|
-
* applyMethod: (
|
|
367
|
-
*
|
|
365
|
+
* applyMethod: (
|
|
366
|
+
* target: unknown,
|
|
367
|
+
* method: string | symbol,
|
|
368
|
+
* args: unknown[],
|
|
369
|
+
* ) => void;
|
|
370
|
+
* applyFunction: (target: unknown, args: unknown[]) => void;
|
|
368
371
|
* }} handler
|
|
369
372
|
*/
|
|
370
373
|
const makePresence = (iface, handler) => {
|
package/src/offerWatcher.d.ts
CHANGED
|
@@ -7,17 +7,18 @@ export function prepareOfferWatcher(baggage: import("@agoric/vat-data").Baggage)
|
|
|
7
7
|
updateStatus(offerStatusUpdates: Record<string, unknown>): void;
|
|
8
8
|
/**
|
|
9
9
|
* @param {string} offerId
|
|
10
|
-
* @param {Amount<
|
|
10
|
+
* @param {Amount<'set'>} invitationAmount
|
|
11
11
|
* @param {import('./types.js').InvitationMakers} invitationMakers
|
|
12
|
-
* @param {import(
|
|
12
|
+
* @param {import('./types.js').PublicSubscribers} publicSubscribers
|
|
13
13
|
*/
|
|
14
14
|
onNewContinuingOffer(offerId: string, invitationAmount: Amount<"set">, invitationMakers: import("./types.js").InvitationMakers, publicSubscribers: import("./types.js").PublicSubscribers): void;
|
|
15
15
|
/** @param {unknown} result */
|
|
16
16
|
publishResult(result: unknown): void;
|
|
17
17
|
/**
|
|
18
18
|
* Called when the offer result promise rejects. The other two watchers
|
|
19
|
-
* are waiting for particular values out of Zoe but they settle at the
|
|
20
|
-
* and don't need their own error handling.
|
|
19
|
+
* are waiting for particular values out of Zoe but they settle at the
|
|
20
|
+
* same time and don't need their own error handling.
|
|
21
|
+
*
|
|
21
22
|
* @param {Error} err
|
|
22
23
|
*/
|
|
23
24
|
handleError(err: Error): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AAgEO,6CAHI,eAAe,QACf,QAAQ,oDAQlB;AAkCM,6CAFI,OAAO,kBAAkB,EAAE,OAAO;;
|
|
1
|
+
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AAgEO,6CAHI,eAAe,QACf,QAAQ,oDAQlB;AAkCM,6CAFI,OAAO,kBAAkB,EAAE,OAAO;;QAyBrC;;WAEG;yCADQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QAQlC;;;;;WAKG;sCAJQ,MAAM,oBACN,MAAM,CAAC,KAAK,CAAC,oBACb,OAAO,YAAY,EAAE,gBAAgB,qBACrC,OAAO,YAAY,EAAE,iBAAiB;QAkBjD,8BAA8B;8BAAlB,OAAO;QAqCnB;;;;;;WAMG;yBADQ,KAAK;;IAclB,gDAAgD;oBAArC,eAAe,CAAC,gBAAgB,CAAC;IA+B5C,+CAA+C;mBAApC,eAAe,CAAC,eAAe,CAAC;IAwB3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;GA2BlD;;;;gCArR2B,CAAC;;;;8BAIhB;IACZ,aAAiB,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAChD,eAAmB,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACjD,cAAkB,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CAC5D;+BAgRU,UAAU,CAAC,OAAO,mBAAmB,CAAC;2BACtC,UAAU,CAAC,gBAAgB,CAAC;+BA9Rb,aAAa"}
|
package/src/offerWatcher.js
CHANGED
|
@@ -22,9 +22,9 @@ import { UNPUBLISHED_RESULT } from './offers.js';
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @typedef {{
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* resultWatcher: OfferPromiseWatcher<unknown>;
|
|
26
|
+
* numWantsWatcher: OfferPromiseWatcher<number>;
|
|
27
|
+
* paymentWatcher: OfferPromiseWatcher<PaymentPKeywordRecord>;
|
|
28
28
|
* }} OutcomeWatchers
|
|
29
29
|
*/
|
|
30
30
|
|
|
@@ -108,9 +108,8 @@ export const prepareOfferWatcher = baggage => {
|
|
|
108
108
|
'OfferWatcher',
|
|
109
109
|
offerWatcherGuard,
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @param {
|
|
113
|
-
* @param {*} deposit
|
|
111
|
+
* @param {any} walletHelper
|
|
112
|
+
* @param {any} deposit
|
|
114
113
|
* @param {OfferSpec} offerSpec
|
|
115
114
|
* @param {string} address
|
|
116
115
|
* @param {Amount<'set'>} invitationAmount
|
|
@@ -137,9 +136,9 @@ export const prepareOfferWatcher = baggage => {
|
|
|
137
136
|
},
|
|
138
137
|
/**
|
|
139
138
|
* @param {string} offerId
|
|
140
|
-
* @param {Amount<
|
|
139
|
+
* @param {Amount<'set'>} invitationAmount
|
|
141
140
|
* @param {import('./types.js').InvitationMakers} invitationMakers
|
|
142
|
-
* @param {import(
|
|
141
|
+
* @param {import('./types.js').PublicSubscribers} publicSubscribers
|
|
143
142
|
*/
|
|
144
143
|
onNewContinuingOffer(
|
|
145
144
|
offerId,
|
|
@@ -196,8 +195,9 @@ export const prepareOfferWatcher = baggage => {
|
|
|
196
195
|
},
|
|
197
196
|
/**
|
|
198
197
|
* Called when the offer result promise rejects. The other two watchers
|
|
199
|
-
* are waiting for particular values out of Zoe but they settle at the
|
|
200
|
-
* and don't need their own error handling.
|
|
198
|
+
* are waiting for particular values out of Zoe but they settle at the
|
|
199
|
+
* same time and don't need their own error handling.
|
|
200
|
+
*
|
|
201
201
|
* @param {Error} err
|
|
202
202
|
*/
|
|
203
203
|
handleError(err) {
|
|
@@ -226,9 +226,11 @@ export const prepareOfferWatcher = baggage => {
|
|
|
226
226
|
facets.helper.updateStatus({ payouts: amounts });
|
|
227
227
|
},
|
|
228
228
|
/**
|
|
229
|
-
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
229
|
+
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
230
|
+
* it.
|
|
230
231
|
*
|
|
231
|
-
* @param {Error
|
|
232
|
+
* @param {Error
|
|
233
|
+
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
232
234
|
* @param {UserSeat} seat
|
|
233
235
|
*/
|
|
234
236
|
onRejected(reason, seat) {
|
|
@@ -248,9 +250,11 @@ export const prepareOfferWatcher = baggage => {
|
|
|
248
250
|
facets.helper.publishResult(result);
|
|
249
251
|
},
|
|
250
252
|
/**
|
|
251
|
-
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
253
|
+
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
254
|
+
* it.
|
|
252
255
|
*
|
|
253
|
-
* @param {Error
|
|
256
|
+
* @param {Error
|
|
257
|
+
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
254
258
|
* @param {UserSeat} seat
|
|
255
259
|
*/
|
|
256
260
|
onRejected(reason, seat) {
|
|
@@ -277,7 +281,8 @@ export const prepareOfferWatcher = baggage => {
|
|
|
277
281
|
* and getPayouts() settle the same (they await the same promise and
|
|
278
282
|
* then synchronously return a local value).
|
|
279
283
|
*
|
|
280
|
-
* @param {Error
|
|
284
|
+
* @param {Error
|
|
285
|
+
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
281
286
|
* @param {UserSeat} seat
|
|
282
287
|
*/
|
|
283
288
|
onRejected(reason, seat) {
|
package/src/offers.d.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {{
|
|
6
|
-
* id: OfferId
|
|
7
|
-
* invitationSpec: import('./invitations.js').InvitationSpec
|
|
8
|
-
* proposal: Proposal
|
|
9
|
-
* offerArgs?: any
|
|
6
|
+
* id: OfferId;
|
|
7
|
+
* invitationSpec: import('./invitations.js').InvitationSpec;
|
|
8
|
+
* proposal: Proposal;
|
|
9
|
+
* offerArgs?: any;
|
|
10
10
|
* }} OfferSpec
|
|
11
11
|
*/
|
|
12
12
|
/** Value for "result" field when the result can't be published */
|
package/src/offers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AAEH,kEAAkE;AAClE,+CAAgD;sBAbnC,MAAM,GAAG,MAAM;wBAIf;IACZ,EAAM,EAAE,OAAO,CAAC;IAChB,cAAkB,EAAE,OAAO,kBAAkB,EAAE,cAAc,CAAC;IAC9D,QAAY,EAAE,QAAQ,CAAC;IACvB,SAAa,CAAC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AAEH,kEAAkE;AAClE,+CAAgD;sBAbnC,MAAM,GAAG,MAAM;wBAIf;IACZ,EAAM,EAAE,OAAO,CAAC;IAChB,cAAkB,EAAE,OAAO,kBAAkB,EAAE,cAAc,CAAC;IAC9D,QAAY,EAAE,QAAQ,CAAC;IACvB,SAAa,CAAC,EAAE,GAAG,CAAC;CACjB;0BAOS,SAAS,GAAG;IACxB,KAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,MAAU,CAAC,EAAE,OAAO,GAAG,OAAO,kBAAkB,CAAC;IACjD,OAAW,CAAC,EAAE,mBAAmB,CAAC;CAC/B"}
|
package/src/offers.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {{
|
|
7
|
-
* id: OfferId
|
|
8
|
-
* invitationSpec: import('./invitations.js').InvitationSpec
|
|
9
|
-
* proposal: Proposal
|
|
10
|
-
* offerArgs?: any
|
|
7
|
+
* id: OfferId;
|
|
8
|
+
* invitationSpec: import('./invitations.js').InvitationSpec;
|
|
9
|
+
* proposal: Proposal;
|
|
10
|
+
* offerArgs?: any;
|
|
11
11
|
* }} OfferSpec
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -16,9 +16,9 @@ export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @typedef {OfferSpec & {
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* error?: string;
|
|
20
|
+
* numWantsSatisfied?: number;
|
|
21
|
+
* result?: unknown | typeof UNPUBLISHED_RESULT;
|
|
22
|
+
* payouts?: AmountKeywordRecord;
|
|
23
23
|
* }} OfferStatus
|
|
24
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-walletFactory-proposal.d.ts","sourceRoot":"","sources":["upgrade-walletFactory-proposal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrade-walletFactory-proposal.d.ts","sourceRoot":"","sources":["upgrade-walletFactory-proposal.js"],"names":[],"mappings":"AAoBO,yOAJI,eAAe;IAEmD,OAAO,EAAzE;QAAE,gBAAgB,EAAE,YAAY,GAAG;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;kBAkDnE;AAMM,mGAFI,eAAe,iBAwBzB;AAyBM;;;;;;;EAKN"}
|
|
@@ -14,8 +14,7 @@ const BOARD_AUX = 'boardAux';
|
|
|
14
14
|
const marshalData = makeMarshal(_val => Fail`data only`);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @param {
|
|
18
|
-
*
|
|
17
|
+
* @param {BootstrapPowers} powers
|
|
19
18
|
* @param {object} config
|
|
20
19
|
* @param {{ walletFactoryRef: VatSourceRef & { bundleID: string } }} config.options
|
|
21
20
|
*/
|
|
@@ -71,7 +70,7 @@ export const upgradeWalletFactory = async (
|
|
|
71
70
|
harden(upgradeWalletFactory);
|
|
72
71
|
|
|
73
72
|
/**
|
|
74
|
-
* @param {
|
|
73
|
+
* @param {BootstrapPowers} powers
|
|
75
74
|
*/
|
|
76
75
|
export const publishAgoricBrandsDisplayInfo = async ({
|
|
77
76
|
consume: { agoricNames, board, chainStorage },
|
|
@@ -98,7 +97,7 @@ export const publishAgoricBrandsDisplayInfo = async ({
|
|
|
98
97
|
};
|
|
99
98
|
harden(publishAgoricBrandsDisplayInfo);
|
|
100
99
|
|
|
101
|
-
/** @type {
|
|
100
|
+
/** @type {import('@agoric/vats/src/core/lib-boot').BootstrapManifest} */
|
|
102
101
|
const manifest = {
|
|
103
102
|
[upgradeWalletFactory.name]: {
|
|
104
103
|
// include rationale for closely-held, high authority capabilities
|