Skip to content

Commit

Permalink
fix(orchestration): remove cancelToken logic from undelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed May 1, 2024
1 parent e456308 commit 5cb19f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ export const start = async (zcf, privateArgs) => {
const celestiaAccount = await celestia.createAccount();

const delegations = await celestiaAccount.getDelegations();
const [undelegation] = await celestiaAccount.undelegate(delegations);

// wait for the undelegations to be complete (may take weeks)
await undelegation.completion;
await celestiaAccount.undelegate(delegations);

// ??? should this be synchronous? depends on how names are resolved.
const stride = await orch.getChain('stride');
Expand Down
23 changes: 10 additions & 13 deletions packages/orchestration/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import type { Amount, Brand, Payment, Purse } from '@agoric/ertp/exported.js';
import type {
Amount,
Brand,
Payment,
Purse,
RemotableBrand,
} from '@agoric/ertp/exported.js';
import type { Timestamp } from '@agoric/time';
import type { Invitation } from '@agoric/zoe/exported.js';
import type { Any } from '@agoric/cosmic-proto/google/protobuf/any';
Expand Down Expand Up @@ -255,16 +261,6 @@ export interface ChainAccount {
prepareTransfer: () => Promise<Invitation>;
}

export interface Undelegation {
cancel: () => Promise<MsgCancelUnbondingDelegation>;
response: MsgUndelegateResponse;
/**
* Resolves when the undelegation is complete and the tokens are no longer bonded.
* Note it may take weeks.
*/
completion: Promise<void>;
}

/**
* An object that supports high-level operations for an account on a remote chain.
*/
Expand Down Expand Up @@ -365,9 +361,10 @@ export interface BaseOrchestrationAccount {

/**
* Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
* @param delegations - the delegation to undelegate
* Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
* @param {Delegation[]} delegations - the delegation to undelegate
*/
undelegate: (delegations: Delegation[]) => Promise<Undelegation[]>;
undelegate: (delegations: Delegation[]) => Promise<void>;

/**
* Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
Expand Down

0 comments on commit 5cb19f9

Please sign in to comment.