Skip to content

Commit 307f700

Browse files
Fix mosaic definition transaction from payload method (#850)
* docs: update links in CONTRIBUTING.md and README.md * fix: set a revokable flag when creating MosaicDefinitionTransaction from a payload * fix: add a missing method to MosaicInfo class
1 parent f094ab4 commit 307f700

File tree

5 files changed

+36
-6
lines changed

5 files changed

+36
-6
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ Then sit back and wait. There will probably be discussion about the pull request
8282
*CONTRIBUTING.md is based on [CONTRIBUTING-template.md](https://github.com/nayafia/contributing-template/blob/master/CONTRIBUTING-template.md)* , [elasticsearch/CONTRIBUTING](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md) and [spark/CONTRIBUTING](https://github.com/apache/spark/blob/master/CONTRIBUTING.md)
8383

8484
[pull-request]: https://help.github.com/articles/about-pull-requests/
85-
[github-issues]: https://github.com/nemtech/symbol-sdk-typescript-javascript/issues
85+
[github-issues]: https://github.com/symbol/symbol-sdk-typescript-javascript/issues

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ The Symbol SDK for TypeScript / JavaScript allows you to develop web, mobile, an
1111

1212
## Important Notes
1313

14-
### _Catapult-Server_ Network Compatibility (catapult-server@0.10.0.8)
14+
### _Catapult-Server_ Network Compatibility (catapult-server@1.0.3.5)
1515

16-
Symbol network launched [catapult-client](https://github.com/symbol/catapult-client/releases/tag/v1.0.0.0), **it is recommended to use this package's 1.0.0 version and upwards for the Symbol public network**.
16+
Symbol network launched [catapult-client](https://github.com/symbol/symbol/releases), **it is recommended to use this package's 2.0.3 version and upwards for the Symbol public network**.
1717

1818
Find the complete release notes [here](CHANGELOG.md).
1919

@@ -58,8 +58,8 @@ Copyright (c) 2018-present NEM
5858
Licensed under the [Apache License 2.0](LICENSE)
5959

6060
[self]: https://github.com/symbol/symbol-sdk-typescript-javascript
61-
[docs]: http://docs.symbolplatform.com/getting-started/setup-workstation.html
61+
[docs]: https://docs.symbol.dev/getting-started/setup-workstation.html
6262
[issues]: https://github.com/symbol/symbol-sdk-typescript-javascript/issues
63-
[sdk-ref]: https://docs.symbolplatform.com/references/typescript-sdk.html
64-
[guidelines]: https://docs.symbolplatform.com/contribute/contributing.html#sdk
63+
[sdk-ref]: https://docs.symbol.dev/references/typescript-sdk.html
64+
[guidelines]: https://docs.symbol.dev/contribute/contributing.html#sdk
6565
[discord]: https://discord.com/invite/xymcity

src/model/mosaic/MosaicInfo.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ export class MosaicInfo {
113113
return this.flags.restrictable;
114114
}
115115

116+
/**
117+
* Is revokable
118+
* @returns {boolean}
119+
*/
120+
public isRevokable(): boolean {
121+
return this.flags.revokable;
122+
}
123+
116124
/**
117125
* Generate buffer
118126
* @return {Uint8Array}

src/model/transaction/MosaicDefinitionTransaction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export class MosaicDefinitionTransaction extends Transaction {
156156
builder.getFlags().indexOf(MosaicFlagsDto.SUPPLY_MUTABLE) > -1,
157157
builder.getFlags().indexOf(MosaicFlagsDto.TRANSFERABLE) > -1,
158158
builder.getFlags().indexOf(MosaicFlagsDto.RESTRICTABLE) > -1,
159+
builder.getFlags().indexOf(MosaicFlagsDto.REVOKABLE) > -1,
159160
),
160161
builder.getDivisibility(),
161162
new UInt64(builder.getDuration().blockDuration),

test/model/transaction/MosaicDefinitionTransaction.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { expect } from 'chai';
18+
import { CreateTransactionFromPayload } from '../../../src';
1819
import { Convert } from '../../../src/core/format';
1920
import { Account } from '../../../src/model/account/Account';
2021
import { MosaicFlags } from '../../../src/model/mosaic/MosaicFlags';
@@ -199,4 +200,24 @@ describe('MosaicDefinitionTransaction', () => {
199200
Object.assign(tx, { signer: account.publicAccount });
200201
expect(tx.shouldNotifyAccount(account.address)).to.be.true;
201202
});
203+
204+
it('should set correctly revokable flag when generating transaction from payload', () => {
205+
const mosaicDefinitionTransaction = MosaicDefinitionTransaction.create(
206+
Deadline.create(epochAdjustment),
207+
MosaicNonce.createFromUint8Array(new Uint8Array([0xe6, 0xde, 0x84, 0xb8])),
208+
new MosaicId(UInt64.fromUint(1).toDTO()),
209+
MosaicFlags.create(false, false, false, true),
210+
3,
211+
UInt64.fromUint(0),
212+
TestNetworkType,
213+
);
214+
215+
const signedTransaction = mosaicDefinitionTransaction.signWith(account, generationHash);
216+
const recreatedTransaction = CreateTransactionFromPayload(signedTransaction.payload) as MosaicDefinitionTransaction;
217+
218+
expect(recreatedTransaction.flags.supplyMutable).to.be.equal(false);
219+
expect(recreatedTransaction.flags.transferable).to.be.equal(false);
220+
expect(recreatedTransaction.flags.restrictable).to.be.equal(false);
221+
expect(recreatedTransaction.flags.revokable).to.be.equal(true);
222+
});
202223
});

0 commit comments

Comments
 (0)