uuosio / ascdk

MIT License
12 stars 9 forks source link

Optional example? #56

Closed jafri closed 2 years ago

jafri commented 2 years ago

Do we have an example with optional

learnforpractice commented 2 years ago

Yes. https://github.com/uuosio/ascdk/blob/a0bf318836a401ed59011c4fc265e2323f85b6f3/ts-packages/tests/testcodegen.ts#L21

learnforpractice commented 2 years ago

optional implementation has been improved.

https://github.com/uuosio/ascdk/blob/1118aba71858053358b9b4dd3587fc6cc4426def/as-packages/chain/tests/testoptional.ts#L21

jafri commented 2 years ago

@learnforpractice couldn't we treat:

a1: Asset | null

as optional?

learnforpractice commented 2 years ago

I don't think that's a good idea. Asset | null can be used for other purposes which may cause confusion. The current implementation is compatible with C++ Smart Contracts.