@agoric/orchestration 0.1.1-dev-b5575d3.0 → 0.1.1-dev-f291362.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/orchestration",
3
- "version": "0.1.1-dev-b5575d3.0+b5575d3",
3
+ "version": "0.1.1-dev-f291362.0+f291362",
4
4
  "description": "Chain abstraction for Agoric's orchestration clients",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -33,19 +33,19 @@
33
33
  },
34
34
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
35
35
  "dependencies": {
36
- "@agoric/async-flow": "0.1.1-dev-b5575d3.0+b5575d3",
37
- "@agoric/cosmic-proto": "0.4.1-dev-b5575d3.0+b5575d3",
38
- "@agoric/ertp": "0.16.3-dev-b5575d3.0+b5575d3",
39
- "@agoric/internal": "0.3.3-dev-b5575d3.0+b5575d3",
40
- "@agoric/network": "0.1.1-dev-b5575d3.0+b5575d3",
41
- "@agoric/notifier": "0.6.3-dev-b5575d3.0+b5575d3",
42
- "@agoric/store": "0.9.3-dev-b5575d3.0+b5575d3",
43
- "@agoric/time": "0.3.3-dev-b5575d3.0+b5575d3",
44
- "@agoric/vat-data": "0.5.3-dev-b5575d3.0+b5575d3",
45
- "@agoric/vats": "0.15.2-dev-b5575d3.0+b5575d3",
46
- "@agoric/vow": "0.1.1-dev-b5575d3.0+b5575d3",
47
- "@agoric/zoe": "0.26.3-dev-b5575d3.0+b5575d3",
48
- "@agoric/zone": "0.2.3-dev-b5575d3.0+b5575d3",
36
+ "@agoric/async-flow": "0.1.1-dev-f291362.0+f291362",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-f291362.0+f291362",
38
+ "@agoric/ertp": "0.16.3-dev-f291362.0+f291362",
39
+ "@agoric/internal": "0.3.3-dev-f291362.0+f291362",
40
+ "@agoric/network": "0.1.1-dev-f291362.0+f291362",
41
+ "@agoric/notifier": "0.6.3-dev-f291362.0+f291362",
42
+ "@agoric/store": "0.9.3-dev-f291362.0+f291362",
43
+ "@agoric/time": "0.3.3-dev-f291362.0+f291362",
44
+ "@agoric/vat-data": "0.5.3-dev-f291362.0+f291362",
45
+ "@agoric/vats": "0.15.2-dev-f291362.0+f291362",
46
+ "@agoric/vow": "0.1.1-dev-f291362.0+f291362",
47
+ "@agoric/zoe": "0.26.3-dev-f291362.0+f291362",
48
+ "@agoric/zone": "0.2.3-dev-f291362.0+f291362",
49
49
  "@endo/base64": "^1.0.7",
50
50
  "@endo/errors": "^1.2.5",
51
51
  "@endo/far": "^1.1.5",
@@ -54,7 +54,7 @@
54
54
  "@noble/hashes": "^1.5.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@agoric/swingset-liveslots": "0.10.3-dev-b5575d3.0+b5575d3",
57
+ "@agoric/swingset-liveslots": "0.10.3-dev-f291362.0+f291362",
58
58
  "@chain-registry/client": "^1.47.4",
59
59
  "@cosmjs/amino": "^0.32.3",
60
60
  "@cosmjs/proto-signing": "^0.32.3",
@@ -94,5 +94,5 @@
94
94
  "typeCoverage": {
95
95
  "atLeast": 97.6
96
96
  },
97
- "gitHead": "b5575d34588db3f4b850fb86ef144dabe7abe99e"
97
+ "gitHead": "f291362e4bc62ec31552cef29ec1a5f5cfbf7bd7"
98
98
  }
@@ -1,5 +1,5 @@
1
1
  import type { AnyJson, TypedJson, JsonSafe } from '@agoric/cosmic-proto';
2
- import type { Delegation, Redelegation, UnbondingDelegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
2
+ import type { RedelegationResponse, UnbondingDelegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
3
3
  import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
4
4
  import type { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
5
5
  import type { State as IBCChannelState, Order } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
@@ -77,6 +77,20 @@ export type CosmosChainInfo = Readonly<{
77
77
  denom: string;
78
78
  }>>;
79
79
  }>;
80
+ /** @see {QueryDelegationTotalRewardsResponse} */
81
+ export interface CosmosRewardsResponse {
82
+ rewards: {
83
+ validator: CosmosValidatorAddress;
84
+ reward: DenomAmount[];
85
+ }[];
86
+ total: DenomAmount[];
87
+ }
88
+ /** @see {DelegationResponse} */
89
+ export interface CosmosDelegationResponse {
90
+ delegator: ChainAddress;
91
+ validator: CosmosValidatorAddress;
92
+ amount: DenomAmount;
93
+ }
80
94
  /**
81
95
  * Queries for the staking properties of an account.
82
96
  *
@@ -87,12 +101,12 @@ export interface StakingAccountQueries {
87
101
  /**
88
102
  * @returns all active delegations from the account to any validator (or [] if none)
89
103
  */
90
- getDelegations: () => Promise<Delegation[]>;
104
+ getDelegations: () => Promise<CosmosDelegationResponse[]>;
91
105
  /**
92
106
  * @returns the active delegation from the account to a specific validator. Return an
93
107
  * empty Delegation if there is no delegation.
94
108
  */
95
- getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
109
+ getDelegation: (validator: CosmosValidatorAddress) => Promise<CosmosDelegationResponse>;
96
110
  /**
97
111
  * @returns the unbonding delegations from the account to any validator (or [] if none)
98
112
  */
@@ -101,13 +115,12 @@ export interface StakingAccountQueries {
101
115
  * @returns the unbonding delegations from the account to a specific validator (or [] if none)
102
116
  */
103
117
  getUnbondingDelegation: (validator: CosmosValidatorAddress) => Promise<UnbondingDelegation>;
104
- getRedelegations: () => Promise<Redelegation[]>;
105
- getRedelegation: (srcValidator: CosmosValidatorAddress, dstValidator?: CosmosValidatorAddress) => Promise<Redelegation>;
118
+ getRedelegations: () => Promise<RedelegationResponse[]>;
106
119
  /**
107
120
  * Get the pending rewards for the account.
108
121
  * @returns the amounts of the account's rewards pending from all validators
109
122
  */
110
- getRewards: () => Promise<DenomAmount[]>;
123
+ getRewards: () => Promise<CosmosRewardsResponse>;
111
124
  /**
112
125
  * Get the rewards pending with a specific validator.
113
126
  * @param validator - the validator address to query for
@@ -146,6 +159,7 @@ export interface StakingAccountActions {
146
159
  */
147
160
  undelegate: (delegations: {
148
161
  amount: AmountArg;
162
+ delegator?: ChainAddress;
149
163
  validator: CosmosValidatorAddress;
150
164
  }[]) => Promise<void>;
151
165
  /**
@@ -250,6 +264,6 @@ export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> = (CCI extend
250
264
  icaEnabled: true;
251
265
  } ? IcaAccount : {}) & CCI extends {
252
266
  stakingTokens: {};
253
- } ? StakingAccountActions : {};
267
+ } ? StakingAccountActions & StakingAccountQueries : {};
254
268
  export type ICQQueryFunction = (msgs: JsonSafe<RequestQuery>[]) => Promise<JsonSafe<ResponseQuery>[]>;
255
269
  //# sourceMappingURL=cosmos-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cosmos-api.d.ts","sourceRoot":"","sources":["cosmos-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,KAAK,EACV,KAAK,IAAI,eAAe,EACxB,KAAK,EACN,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC7G,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACd,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAgB,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAA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AC,CAAC"}
package/src/cosmos-api.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { AnyJson, TypedJson, JsonSafe } from '@agoric/cosmic-proto';
2
2
  import type {
3
3
  Delegation,
4
+ DelegationResponse,
4
5
  Redelegation,
6
+ RedelegationResponse,
5
7
  UnbondingDelegation,
6
8
  } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
7
9
  import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
@@ -26,6 +28,7 @@ import type {
26
28
  LocalIbcAddress,
27
29
  RemoteIbcAddress,
28
30
  } from '@agoric/vats/tools/ibc-utils.js';
31
+ import type { QueryDelegationTotalRewardsResponse } from '@agoric/cosmic-proto/cosmos/distribution/v1beta1/query.js';
29
32
  import type { AmountArg, ChainAddress, Denom, DenomAmount } from './types.js';
30
33
 
31
34
  /** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
@@ -97,6 +100,24 @@ export type CosmosChainInfo = Readonly<{
97
100
  stakingTokens?: Readonly<Array<{ denom: string }>>;
98
101
  }>;
99
102
 
103
+ // #region Orchestration views on Cosmos response types
104
+ // Naming scheme: Cosmos for the chain system, Rewards b/c getRewards function,
105
+ // and Response because it's the return value.
106
+
107
+ /** @see {QueryDelegationTotalRewardsResponse} */
108
+ export interface CosmosRewardsResponse {
109
+ rewards: { validator: CosmosValidatorAddress; reward: DenomAmount[] }[];
110
+ total: DenomAmount[];
111
+ }
112
+
113
+ /** @see {DelegationResponse} */
114
+ export interface CosmosDelegationResponse {
115
+ delegator: ChainAddress;
116
+ validator: CosmosValidatorAddress;
117
+ amount: DenomAmount;
118
+ }
119
+ // #endregion
120
+
100
121
  /**
101
122
  * Queries for the staking properties of an account.
102
123
  *
@@ -107,13 +128,15 @@ export interface StakingAccountQueries {
107
128
  /**
108
129
  * @returns all active delegations from the account to any validator (or [] if none)
109
130
  */
110
- getDelegations: () => Promise<Delegation[]>;
131
+ getDelegations: () => Promise<CosmosDelegationResponse[]>;
111
132
 
112
133
  /**
113
134
  * @returns the active delegation from the account to a specific validator. Return an
114
135
  * empty Delegation if there is no delegation.
115
136
  */
116
- getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
137
+ getDelegation: (
138
+ validator: CosmosValidatorAddress,
139
+ ) => Promise<CosmosDelegationResponse>;
117
140
 
118
141
  /**
119
142
  * @returns the unbonding delegations from the account to any validator (or [] if none)
@@ -127,18 +150,13 @@ export interface StakingAccountQueries {
127
150
  validator: CosmosValidatorAddress,
128
151
  ) => Promise<UnbondingDelegation>;
129
152
 
130
- getRedelegations: () => Promise<Redelegation[]>;
131
-
132
- getRedelegation: (
133
- srcValidator: CosmosValidatorAddress,
134
- dstValidator?: CosmosValidatorAddress,
135
- ) => Promise<Redelegation>;
153
+ getRedelegations: () => Promise<RedelegationResponse[]>;
136
154
 
137
155
  /**
138
156
  * Get the pending rewards for the account.
139
157
  * @returns the amounts of the account's rewards pending from all validators
140
158
  */
141
- getRewards: () => Promise<DenomAmount[]>;
159
+ getRewards: () => Promise<CosmosRewardsResponse>;
142
160
 
143
161
  /**
144
162
  * Get the rewards pending with a specific validator.
@@ -187,7 +205,11 @@ export interface StakingAccountActions {
187
205
  * @param delegations - the delegation to undelegate
188
206
  */
189
207
  undelegate: (
190
- delegations: { amount: AmountArg; validator: CosmosValidatorAddress }[],
208
+ delegations: {
209
+ amount: AmountArg;
210
+ delegator?: ChainAddress;
211
+ validator: CosmosValidatorAddress;
212
+ }[],
191
213
  ) => Promise<void>;
192
214
 
193
215
  /**
@@ -307,7 +329,7 @@ export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> =
307
329
  CCI extends {
308
330
  stakingTokens: {};
309
331
  }
310
- ? StakingAccountActions
332
+ ? StakingAccountActions & StakingAccountQueries
311
333
  : {};
312
334
 
313
335
  export type ICQQueryFunction = (
@@ -39,10 +39,72 @@ export function start(zcf: ZCF<StakeIcaTerms>, privateArgs: {
39
39
  withdrawRewards(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
40
40
  undelegate(delegations: {
41
41
  amount: import("../orchestration-api.js").AmountArg;
42
+ delegator?: import("../orchestration-api.js").ChainAddress;
42
43
  validator: import("../cosmos-api.js").CosmosValidatorAddress;
43
44
  }[]): import("@agoric/vow").Vow<void>;
44
45
  deactivate(): import("@agoric/vow").Vow<void>;
45
46
  reactivate(): import("@agoric/vow").Vow<void>;
47
+ getDelegation(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../cosmos-api.js").CosmosDelegationResponse>>;
48
+ getDelegations(): import("@agoric/vow").Vow<{
49
+ delegator: {
50
+ chainId: string;
51
+ value: string;
52
+ encoding: "bech32" | "ethereum";
53
+ };
54
+ validator: {
55
+ chainId: string;
56
+ value: `${string}valoper${string}`;
57
+ encoding: "bech32";
58
+ };
59
+ amount: {
60
+ denom: import("../orchestration-api.js").Denom;
61
+ value: bigint;
62
+ };
63
+ }[]>;
64
+ getUnbondingDelegation(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").UnbondingDelegation>>;
65
+ getUnbondingDelegations(): import("@agoric/vow").Vow<{
66
+ delegatorAddress: string;
67
+ validatorAddress: string;
68
+ entries: {
69
+ creationHeight: bigint;
70
+ completionTime: {
71
+ seconds: bigint;
72
+ nanos: number;
73
+ };
74
+ initialBalance: string;
75
+ balance: string;
76
+ }[];
77
+ }[]>;
78
+ getRedelegations(): import("@agoric/vow").Vow<{
79
+ redelegation: {
80
+ delegatorAddress: string;
81
+ validatorSrcAddress: string;
82
+ validatorDstAddress: string;
83
+ entries: {
84
+ creationHeight: bigint;
85
+ completionTime: {
86
+ seconds: bigint;
87
+ nanos: number;
88
+ };
89
+ initialBalance: string;
90
+ sharesDst: string;
91
+ }[];
92
+ };
93
+ entries: {
94
+ redelegationEntry: {
95
+ creationHeight: bigint;
96
+ completionTime: {
97
+ seconds: bigint;
98
+ nanos: number;
99
+ };
100
+ initialBalance: string;
101
+ sharesDst: string;
102
+ };
103
+ balance: string;
104
+ }[];
105
+ }[]>;
106
+ getReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
107
+ getRewards(): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../cosmos-api.js").CosmosRewardsResponse>>;
46
108
  }>>;
47
109
  makeAccountInvitationMaker(): Promise<Invitation<ResolvedContinuingOfferResult, undefined>>;
48
110
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"stakeIca.contract.d.ts","sourceRoot":"","sources":["stakeIca.contract.js"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AAEH,yCAAyC;AACzC,mBADW,YAAY,CAAC,OAAO,KAAK,CAAC,CAelC;AAEH;;;;;;cAAsD;AAuB/C,2BAVI,GAAG,CAAC,aAAa,CAAC,eAClB;IACN,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;IAC7B,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;CACrB,WACO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;GAqGjB;4BAtHY;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,eAAe,CAAC;IAClC,sBAAsB,EAAE,eAAe,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;CACrB;yBAoHU,OAAO,KAAK;6BApJiB,cAAc;4BADhC,kBAAkB;6CAIwB,aAAa;kCAFjD,cAAc;6BAHnB,kBAAkB;mDAII,uBAAuB;qCAF5B,cAAc"}
1
+ {"version":3,"file":"stakeIca.contract.d.ts","sourceRoot":"","sources":["stakeIca.contract.js"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AAEH,yCAAyC;AACzC,mBADW,YAAY,CAAC,OAAO,KAAK,CAAC,CAelC;AAEH;;;;;;cAAsD;AAuB/C,2BAVI,GAAG,CAAC,aAAa,CAAC,eAClB;IACN,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;IAC7B,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;CACrB,WACO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGjB;4BAtHY;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,eAAe,CAAC;IAClC,sBAAsB,EAAE,eAAe,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;CACrB;yBAoHU,OAAO,KAAK;6BApJiB,cAAc;4BADhC,kBAAkB;6CAIwB,aAAa;kCAFjD,cAAc;6BAHnB,kBAAkB;mDAII,uBAAuB;qCAF5B,cAAc"}
@@ -7,7 +7,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: {
7
7
  timerService: Remote<TimerService>;
8
8
  }, baggage: import("@agoric/vat-data").Baggage) => Promise<{
9
9
  publicFacet: import("@endo/exo").Guarded<{
10
- makeUnbondAndLiquidStakeInvitation(): Promise<Invitation<import("@agoric/vow").Vow<void>, undefined>>;
10
+ makeUnbondAndTransferInvitation(): Promise<Invitation<import("@agoric/vow").Vow<void>, undefined>>;
11
11
  }>;
12
12
  }>;
13
13
  import type { NameHub } from '@agoric/vats';
@@ -28,13 +28,13 @@ import * as flows from './unbond.flows.js';
28
28
  * @param {OrchestrationTools} tools
29
29
  */
30
30
  const contract = async (zcf, privateArgs, zone, { orchestrateAll }) => {
31
- const { unbondAndLiquidStake } = orchestrateAll(flows, { zcf });
31
+ const { unbondAndTransfer } = orchestrateAll(flows, { zcf });
32
32
 
33
33
  const publicFacet = zone.exo('publicFacet', undefined, {
34
- makeUnbondAndLiquidStakeInvitation() {
34
+ makeUnbondAndTransferInvitation() {
35
35
  return zcf.makeInvitation(
36
- unbondAndLiquidStake,
37
- 'Unbond and liquid stake',
36
+ unbondAndTransfer,
37
+ 'Unbond and transfer',
38
38
  undefined,
39
39
  harden({
40
40
  // Nothing to give; the funds come from undelegating
@@ -1,5 +1,5 @@
1
- export function unbondAndLiquidStake(orch: Orchestrator, { zcf }: {
1
+ export function unbondAndTransfer(orch: Orchestrator, { zcf }: {
2
2
  zcf: ZCF;
3
- }, _seat: ZCFSeat, _offerArgs: undefined): Promise<void>;
3
+ }): Promise<void>;
4
4
  import type { Orchestrator } from '../types.js';
5
5
  //# sourceMappingURL=unbond.flows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unbond.flows.d.ts","sourceRoot":"","sources":["unbond.flows.js"],"names":[],"mappings":"AAmBO,2CANI,YAAY,WAEpB;IAAiB,GAAG,EAAZ,GAAG;CACX,SAAQ,OAAO,cACP,SAAS,iBA4BnB;kCA5CiD,aAAa"}
1
+ {"version":3,"file":"unbond.flows.d.ts","sourceRoot":"","sources":["unbond.flows.js"],"names":[],"mappings":"AAeO,wCAJI,YAAY,WAEpB;IAAiB,GAAG,EAAZ,GAAG;CACb,iBAwBA;kCAjC2E,aAAa"}
@@ -1,12 +1,10 @@
1
+ import { makeTracer } from '@agoric/internal';
2
+
3
+ const trace = makeTracer('UnbondAndTransfer');
4
+
1
5
  /**
2
- * @import {Orchestrator, OrchestrationFlow} from '../types.js'
3
- * @import {TimerService} from '@agoric/time';
4
- * @import {LocalChain} from '@agoric/vats/src/localchain.js';
5
- * @import {NameHub} from '@agoric/vats';
6
- * @import {Remote} from '@agoric/internal';
7
- * @import {Zone} from '@agoric/zone';
8
- * @import {CosmosInterchainService} from '../exos/exo-interfaces.js';
9
- * @import {OrchestrationTools} from '../utils/start-helper.js';
6
+ * @import {Orchestrator, OrchestrationFlow, CosmosDelegationResponse} from '../types.js'
7
+ * @import {DelegationResponse} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
10
8
  */
11
9
 
12
10
  /**
@@ -14,25 +12,20 @@
14
12
  * @param {Orchestrator} orch
15
13
  * @param {object} ctx
16
14
  * @param {ZCF} ctx.zcf
17
- * @param {ZCFSeat} _seat
18
- * @param {undefined} _offerArgs
19
15
  */
20
- export const unbondAndLiquidStake = async (
21
- orch,
22
- { zcf },
23
- _seat,
24
- _offerArgs,
25
- ) => {
16
+ export const unbondAndTransfer = async (orch, { zcf }) => {
26
17
  console.log('zcf within the membrane', zcf);
27
18
  // Osmosis is one of the few chains with icqEnabled
28
19
  const osmosis = await orch.getChain('osmosis');
29
20
  // In a real world scenario, accounts would be re-used across invokations of the handler
30
21
  const osmoAccount = await osmosis.makeAccount();
31
22
 
32
- // TODO https://github.com/Agoric/agoric-sdk/issues/10016
33
- // const delegations = await celestiaAccount.getDelegations();
34
- // // wait for the undelegations to be complete (may take weeks)
35
- // await celestiaAccount.undelegate(delegations);
23
+ /** @type {CosmosDelegationResponse[]} Cosmos */
24
+ const delegations = await osmoAccount.getDelegations();
25
+ trace('delegations', delegations);
26
+ // wait for the undelegations to be complete (may take weeks)
27
+ await osmoAccount.undelegate(delegations);
28
+
36
29
  // ??? should this be synchronous? depends on how names are resolved.
37
30
  const stride = await orch.getChain('stride');
38
31
  const strideAccount = await stride.makeAccount();
@@ -44,4 +37,4 @@ export const unbondAndLiquidStake = async (
44
37
  // await strideAccount.liquidStake(tiaAmt);
45
38
  console.log(osmoAccount, strideAccount);
46
39
  };
47
- harden(unbondAndLiquidStake);
40
+ harden(unbondAndTransfer);