Skip to content

Commit

Permalink
fix: fix drain_delegate bugs in contract api
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-an-yang committed Dec 1, 2022
1 parent efc0272 commit 446aceb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
12 changes: 2 additions & 10 deletions packages/taquito/src/contract/rpc-contract-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,21 +538,13 @@ export class RpcContractProvider
* @param params drainDelegate operation parameter
*/
async drainDelegate(params: DrainDelegateParams) {
const publicKeyHash = await this.signer.publicKeyHash();
const operation = await createDrainDelegateOperation({
...params,
});
const prepared = await this.prepareOperation({ operation: operation, source: publicKeyHash });
const prepared = await this.prepareOperation({ operation: operation });
const opBytes = await this.forge(prepared);
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
return new DrainDelegateOperation(
hash,
operation,
publicKeyHash,
forgedBytes,
opResponse,
context
);
return new DrainDelegateOperation(hash, operation, forgedBytes, opResponse, context);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/taquito/src/operations/drain-delegate-operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export class DrainDelegateOperation extends Operation {
constructor(
hash: string,
private readonly params: RPCDrainDelegateOperation,
public readonly source: string,
raw: ForgedBytes,
results: OperationContentsAndResult[],
context: Context
Expand All @@ -40,7 +39,7 @@ export class DrainDelegateOperation extends Operation {
return this.params.delegate;
}

get detination() {
get destination() {
return this.params.destination;
}
}

0 comments on commit 446aceb

Please sign in to comment.