Skip to content

Commit

Permalink
feat: support new status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
monitz87 committed Oct 13, 2020
1 parent 500bed7 commit 068f697
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/types/index.ts
Expand Up @@ -358,6 +358,8 @@ export enum TransferStatus {
VolumeLimitReached = 'VolumeLimitReached', // 165
BlockedTransaction = 'BlockedTransaction', // 166
FundsLimitReached = 'FundsLimitReached', // 168
PortfolioFailure = 'PortfolioFailure', // 169
CustodianError = 'CustodianError', // 170
}

export interface ClaimTarget {
Expand Down
8 changes: 8 additions & 0 deletions src/utils/__tests__/index.ts
Expand Up @@ -2428,6 +2428,14 @@ describe('u8ToTransferStatus', () => {

expect(result).toBe(TransferStatus.FundsLimitReached);

result = u8ToTransferStatus(dsMockUtils.createMockU8(169));

expect(result).toBe(TransferStatus.PortfolioFailure);

result = u8ToTransferStatus(dsMockUtils.createMockU8(170));

expect(result).toBe(TransferStatus.CustodianError);

const fakeStatusCode = 1;
expect(() => u8ToTransferStatus(dsMockUtils.createMockU8(fakeStatusCode))).toThrow(
`Unsupported status code "${fakeStatusCode}". Please report this issue to the Polymath team`
Expand Down
6 changes: 6 additions & 0 deletions src/utils/index.ts
Expand Up @@ -640,6 +640,12 @@ export function u8ToTransferStatus(status: u8): TransferStatus {
case 168: {
return TransferStatus.FundsLimitReached;
}
case 169: {
return TransferStatus.PortfolioFailure;
}
case 170: {
return TransferStatus.CustodianError;
}
case 80: {
return TransferStatus.Failure;
}
Expand Down

0 comments on commit 068f697

Please sign in to comment.