Skip to content

Commit

Permalink
fix: 🐛 allow non-agents to pre-approve assets
Browse files Browse the repository at this point in the history
correct authorization logic that was preventing non asset agents from
pre-approving assets
  • Loading branch information
polymath-eric committed May 15, 2024
1 parent 7258de0 commit 1ac7b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/api/procedures/__tests__/toggleTickerPreApproval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('toggleTickerPreApproval procedure', () => {
expect(boundFunc(args)).toEqual({
permissions: {
transactions: [TxTags.asset.PreApproveTicker],
assets: [expect.objectContaining({ ticker })],
assets: [],
portfolios: [],
},
});
Expand All @@ -131,7 +131,7 @@ describe('toggleTickerPreApproval procedure', () => {
expect(boundFunc(args)).toEqual({
permissions: {
transactions: [TxTags.asset.RemoveTickerPreApproval],
assets: [expect.objectContaining({ ticker })],
assets: [],
portfolios: [],
},
});
Expand Down
7 changes: 3 additions & 4 deletions src/api/procedures/toggleTickerPreApproval.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseAsset, PolymeshError, Procedure } from '~/internal';
import { PolymeshError, Procedure } from '~/internal';
import { ErrorCode, TxTags } from '~/types';
import { ExtrinsicParams, ProcedureAuthorization, TransactionSpec } from '~/types/internal';
import { stringToTicker } from '~/utils/conversion';
Expand Down Expand Up @@ -56,15 +56,14 @@ export async function prepareToggleTickerPreApproval(
*/
export function getAuthorization(
this: Procedure<Params, void>,
{ ticker, preApprove }: Params
{ preApprove }: Params
): ProcedureAuthorization {
const { context } = this;
return {
permissions: {
transactions: [
preApprove ? TxTags.asset.PreApproveTicker : TxTags.asset.RemoveTickerPreApproval,
],
assets: [new BaseAsset({ ticker }, context)],
assets: [],
portfolios: [],
},
};
Expand Down

0 comments on commit 1ac7b64

Please sign in to comment.