Skip to content

Commit a9bb754

Browse files
committed
feat(types): BridgeMessage ActionContext
1 parent 4068388 commit a9bb754

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

packages/cosmic-swingset/src/types.d.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,41 @@ import type {
44
CoreEvalSDKType,
55
} from '@agoric/cosmic-proto/agoric/swingset/swingset.js';
66

7-
interface BlockInfo {
8-
blockHeight: number;
9-
blockTime: number;
7+
// TODO move `walletFlags.js` from @agoric/vats to @agoric/cosmic-proto
8+
type PowerFlag = 'SMART_WALLET' | 'REMOTE_WALLET';
9+
10+
// NB: keep these manually synced until we build these types out of the Golang
11+
// structs or use some other shared type truth
12+
// https://github.com/Agoric/agoric-sdk/issues/8545
13+
14+
interface ActionContext<T extends Uppercase<string>> {
15+
type: T;
16+
blockHeight: string;
17+
blockTime: string;
1018
}
1119

1220
/**
1321
* @see coreEvalAction in proposal.go
1422
*/
15-
export type CoreEvalAction = BlockInfo & {
16-
type: 'CORE_EVAL';
23+
export type CoreEvalAction = ActionContext<'CORE_EVAL'> & {
1724
evals: CoreEvalSDKType[];
1825
};
1926

2027
/**
2128
* @see provisionAction in msg_server.go
2229
*/
23-
export type PleaseProvisionAction = {
24-
type: 'PLEASE_PROVISION';
30+
export type PleaseProvisionAction = ActionContext<'PLEASE_PROVISION'> & {
2531
address: string;
2632
nickname: string;
27-
powerFlags: PowerFlags.SMART_WALLET;
33+
powerFlags: PowerFlag[];
2834
submitter: string;
35+
autoProvision: boolean;
2936
};
3037

3138
/**
3239
* @see VbankBalanceUpdate in vbank.go
3340
*/
34-
export type VbankBalanceUpdateAction = {
35-
type: 'VBANK_BALANCE_UPDATE';
41+
export type VbankBalanceUpdateAction = ActionContext<'VBANK_BALANCE_UPDATE'> & {
3642
nonce: string;
3743
updated: Array<{ address: string; denom: string; amount: string }>;
3844
};

0 commit comments

Comments
 (0)