@agoric/internal 0.3.3-dev-bd0b2a9.0 → 0.3.3-dev-2837beb.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/README.md +4 -4
- package/package.json +5 -4
- package/src/action-types.d.ts +48 -5
- package/src/action-types.d.ts.map +1 -1
- package/src/action-types.js +71 -14
- package/src/chain-utils.d.ts +24 -0
- package/src/chain-utils.d.ts.map +1 -0
- package/src/chain-utils.js +56 -0
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ Like all `@agoric` packages it follows Semantic Versioning. Unlike the others, i
|
|
|
10
10
|
|
|
11
11
|
# Design
|
|
12
12
|
|
|
13
|
-
It is meant to be a home for modules that have no
|
|
13
|
+
It is meant to be a home for modules that have no dependencies on other packages in this repository, except for the following packages that do not theirselves depend upon any other @agoric packages and may be destined for migration elsewhere:
|
|
14
14
|
|
|
15
|
-
- base-zone
|
|
16
|
-
- store
|
|
17
|
-
-
|
|
15
|
+
- [base-zone](../base-zone)
|
|
16
|
+
- [store](../store)
|
|
17
|
+
- [cosmic-proto](../cosmic-proto)
|
|
18
18
|
|
|
19
19
|
This package may not take dependencies on any others in this repository.
|
|
20
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-2837beb.0+2837beb",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/base-zone": "0.1.1-dev-2837beb.0+2837beb",
|
|
24
24
|
"@endo/common": "^1.2.7",
|
|
25
25
|
"@endo/errors": "^1.2.7",
|
|
26
26
|
"@endo/far": "^1.1.8",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"jessie.js": "^0.3.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-2837beb.0+2837beb",
|
|
37
38
|
"@endo/exo": "^1.5.6",
|
|
38
39
|
"@endo/init": "^1.1.6",
|
|
39
40
|
"ava": "^5.3.0",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|
|
59
60
|
"typeCoverage": {
|
|
60
|
-
"atLeast": 93.
|
|
61
|
+
"atLeast": 93.22
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2837beb6d7350aa6976923f1dbbb35edfa8906d6"
|
|
63
64
|
}
|
package/src/action-types.d.ts
CHANGED
|
@@ -1,18 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of messages used for communication between a cosmos-sdk blockchain node
|
|
3
|
+
* and its paired swingset VM, especially for the ABCI lifecycle. See:
|
|
4
|
+
*
|
|
5
|
+
* - https://github.com/tendermint/tendermint/blob/v0.34.x/spec/abci/abci.md#block-execution
|
|
6
|
+
* - ../../../golang/cosmos/vm/action.go
|
|
7
|
+
* - ../../../golang/cosmos/app/app.go
|
|
8
|
+
* - ../../../golang/cosmos/x/swingset/abci.go
|
|
9
|
+
* - ../../../golang/cosmos/x/swingset/keeper/swing_store_exports_handler.go
|
|
10
|
+
* - ../../cosmic-swingset/src/chain-main.js
|
|
11
|
+
* - ../../cosmic-swingset/src/launch-chain.js
|
|
12
|
+
*/
|
|
13
|
+
export type SwingsetMessageType = (typeof SwingsetMessageType)[keyof typeof SwingsetMessageType];
|
|
14
|
+
export namespace SwingsetMessageType {
|
|
15
|
+
let AG_COSMOS_INIT: "AG_COSMOS_INIT";
|
|
16
|
+
let BEGIN_BLOCK: "BEGIN_BLOCK";
|
|
17
|
+
let END_BLOCK: "END_BLOCK";
|
|
18
|
+
let COMMIT_BLOCK: "COMMIT_BLOCK";
|
|
19
|
+
let AFTER_COMMIT_BLOCK: "AFTER_COMMIT_BLOCK";
|
|
20
|
+
let SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
|
|
21
|
+
}
|
|
1
22
|
export const AG_COSMOS_INIT: "AG_COSMOS_INIT";
|
|
2
|
-
export const SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
|
|
3
23
|
export const BEGIN_BLOCK: "BEGIN_BLOCK";
|
|
4
|
-
export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS";
|
|
5
|
-
export const CORE_EVAL: "CORE_EVAL";
|
|
6
|
-
export const DELIVER_INBOUND: "DELIVER_INBOUND";
|
|
7
24
|
export const END_BLOCK: "END_BLOCK";
|
|
8
25
|
export const COMMIT_BLOCK: "COMMIT_BLOCK";
|
|
9
26
|
export const AFTER_COMMIT_BLOCK: "AFTER_COMMIT_BLOCK";
|
|
27
|
+
export const SWING_STORE_EXPORT: "SWING_STORE_EXPORT";
|
|
28
|
+
/**
|
|
29
|
+
* Types of "action" messages consumed by the swingset VM from actionQueue or
|
|
30
|
+
* highPriorityQueue during END_BLOCK. See:
|
|
31
|
+
*
|
|
32
|
+
* - ../../../golang/cosmos/x/swingset/keeper/msg_server.go
|
|
33
|
+
* - ../../../golang/cosmos/x/swingset/keeper/proposal.go
|
|
34
|
+
* - ../../../golang/cosmos/x/vbank/vbank.go
|
|
35
|
+
* - ../../../golang/cosmos/x/vibc/handler.go
|
|
36
|
+
* - ../../../golang/cosmos/x/vibc/keeper/triggers.go
|
|
37
|
+
* - ../../../golang/cosmos/x/vibc/types/ibc_module.go
|
|
38
|
+
*/
|
|
39
|
+
export type QueuedActionType = (typeof QueuedActionType)[keyof typeof QueuedActionType];
|
|
40
|
+
export namespace QueuedActionType {
|
|
41
|
+
let CORE_EVAL: "CORE_EVAL";
|
|
42
|
+
let DELIVER_INBOUND: "DELIVER_INBOUND";
|
|
43
|
+
let IBC_EVENT: "IBC_EVENT";
|
|
44
|
+
let INSTALL_BUNDLE: "INSTALL_BUNDLE";
|
|
45
|
+
let PLEASE_PROVISION: "PLEASE_PROVISION";
|
|
46
|
+
let VBANK_BALANCE_UPDATE: "VBANK_BALANCE_UPDATE";
|
|
47
|
+
let WALLET_ACTION: "WALLET_ACTION";
|
|
48
|
+
let WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION";
|
|
49
|
+
}
|
|
50
|
+
export const CORE_EVAL: "CORE_EVAL";
|
|
51
|
+
export const DELIVER_INBOUND: "DELIVER_INBOUND";
|
|
10
52
|
export const IBC_EVENT: "IBC_EVENT";
|
|
53
|
+
export const INSTALL_BUNDLE: "INSTALL_BUNDLE";
|
|
11
54
|
export const PLEASE_PROVISION: "PLEASE_PROVISION";
|
|
12
55
|
export const VBANK_BALANCE_UPDATE: "VBANK_BALANCE_UPDATE";
|
|
13
56
|
export const WALLET_ACTION: "WALLET_ACTION";
|
|
14
57
|
export const WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION";
|
|
15
|
-
export const
|
|
58
|
+
export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS";
|
|
16
59
|
export const VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT";
|
|
17
60
|
export const KERNEL_UPGRADE_EVENTS: "KERNEL_UPGRADE_EVENTS";
|
|
18
61
|
//# sourceMappingURL=action-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["action-types.js"],"names":[],"mappings":";;;;;;;;;;;;kCAcU,CAAC,OAAO,mBAAmB,EAAE,MAAM,OAAO,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;+BAiC9D,CAAC,OAAO,gBAAgB,EAAE,MAAM,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;AA0BlE,gEAAiE;AACjE,wDAAyD;AACzD,4DAA6D"}
|
package/src/action-types.js
CHANGED
|
@@ -1,19 +1,76 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Types of messages used for communication between a cosmos-sdk blockchain node
|
|
5
|
+
* and its paired swingset VM, especially for the ABCI lifecycle. See:
|
|
6
|
+
*
|
|
7
|
+
* - https://github.com/tendermint/tendermint/blob/v0.34.x/spec/abci/abci.md#block-execution
|
|
8
|
+
* - ../../../golang/cosmos/vm/action.go
|
|
9
|
+
* - ../../../golang/cosmos/app/app.go
|
|
10
|
+
* - ../../../golang/cosmos/x/swingset/abci.go
|
|
11
|
+
* - ../../../golang/cosmos/x/swingset/keeper/swing_store_exports_handler.go
|
|
12
|
+
* - ../../cosmic-swingset/src/chain-main.js
|
|
13
|
+
* - ../../cosmic-swingset/src/launch-chain.js
|
|
14
|
+
*
|
|
15
|
+
* @enum {(typeof SwingsetMessageType)[keyof typeof SwingsetMessageType]}
|
|
16
|
+
*/
|
|
17
|
+
export const SwingsetMessageType = /** @type {const} */ ({
|
|
18
|
+
AG_COSMOS_INIT: 'AG_COSMOS_INIT', // used to synchronize at process launch
|
|
19
|
+
BEGIN_BLOCK: 'BEGIN_BLOCK',
|
|
20
|
+
END_BLOCK: 'END_BLOCK',
|
|
21
|
+
COMMIT_BLOCK: 'COMMIT_BLOCK',
|
|
22
|
+
AFTER_COMMIT_BLOCK: 'AFTER_COMMIT_BLOCK',
|
|
23
|
+
SWING_STORE_EXPORT: 'SWING_STORE_EXPORT', // used to synchronize data export
|
|
24
|
+
});
|
|
25
|
+
harden(SwingsetMessageType);
|
|
26
|
+
|
|
27
|
+
// TODO: Update all imports to use SwingsetMessageType. But until then...
|
|
28
|
+
export const {
|
|
29
|
+
AG_COSMOS_INIT,
|
|
30
|
+
BEGIN_BLOCK,
|
|
31
|
+
END_BLOCK,
|
|
32
|
+
COMMIT_BLOCK,
|
|
33
|
+
AFTER_COMMIT_BLOCK,
|
|
34
|
+
SWING_STORE_EXPORT,
|
|
35
|
+
} = SwingsetMessageType;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Types of "action" messages consumed by the swingset VM from actionQueue or
|
|
39
|
+
* highPriorityQueue during END_BLOCK. See:
|
|
40
|
+
*
|
|
41
|
+
* - ../../../golang/cosmos/x/swingset/keeper/msg_server.go
|
|
42
|
+
* - ../../../golang/cosmos/x/swingset/keeper/proposal.go
|
|
43
|
+
* - ../../../golang/cosmos/x/vbank/vbank.go
|
|
44
|
+
* - ../../../golang/cosmos/x/vibc/handler.go
|
|
45
|
+
* - ../../../golang/cosmos/x/vibc/keeper/triggers.go
|
|
46
|
+
* - ../../../golang/cosmos/x/vibc/types/ibc_module.go
|
|
47
|
+
*
|
|
48
|
+
* @enum {(typeof QueuedActionType)[keyof typeof QueuedActionType]}
|
|
49
|
+
*/
|
|
50
|
+
export const QueuedActionType = /** @type {const} */ ({
|
|
51
|
+
CORE_EVAL: 'CORE_EVAL',
|
|
52
|
+
DELIVER_INBOUND: 'DELIVER_INBOUND',
|
|
53
|
+
IBC_EVENT: 'IBC_EVENT',
|
|
54
|
+
INSTALL_BUNDLE: 'INSTALL_BUNDLE',
|
|
55
|
+
PLEASE_PROVISION: 'PLEASE_PROVISION',
|
|
56
|
+
VBANK_BALANCE_UPDATE: 'VBANK_BALANCE_UPDATE',
|
|
57
|
+
WALLET_ACTION: 'WALLET_ACTION',
|
|
58
|
+
WALLET_SPEND_ACTION: 'WALLET_SPEND_ACTION',
|
|
59
|
+
});
|
|
60
|
+
harden(QueuedActionType);
|
|
61
|
+
|
|
62
|
+
// TODO: Update all imports to use QueuedActionType. But until then...
|
|
63
|
+
export const {
|
|
64
|
+
CORE_EVAL,
|
|
65
|
+
DELIVER_INBOUND,
|
|
66
|
+
IBC_EVENT,
|
|
67
|
+
INSTALL_BUNDLE,
|
|
68
|
+
PLEASE_PROVISION,
|
|
69
|
+
VBANK_BALANCE_UPDATE,
|
|
70
|
+
WALLET_ACTION,
|
|
71
|
+
WALLET_SPEND_ACTION,
|
|
72
|
+
} = QueuedActionType;
|
|
73
|
+
|
|
6
74
|
export const CALCULATE_FEES_IN_BEANS = 'CALCULATE_FEES_IN_BEANS';
|
|
7
|
-
export const CORE_EVAL = 'CORE_EVAL';
|
|
8
|
-
export const DELIVER_INBOUND = 'DELIVER_INBOUND';
|
|
9
|
-
export const END_BLOCK = 'END_BLOCK';
|
|
10
|
-
export const COMMIT_BLOCK = 'COMMIT_BLOCK';
|
|
11
|
-
export const AFTER_COMMIT_BLOCK = 'AFTER_COMMIT_BLOCK';
|
|
12
|
-
export const IBC_EVENT = 'IBC_EVENT';
|
|
13
|
-
export const PLEASE_PROVISION = 'PLEASE_PROVISION';
|
|
14
|
-
export const VBANK_BALANCE_UPDATE = 'VBANK_BALANCE_UPDATE';
|
|
15
|
-
export const WALLET_ACTION = 'WALLET_ACTION';
|
|
16
|
-
export const WALLET_SPEND_ACTION = 'WALLET_SPEND_ACTION';
|
|
17
|
-
export const INSTALL_BUNDLE = 'INSTALL_BUNDLE';
|
|
18
75
|
export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';
|
|
19
76
|
export const KERNEL_UPGRADE_EVENTS = 'KERNEL_UPGRADE_EVENTS';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function makeInitMsg(initAction: any): InitMsg;
|
|
2
|
+
export type NatString = `${bigint}`;
|
|
3
|
+
export type BlockInfo = {
|
|
4
|
+
blockHeight: number;
|
|
5
|
+
/**
|
|
6
|
+
* POSIX Seconds Since the Epoch
|
|
7
|
+
*/
|
|
8
|
+
blockTime: number;
|
|
9
|
+
params: import("@agoric/cosmic-proto/swingset/swingset.js").ParamsSDKType;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* cosmosInitAction fields that are subject to consensus. See cosmosInitAction
|
|
13
|
+
* in {@link ../../../golang/cosmos/app/app.go}.
|
|
14
|
+
*/
|
|
15
|
+
export type InitMsg = BlockInfo & {
|
|
16
|
+
type: typeof _ActionType.AG_COSMOS_INIT;
|
|
17
|
+
chainID: string;
|
|
18
|
+
supplyCoins: {
|
|
19
|
+
denom: string;
|
|
20
|
+
amount: NatString;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
import * as _ActionType from './action-types.js';
|
|
24
|
+
//# sourceMappingURL=chain-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-utils.d.ts","sourceRoot":"","sources":["chain-utils.js"],"names":[],"mappings":"AAqCO,wCAHI,GAAG,GACD,OAAO,CAoBnB;wBAzCa,GAAG,MAAM,EAAE;;iBAIX,MAAM;;;;eACN,MAAM;YACN,OAAO,2CAA2C,EAAE,aAAa;;;;;;sBAIlE,SAAS,GAAG;IACpB,IAAI,EAAE,OAAO,WAAW,CAAC,cAAc,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;CACrD;6BAhByB,mBAAmB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Types and utilities for supporting blockchain functionality without
|
|
3
|
+
* risking import cycles.
|
|
4
|
+
*
|
|
5
|
+
* TODO: Integrate (or integrate with) any/all of:
|
|
6
|
+
*
|
|
7
|
+
* - ./action-types.js
|
|
8
|
+
* - ./chain-storage-paths.js
|
|
9
|
+
* - ./config.js
|
|
10
|
+
* - ../../cosmic-proto (if comfortable co-residing with generated code)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as _ActionType from './action-types.js';
|
|
14
|
+
|
|
15
|
+
/** @typedef {`${bigint}`} NatString */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {object} BlockInfo
|
|
19
|
+
* @property {number} blockHeight
|
|
20
|
+
* @property {number} blockTime POSIX Seconds Since the Epoch
|
|
21
|
+
* @property {import('@agoric/cosmic-proto/swingset/swingset.js').ParamsSDKType} params
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {BlockInfo & {
|
|
26
|
+
* type: typeof _ActionType.AG_COSMOS_INIT;
|
|
27
|
+
* chainID: string;
|
|
28
|
+
* supplyCoins: { denom: string; amount: NatString }[];
|
|
29
|
+
* }} InitMsg
|
|
30
|
+
* cosmosInitAction fields that are subject to consensus. See cosmosInitAction
|
|
31
|
+
* in {@link ../../../golang/cosmos/app/app.go}.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {any} initAction
|
|
36
|
+
* @returns {InitMsg}
|
|
37
|
+
*/
|
|
38
|
+
export const makeInitMsg = initAction => {
|
|
39
|
+
const {
|
|
40
|
+
type,
|
|
41
|
+
blockHeight,
|
|
42
|
+
blockTime,
|
|
43
|
+
chainID,
|
|
44
|
+
params,
|
|
45
|
+
// NB: resolvedConfig is independent of consensus and MUST NOT be included
|
|
46
|
+
supplyCoins,
|
|
47
|
+
} = initAction;
|
|
48
|
+
return {
|
|
49
|
+
type,
|
|
50
|
+
blockHeight,
|
|
51
|
+
blockTime,
|
|
52
|
+
chainID,
|
|
53
|
+
params,
|
|
54
|
+
supplyCoins,
|
|
55
|
+
};
|
|
56
|
+
};
|