@agoric/client-utils 0.1.1-dev-160f38d.0 → 0.1.1-dev-a82d636.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 +7 -9
- package/src/main.js +3 -0
- package/src/types.d.ts +37 -0
- package/src/types.js +2 -0
- package/src/vstorage-kit.js +16 -0
- package/src/wallet-utils.js +12 -16
- package/src/chain.d.ts +0 -11
- package/src/chain.d.ts.map +0 -1
- package/src/main.d.ts +0 -5
- package/src/main.d.ts.map +0 -1
- package/src/rpc.d.ts +0 -16
- package/src/rpc.d.ts.map +0 -1
- package/src/sync-tools.d.ts +0 -43
- package/src/sync-tools.d.ts.map +0 -1
- package/src/vstorage-kit.d.ts +0 -108
- package/src/vstorage-kit.d.ts.map +0 -1
- package/src/wallet-utils.d.ts +0 -49
- package/src/wallet-utils.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/client-utils",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-a82d636.0+a82d636",
|
|
4
4
|
"description": "Utilities for building Agoric clients",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "exit 0",
|
|
16
|
-
"prepack": "tsc --build tsconfig.build.json",
|
|
17
|
-
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
|
|
18
16
|
"test": "ava",
|
|
19
17
|
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
|
|
20
18
|
"test:xs": "exit 0",
|
|
@@ -29,11 +27,11 @@
|
|
|
29
27
|
"ts-blank-space": "^0.4.1"
|
|
30
28
|
},
|
|
31
29
|
"dependencies": {
|
|
32
|
-
"@agoric/casting": "0.4.3-dev-
|
|
33
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
34
|
-
"@agoric/internal": "0.3.3-dev-
|
|
35
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
36
|
-
"@agoric/vats": "0.15.2-dev-
|
|
30
|
+
"@agoric/casting": "0.4.3-dev-a82d636.0+a82d636",
|
|
31
|
+
"@agoric/ertp": "0.16.3-dev-a82d636.0+a82d636",
|
|
32
|
+
"@agoric/internal": "0.3.3-dev-a82d636.0+a82d636",
|
|
33
|
+
"@agoric/smart-wallet": "0.5.4-dev-a82d636.0+a82d636",
|
|
34
|
+
"@agoric/vats": "0.15.2-dev-a82d636.0+a82d636",
|
|
37
35
|
"@cosmjs/stargate": "^0.32.3",
|
|
38
36
|
"@cosmjs/tendermint-rpc": "^0.32.3",
|
|
39
37
|
"@endo/common": "^1.2.7",
|
|
@@ -60,5 +58,5 @@
|
|
|
60
58
|
],
|
|
61
59
|
"timeout": "20m"
|
|
62
60
|
},
|
|
63
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "a82d63668cdb66eee9445be0755fc998503d6044"
|
|
64
62
|
}
|
package/src/main.js
CHANGED
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @file types for the client-utils package
|
|
2
|
+
// NB: this doesn't follow best practices for TS in JS because this package will likely soon be written in TS
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
OutcomeRecord,
|
|
6
|
+
QuestionDetails,
|
|
7
|
+
} from '@agoric/governance/src/types.js';
|
|
8
|
+
import type { MetricsNotification as VaultManagerMetrics } from '@agoric/inter-protocol/src/vaultFactory/vaultManager.js';
|
|
9
|
+
import type {
|
|
10
|
+
CurrentWalletRecord,
|
|
11
|
+
UpdateRecord,
|
|
12
|
+
} from '@agoric/smart-wallet/src/smartWallet.js';
|
|
13
|
+
|
|
14
|
+
// For static string key types. String template matching has to be in the ternary below.
|
|
15
|
+
type PublishedTypeMap = {
|
|
16
|
+
'auction.governance': { current: AuctionParamRecord };
|
|
17
|
+
'auction.schedule': ScheduleNotification;
|
|
18
|
+
'vaultFactory.metrics': { rewardPoolAllocation: RewardPoolAllocationRecord };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Utility type to the type that would result from unmarshalling the latest
|
|
23
|
+
* value at a vstorage `published` path.
|
|
24
|
+
*/
|
|
25
|
+
export type TypedPublished<T extends string> = T extends keyof PublishedTypeMap
|
|
26
|
+
? PublishedTypeMap[T]
|
|
27
|
+
: T extends `wallet.${string}.current`
|
|
28
|
+
? CurrentWalletRecord
|
|
29
|
+
: T extends `wallet.${string}`
|
|
30
|
+
? UpdateRecord
|
|
31
|
+
: T extends `committees.${string}.latestQuestion`
|
|
32
|
+
? QuestionDetails
|
|
33
|
+
: T extends `committees.${string}.latestOutcome`
|
|
34
|
+
? OutcomeRecord
|
|
35
|
+
: T extends `vaultFactory.managers.manager${number}.metrics`
|
|
36
|
+
? VaultManagerMetrics
|
|
37
|
+
: unknown;
|
package/src/types.js
ADDED
package/src/vstorage-kit.js
CHANGED
|
@@ -8,6 +8,7 @@ export { boardSlottingMarshaller };
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {MinimalNetworkConfig} from './rpc.js';
|
|
11
|
+
* @import {TypedPublished} from './types.js';
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -233,11 +234,26 @@ export const makeVstorageKit = async ({ fetch }, config) => {
|
|
|
233
234
|
const readLatestHead = path =>
|
|
234
235
|
vstorage.readLatest(path).then(unserializeHead);
|
|
235
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Read latest at published path and unmarshal it.
|
|
239
|
+
*
|
|
240
|
+
* Note this does not perform a runtime check to verify the shape. The
|
|
241
|
+
* static types come from the spec of what is supposed to be written to
|
|
242
|
+
* vstorage, which is validated in testing of the chain code that is run
|
|
243
|
+
* in consensus.
|
|
244
|
+
*
|
|
245
|
+
* @type {<T extends string>(subpath: T) => Promise<TypedPublished<T>>}
|
|
246
|
+
*/
|
|
247
|
+
const readPublished = subpath =>
|
|
248
|
+
// @ts-expect-error cast
|
|
249
|
+
readLatestHead(`published.${subpath}`);
|
|
250
|
+
|
|
236
251
|
return {
|
|
237
252
|
agoricNames,
|
|
238
253
|
fromBoard,
|
|
239
254
|
marshaller,
|
|
240
255
|
readLatestHead,
|
|
256
|
+
readPublished,
|
|
241
257
|
unserializeHead,
|
|
242
258
|
vstorage,
|
|
243
259
|
};
|
package/src/wallet-utils.js
CHANGED
|
@@ -9,7 +9,10 @@ import { boardSlottingMarshaller, makeVstorageKit } from './vstorage-kit.js';
|
|
|
9
9
|
* @import {MinimalNetworkConfig} from './rpc.js';
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
// XXX this is really a SmartWalletKit
|
|
12
13
|
/**
|
|
14
|
+
* Augment VstorageKit with addtional convenience methods for working with
|
|
15
|
+
* Agoric smart wallets.
|
|
13
16
|
*
|
|
14
17
|
* @param {object} root0
|
|
15
18
|
* @param {typeof globalThis.fetch} root0.fetch
|
|
@@ -17,9 +20,9 @@ import { boardSlottingMarshaller, makeVstorageKit } from './vstorage-kit.js';
|
|
|
17
20
|
* @param {MinimalNetworkConfig} networkConfig
|
|
18
21
|
*/
|
|
19
22
|
export const makeWalletUtils = async ({ fetch, delay }, networkConfig) => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const m = boardSlottingMarshaller(fromBoard.convertSlotToVal);
|
|
23
|
+
const vsk = await makeVstorageKit({ fetch }, networkConfig);
|
|
24
|
+
|
|
25
|
+
const m = boardSlottingMarshaller(vsk.fromBoard.convertSlotToVal);
|
|
23
26
|
|
|
24
27
|
const client = await makeStargateClient(networkConfig, { fetch });
|
|
25
28
|
|
|
@@ -28,14 +31,14 @@ export const makeWalletUtils = async ({ fetch, delay }, networkConfig) => {
|
|
|
28
31
|
* @param {number|string} [minHeight]
|
|
29
32
|
*/
|
|
30
33
|
const storedWalletState = async (from, minHeight = undefined) => {
|
|
31
|
-
const history = await vstorage.readFully(
|
|
34
|
+
const history = await vsk.vstorage.readFully(
|
|
32
35
|
`published.wallet.${from}`,
|
|
33
36
|
minHeight,
|
|
34
37
|
);
|
|
35
38
|
|
|
36
39
|
/** @type {{ Invitation: Brand<'set'> }} */
|
|
37
40
|
// @ts-expect-error XXX how to narrow AssetKind to set?
|
|
38
|
-
const { Invitation } = agoricNames.brand;
|
|
41
|
+
const { Invitation } = vsk.agoricNames.brand;
|
|
39
42
|
const coalescer = makeWalletStateCoalescer(Invitation);
|
|
40
43
|
// update with oldest first
|
|
41
44
|
for (const txt of history.reverse()) {
|
|
@@ -86,9 +89,7 @@ export const makeWalletUtils = async ({ fetch, delay }, networkConfig) => {
|
|
|
86
89
|
* @returns {Promise<UpdateRecord>}
|
|
87
90
|
*/
|
|
88
91
|
const getLastUpdate = addr => {
|
|
89
|
-
return
|
|
90
|
-
readLatestHead(`published.wallet.${addr}`)
|
|
91
|
-
);
|
|
92
|
+
return vsk.readPublished(`wallet.${addr}`);
|
|
92
93
|
};
|
|
93
94
|
|
|
94
95
|
/**
|
|
@@ -96,20 +97,15 @@ export const makeWalletUtils = async ({ fetch, delay }, networkConfig) => {
|
|
|
96
97
|
* @returns {Promise<CurrentWalletRecord>}
|
|
97
98
|
*/
|
|
98
99
|
const getCurrentWalletRecord = addr => {
|
|
99
|
-
return
|
|
100
|
-
readLatestHead(`published.wallet.${addr}.current`)
|
|
101
|
-
);
|
|
100
|
+
return vsk.readPublished(`wallet.${addr}.current`);
|
|
102
101
|
};
|
|
103
102
|
|
|
104
103
|
return {
|
|
104
|
+
// pass along all of VstorageKit
|
|
105
|
+
...vsk,
|
|
105
106
|
networkConfig,
|
|
106
|
-
agoricNames,
|
|
107
|
-
fromBoard,
|
|
108
|
-
marshaller,
|
|
109
|
-
vstorage,
|
|
110
107
|
getLastUpdate,
|
|
111
108
|
getCurrentWalletRecord,
|
|
112
|
-
readLatestHead,
|
|
113
109
|
storedWalletState,
|
|
114
110
|
pollOffer,
|
|
115
111
|
};
|
package/src/chain.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function pollBlocks(opts: {
|
|
2
|
-
client: StargateClient;
|
|
3
|
-
delay: (ms: number) => Promise<void>;
|
|
4
|
-
period?: number;
|
|
5
|
-
retryMessage?: string;
|
|
6
|
-
}): <T>(l: (b: {
|
|
7
|
-
time: string;
|
|
8
|
-
height: number;
|
|
9
|
-
}) => Promise<T>) => Promise<T>;
|
|
10
|
-
import type { StargateClient } from '@cosmjs/stargate';
|
|
11
|
-
//# sourceMappingURL=chain.d.ts.map
|
package/src/chain.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["chain.js"],"names":[],"mappings":"AAaO,iCARI;IACN,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CA2BrF;oCArCgC,kBAAkB"}
|
package/src/main.d.ts
DELETED
package/src/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.js"],"names":[],"mappings":""}
|
package/src/rpc.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function pickEndpoint({ rpcAddrs }: {
|
|
2
|
-
rpcAddrs: any;
|
|
3
|
-
}): any;
|
|
4
|
-
export function makeTendermint34Client(endpoint: string, { fetch }: {
|
|
5
|
-
fetch: typeof window.fetch;
|
|
6
|
-
}): Promise<Tendermint34Client>;
|
|
7
|
-
export function makeStargateClient(config: MinimalNetworkConfig, { fetch }: {
|
|
8
|
-
fetch: typeof window.fetch;
|
|
9
|
-
}): Promise<StargateClient>;
|
|
10
|
-
export type MinimalNetworkConfig = {
|
|
11
|
-
rpcAddrs: string[];
|
|
12
|
-
chainName: string;
|
|
13
|
-
};
|
|
14
|
-
import { Tendermint34Client } from '@cosmjs/tendermint-rpc';
|
|
15
|
-
import { StargateClient } from '@cosmjs/stargate';
|
|
16
|
-
//# sourceMappingURL=rpc.d.ts.map
|
package/src/rpc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["rpc.js"],"names":[],"mappings":"AASO;;QAAkD;AAOlD,iDAJI,MAAM,aACN;IAAE,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,CAAA;CAAE,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAKvC;AAOM,2CAJI,oBAAoB,aACpB;IAAE,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,CAAA;CAAE,GAC5B,OAAO,CAAC,cAAc,CAAC,CAMnC;mCAzBY;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;mCAHnB,wBAAwB;+BAD5B,kBAAkB"}
|
package/src/sync-tools.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export function sleep(ms: number, { log, setTimeout }: {
|
|
2
|
-
log: (message: string) => void;
|
|
3
|
-
setTimeout: typeof global.setTimeout;
|
|
4
|
-
}): Promise<any>;
|
|
5
|
-
export function retryUntilCondition(operation: () => Promise<any>, condition: (result: any) => boolean, message: string, { maxRetries, retryIntervalMs, log, setTimeout }: RetryOptions & {
|
|
6
|
-
log?: typeof console.log;
|
|
7
|
-
setTimeout: typeof global.setTimeout;
|
|
8
|
-
}): Promise<any>;
|
|
9
|
-
export function waitUntilContractDeployed(contractName: string, ambientAuthority: {
|
|
10
|
-
log: (message: string) => void;
|
|
11
|
-
follow: () => object;
|
|
12
|
-
setTimeout: typeof global.setTimeout;
|
|
13
|
-
}, options: WaitUntilOptions): Promise<any>;
|
|
14
|
-
export function waitUntilAccountFunded(destAcct: string, io: {
|
|
15
|
-
log: (message: string) => void;
|
|
16
|
-
query: () => Promise<object>;
|
|
17
|
-
setTimeout: typeof global.setTimeout;
|
|
18
|
-
}, threshold: {
|
|
19
|
-
denom: string;
|
|
20
|
-
value: number;
|
|
21
|
-
}, options: WaitUntilOptions): Promise<any>;
|
|
22
|
-
export function waitUntilOfferResult(addr: string, offerId: string, waitForPayouts: boolean, io: {
|
|
23
|
-
log: typeof console.log;
|
|
24
|
-
follow: () => object;
|
|
25
|
-
setTimeout: typeof global.setTimeout;
|
|
26
|
-
}, options: WaitUntilOptions): Promise<any>;
|
|
27
|
-
export function waitUntilInvitationReceived(addr: string, io: {
|
|
28
|
-
follow: () => object;
|
|
29
|
-
log: typeof console.log;
|
|
30
|
-
setTimeout: typeof global.setTimeout;
|
|
31
|
-
}, options: WaitUntilOptions): Promise<any>;
|
|
32
|
-
export type RetryOptions = {
|
|
33
|
-
maxRetries?: number | undefined;
|
|
34
|
-
retryIntervalMs?: number | undefined;
|
|
35
|
-
};
|
|
36
|
-
export type WaitUntilOptions = RetryOptions & {
|
|
37
|
-
errorMessage: string;
|
|
38
|
-
};
|
|
39
|
-
export type CosmosBalanceThreshold = {
|
|
40
|
-
denom: string;
|
|
41
|
-
value: number;
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=sync-tools.d.ts.map
|
package/src/sync-tools.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-tools.d.ts","sourceRoot":"","sources":["sync-tools.js"],"names":[],"mappings":"AAgCO,0BAHI,MAAM,uBACN;IAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAA;CAAC,gBAM7E;AAUG,+CALI,kBAAa,aACb,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,WACxB,MAAM,oDACN,YAAY,GAAG;IAAC,GAAG,CAAC,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAA;CAAC,gBAoCzF;AAiCM,wDAJI,MAAM,oBACN;IAAE,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAA;CAAE,WAC9F,gBAAgB,gBAkB1B;AA0BM,iDALI,MAAM,MACN;IAAE,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAAC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAA;CAAC,aACrG;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,WAC9B,gBAAgB,gBAc1B;AAqCM,2CANI,MAAM,WACN,MAAM,kBACN,OAAO,MACP;IAAE,GAAG,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IAAC,MAAM,EAAE,MAAM,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAA;CAAE,WACvF,gBAAgB,gBAoB1B;AAwBM,kDAJI,MAAM,MACN;IAAE,MAAM,EAAE,MAAM,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAA;CAAC,WACtF,gBAAgB,gBAc1B;;;;;+BA/OY,YAAY,GAAG;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC;;WAGpC,MAAM;WACN,MAAM"}
|
package/src/vstorage-kit.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
export { boardSlottingMarshaller };
|
|
2
|
-
export function makeVStorage(powers: {
|
|
3
|
-
fetch: typeof window.fetch;
|
|
4
|
-
}, config: MinimalNetworkConfig): {
|
|
5
|
-
url: (path?: string, { kind, height }?: {
|
|
6
|
-
kind?: string | undefined;
|
|
7
|
-
height?: number | undefined;
|
|
8
|
-
}) => string;
|
|
9
|
-
decode({ result: { response } }: {
|
|
10
|
-
result: {
|
|
11
|
-
response: any;
|
|
12
|
-
};
|
|
13
|
-
}): string;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @param {string} path
|
|
17
|
-
* @returns {Promise<string>} latest vstorage value at path
|
|
18
|
-
*/
|
|
19
|
-
readLatest(path?: string): Promise<string>;
|
|
20
|
-
keys(path?: string): Promise<any>;
|
|
21
|
-
/**
|
|
22
|
-
* @param {string} path
|
|
23
|
-
* @param {number} [height] default is highest
|
|
24
|
-
* @returns {Promise<{blockHeight: number, values: string[]}>}
|
|
25
|
-
*/
|
|
26
|
-
readAt(path: string, height?: number | undefined): Promise<{
|
|
27
|
-
blockHeight: number;
|
|
28
|
-
values: string[];
|
|
29
|
-
}>;
|
|
30
|
-
/**
|
|
31
|
-
* Read values going back as far as available
|
|
32
|
-
*
|
|
33
|
-
* @param {string} path
|
|
34
|
-
* @param {number | string} [minHeight]
|
|
35
|
-
* @returns {Promise<string[]>}
|
|
36
|
-
*/
|
|
37
|
-
readFully(path: string, minHeight?: string | number | undefined): Promise<string[]>;
|
|
38
|
-
};
|
|
39
|
-
export function makeFromBoard(): {
|
|
40
|
-
convertSlotToVal: (boardId: any, iface: any) => any;
|
|
41
|
-
};
|
|
42
|
-
export namespace storageHelper {
|
|
43
|
-
function parseCapData(txt: string): {
|
|
44
|
-
blockHeight: any;
|
|
45
|
-
capDatas: {
|
|
46
|
-
body: string;
|
|
47
|
-
slots: string[];
|
|
48
|
-
}[];
|
|
49
|
-
};
|
|
50
|
-
function unserializeTxt(txt: string, ctx: IdMap): any[];
|
|
51
|
-
function parseMany(capDataStrings: string[]): {
|
|
52
|
-
body: string;
|
|
53
|
-
slots: string[];
|
|
54
|
-
}[];
|
|
55
|
-
}
|
|
56
|
-
export function makeAgoricNames(ctx: IdMap, vstorage: VStorage): Promise<import("@agoric/vats/tools/board-utils.js").AgoricNamesRemotes>;
|
|
57
|
-
export function makeVstorageKit({ fetch }: {
|
|
58
|
-
fetch: typeof window.fetch;
|
|
59
|
-
}, config: MinimalNetworkConfig): Promise<{
|
|
60
|
-
agoricNames: import("@agoric/vats/tools/board-utils.js").AgoricNamesRemotes;
|
|
61
|
-
fromBoard: {
|
|
62
|
-
convertSlotToVal: (boardId: any, iface: any) => any;
|
|
63
|
-
};
|
|
64
|
-
marshaller: Omit<import("@endo/marshal").Marshal<string | null>, "serialize" | "unserialize">;
|
|
65
|
-
readLatestHead: (path: string) => Promise<unknown>;
|
|
66
|
-
unserializeHead: (txt: string) => unknown;
|
|
67
|
-
vstorage: {
|
|
68
|
-
url: (path?: string, { kind, height }?: {
|
|
69
|
-
kind?: string | undefined;
|
|
70
|
-
height?: number | undefined;
|
|
71
|
-
}) => string;
|
|
72
|
-
decode({ result: { response } }: {
|
|
73
|
-
result: {
|
|
74
|
-
response: any;
|
|
75
|
-
};
|
|
76
|
-
}): string;
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @param {string} path
|
|
80
|
-
* @returns {Promise<string>} latest vstorage value at path
|
|
81
|
-
*/
|
|
82
|
-
readLatest(path?: string): Promise<string>;
|
|
83
|
-
keys(path?: string): Promise<any>;
|
|
84
|
-
/**
|
|
85
|
-
* @param {string} path
|
|
86
|
-
* @param {number} [height] default is highest
|
|
87
|
-
* @returns {Promise<{blockHeight: number, values: string[]}>}
|
|
88
|
-
*/
|
|
89
|
-
readAt(path: string, height?: number | undefined): Promise<{
|
|
90
|
-
blockHeight: number;
|
|
91
|
-
values: string[];
|
|
92
|
-
}>;
|
|
93
|
-
/**
|
|
94
|
-
* Read values going back as far as available
|
|
95
|
-
*
|
|
96
|
-
* @param {string} path
|
|
97
|
-
* @param {number | string} [minHeight]
|
|
98
|
-
* @returns {Promise<string[]>}
|
|
99
|
-
*/
|
|
100
|
-
readFully(path: string, minHeight?: string | number | undefined): Promise<string[]>;
|
|
101
|
-
};
|
|
102
|
-
}>;
|
|
103
|
-
export type VStorage = ReturnType<typeof makeVStorage>;
|
|
104
|
-
export type IdMap = ReturnType<typeof makeFromBoard>;
|
|
105
|
-
export type VstorageKit = Awaited<ReturnType<typeof makeVstorageKit>>;
|
|
106
|
-
import { boardSlottingMarshaller } from '@agoric/vats/tools/board-utils.js';
|
|
107
|
-
import type { MinimalNetworkConfig } from './rpc.js';
|
|
108
|
-
//# sourceMappingURL=vstorage-kit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vstorage-kit.d.ts","sourceRoot":"","sources":["vstorage-kit.js"],"names":[],"mappings":";AAiBO,qCAHJ;IAAoC,KAAK,EAAjC,OAAO,MAAM,CAAC,KAAK;CAC3B,UAAQ,oBAAoB;;;;;;;;;;IA4C3B;;;;OAIG;sBAFQ,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC;;IAU5B;;;;OAIG;iBAHQ,MAAM,gCAEJ,OAAO,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAC,CAAC;IAS7D;;;;;;OAMG;oBAHQ,MAAM,4CAEJ,OAAO,CAAC,MAAM,EAAE,CAAC;EAuCjC;AAIM;;EAWN;;IAMe,2BADD,MAAM;;;kBAwBE,MAAM;mBAAS,MAAM,EAAE;;MAd3C;IAKe,6BAHL,MAAM,OACN,KAAK,SAOf;IAEU,mCADC,MAAM,EAAE;cAGC,MAAM;eAAS,MAAM,EAAE;QAS3C;;AAUI,qCAJI,KAAK,YACL,QAAQ,GACN,OAAO,CAAC,OAAO,mCAAmC,EAAE,kBAAkB,CAAC,CAoBnF;AAMM,2CAHI;IAAE,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,CAAA;CAAE,UAC9B,oBAAoB;;;;;;2BAiBV,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;2BAN3B,MAAM,KAAK,OAAO;;;;;;;;;;;QArKnC;;;;WAIG;0BAFQ,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC;;QAU5B;;;;WAIG;qBAHQ,MAAM,gCAEJ,OAAO,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,EAAE,CAAA;SAAC,CAAC;QAS7D;;;;;;WAMG;wBAHQ,MAAM,4CAEJ,OAAO,CAAC,MAAM,EAAE,CAAC;;GA6JjC;uBArHa,UAAU,CAAC,OAAO,YAAY,CAAC;oBAe/B,UAAU,CAAC,OAAO,aAAa,CAAC;0BAuGhC,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;wCAnPlD,mCAAmC;0CAKH,UAAU"}
|
package/src/wallet-utils.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export function makeWalletUtils({ fetch, delay }: {
|
|
2
|
-
fetch: typeof globalThis.fetch;
|
|
3
|
-
delay: (ms: number) => Promise<void>;
|
|
4
|
-
}, networkConfig: MinimalNetworkConfig): Promise<{
|
|
5
|
-
networkConfig: MinimalNetworkConfig;
|
|
6
|
-
agoricNames: import("@agoric/vats/tools/board-utils.js").AgoricNamesRemotes;
|
|
7
|
-
fromBoard: {
|
|
8
|
-
convertSlotToVal: (boardId: any, iface: any) => any;
|
|
9
|
-
};
|
|
10
|
-
marshaller: Omit<import("@endo/marshal").Marshal<string | null>, "serialize" | "unserialize">;
|
|
11
|
-
vstorage: {
|
|
12
|
-
url: (path?: string, { kind, height }?: {
|
|
13
|
-
kind?: string | undefined;
|
|
14
|
-
height?: number | undefined;
|
|
15
|
-
}) => string;
|
|
16
|
-
decode({ result: { response } }: {
|
|
17
|
-
result: {
|
|
18
|
-
response: any;
|
|
19
|
-
};
|
|
20
|
-
}): string;
|
|
21
|
-
readLatest(path?: string): Promise<string>;
|
|
22
|
-
keys(path?: string): Promise<any>;
|
|
23
|
-
readAt(path: string, height?: number | undefined): Promise<{
|
|
24
|
-
blockHeight: number;
|
|
25
|
-
values: string[];
|
|
26
|
-
}>;
|
|
27
|
-
readFully(path: string, minHeight?: string | number | undefined): Promise<string[]>;
|
|
28
|
-
};
|
|
29
|
-
getLastUpdate: (addr: string) => Promise<UpdateRecord>;
|
|
30
|
-
getCurrentWalletRecord: (addr: string) => Promise<CurrentWalletRecord>;
|
|
31
|
-
readLatestHead: (path: string) => Promise<unknown>;
|
|
32
|
-
storedWalletState: (from: string, minHeight?: string | number | undefined) => Promise<{
|
|
33
|
-
invitationsReceived: Map<import("@agoric/smart-wallet/src/offers.js").OfferId, {
|
|
34
|
-
acceptedIn: import("@agoric/smart-wallet/src/offers.js").OfferId;
|
|
35
|
-
description: string;
|
|
36
|
-
instance: Instance;
|
|
37
|
-
}>;
|
|
38
|
-
offerStatuses: Map<import("@agoric/smart-wallet/src/offers.js").OfferId, import("@agoric/smart-wallet/src/offers.js").OfferStatus>;
|
|
39
|
-
balances: Map<Brand, Amount>;
|
|
40
|
-
}>;
|
|
41
|
-
pollOffer: (from: string, id: string | number, minHeight: number | string, untilNumWantsSatisfied?: boolean | undefined) => Promise<import("@agoric/smart-wallet/src/offers.js").OfferStatus>;
|
|
42
|
-
}>;
|
|
43
|
-
export type WalletUtils = Awaited<ReturnType<typeof makeWalletUtils>>;
|
|
44
|
-
import type { MinimalNetworkConfig } from './rpc.js';
|
|
45
|
-
import type { UpdateRecord } from '@agoric/smart-wallet/src/smartWallet.js';
|
|
46
|
-
import type { CurrentWalletRecord } from '@agoric/smart-wallet/src/smartWallet.js';
|
|
47
|
-
import type { Brand } from '@agoric/ertp/src/types.js';
|
|
48
|
-
import type { Amount } from '@agoric/ertp/src/types.js';
|
|
49
|
-
//# sourceMappingURL=wallet-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-utils.d.ts","sourceRoot":"","sources":["wallet-utils.js"],"names":[],"mappings":"AAkBO,kDAJJ;IAAuC,KAAK,EAApC,OAAO,UAAU,CAAC,KAAK;IACc,KAAK,EAA1C,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;CACrC,iBAAQ,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;0BAoElB,MAAM,KACJ,OAAO,CAAC,YAAY,CAAC;mCASvB,MAAM,KACJ,OAAO,CAAC,mBAAmB,CAAC;;8BArE9B,MAAM;;;;;;;;;sBA2BN,MAAM,MACN,MAAM,GAAC,MAAM,aACb,MAAM,GAAC,MAAM;GA4DzB;0BACa,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;0CA5GlB,UAAU;kCADG,yCAAyC;yCAAzC,yCAAyC;2BAD7D,2BAA2B;4BAA3B,2BAA2B"}
|