Skip to content

Commit

Permalink
fix: fix validation when PIA is set to None
Browse files Browse the repository at this point in the history
If PIA is set to None, issuance should be possible, taking the token nowner as default PIA
  • Loading branch information
VictorVicente committed Oct 28, 2020
1 parent 70f20ad commit e79beff
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/api/entities/SecurityToken/index.ts
Expand Up @@ -343,7 +343,7 @@ export class SecurityToken extends Entity<UniqueIdentifiers> {
/**
* Remove the primary issuance agent of the Security Token
*
* @note issuance won’t be possible if primary issuance agent is not set
* @note if primary issuance agent is not set, Security Token owner would be used by default
*/
public removePrimaryIssuanceAgent(): Promise<TransactionQueue<void>> {
const { ticker, context } = this;
Expand Down
27 changes: 0 additions & 27 deletions src/api/procedures/__tests__/issueTokens.ts
Expand Up @@ -95,33 +95,6 @@ describe('issueTokens procedure', () => {
});
});

test('should throw an error if primary issuance agent is undefined', async () => {
const args = {
amount,
ticker,
};

entityMockUtils.configureMocks({
securityTokenOptions: {
details: {
primaryIssuanceAgent: undefined,
},
},
});

const proc = procedureMockUtils.getInstance<IssueTokensParams, SecurityToken>(mockContext);

let error;

try {
await prepareIssueTokens.call(proc, args);
} catch (err) {
error = err;
}

expect(error.message).toBe('You should set a primary issuance agent to issue tokens');
});

test('should add a issue transaction to the queue', async () => {
const isDivisible = true;
const args = {
Expand Down
9 changes: 1 addition & 8 deletions src/api/procedures/issueTokens.ts
Expand Up @@ -30,7 +30,7 @@ export async function prepareIssueTokens(

const securityToken = new SecurityToken({ ticker }, context);

const { isDivisible, totalSupply, primaryIssuanceAgent } = await securityToken.details();
const { isDivisible, totalSupply } = await securityToken.details();

const supplyAfterMint = amount.plus(totalSupply);

Expand All @@ -45,13 +45,6 @@ export async function prepareIssueTokens(
});
}

if (!primaryIssuanceAgent) {
throw new PolymeshError({
code: ErrorCode.ValidationError,
message: 'You should set a primary issuance agent to issue tokens',
});
}

const rawTicker = stringToTicker(ticker, context);
const rawValue = numberToBalance(amount, context, isDivisible);

Expand Down

0 comments on commit e79beff

Please sign in to comment.