Skip to content

Commit

Permalink
feat(transfers): add TM failure status code
Browse files Browse the repository at this point in the history
  • Loading branch information
monitz87 committed Jan 18, 2021
1 parent 4be6655 commit 179bc4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ export enum TransferStatus {
PortfolioFailure = 'PortfolioFailure', // 169
CustodianError = 'CustodianError', // 176
ScopeClaimMissing = 'MissingScopeClaimMissingScopedClaim', // 177
TransferRestrictionFailure = 'TransferRestrictionFailure', // 178
}

export interface ClaimTarget {
Expand Down
4 changes: 4 additions & 0 deletions src/utils/__tests__/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,10 @@ describe('u8ToTransferStatus', () => {

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

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

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

const fakeStatusCode = 1;
expect(() => u8ToTransferStatus(dsMockUtils.createMockU8(fakeStatusCode))).toThrow(
`Unsupported status code "${fakeStatusCode}". Please report this issue to the Polymath team`
Expand Down
3 changes: 3 additions & 0 deletions src/utils/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,9 @@ export function u8ToTransferStatus(status: u8): TransferStatus {
case 177: {
return TransferStatus.ScopeClaimMissing;
}
case 178: {
return TransferStatus.TransferRestrictionFailure;
}
case 80: {
return TransferStatus.Failure;
}
Expand Down

0 comments on commit 179bc4b

Please sign in to comment.