Skip to content

Commit

Permalink
fix(undelegate): delegatorAddress should not be user supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Jun 17, 2024
1 parent 71403dd commit 11aea65
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/orchestration/src/cosmos-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ export interface StakingAccountActions {
* The unbonding time is padded by 10 minutes to account for clock skew.
* @param delegations - the delegation to undelegate
*/
undelegate: (delegations: Delegation[]) => Promise<void>;
undelegate: (
delegations: Omit<Delegation, 'delegatorAddress'>[],
) => Promise<void>;

/**
* Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/src/exos/cosmosOrchestrationAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export const prepareCosmosOrchestrationAccountKit = (
return this.facets.holder.withdrawReward(validator);
}, 'WithdrawReward');
},
/** @param {Delegation[]} delegations */
/** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
Undelegate(delegations) {
trace('Undelegate', delegations);

Expand Down Expand Up @@ -407,7 +407,7 @@ export const prepareCosmosOrchestrationAccountKit = (
throw assert.error('Not implemented');
},

/** @param {Delegation[]} delegations */
/** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
async undelegate(delegations) {
trace('undelegate', delegations);
const { helper } = this.facets;
Expand Down
1 change: 0 additions & 1 deletion packages/orchestration/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const ChainAmountShape = harden({ denom: M.string(), value: M.nat() });
export const AmountArgShape = M.or(AmountShape, ChainAmountShape);

export const DelegationShape = harden({
delegatorAddress: M.string(),
validatorAddress: M.string(),
shares: M.string(), // TODO: bigint?
});
Expand Down
1 change: 0 additions & 1 deletion packages/orchestration/test/staking-ops.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ test(`undelegate waits for unbonding period`, async t => {
const value = BigInt(Object.values(delegations)[0].amount);
const anAmount = { brand: Far('Token'), value } as Amount<'nat'>;
const delegation = {
delegatorAddress: account.getAddress().address,
shares: `${anAmount.value}`,
validatorAddress: validator.address,
};
Expand Down

0 comments on commit 11aea65

Please sign in to comment.