Conversation
| } | ||
|
|
||
| var dest = existingAccounts[0].key; | ||
| List<Instruction> instructions = List.empty(); |
There was a problem hiding this comment.
This empty list is not growable by default. Just declare using <Instruction>[], as Dart recommendation.
https://api.dart.dev/stable/2.14.4/dart-core/List/List.empty.html
| instructions.add(MemoProgramBase64EncodedMemo.fromBytes((memo as KinBinaryMemo).encode()).instruction!); | ||
| } | ||
|
|
||
| instructions.add(createAssocAccount.instruction!); |
There was a problem hiding this comment.
Here you are adding to another growable list.
| ).instruction!); | ||
|
|
||
| dest = createAssocAccount.addr; | ||
| signers.add(signer); |
There was a problem hiding this comment.
Adding to a not growable list.
|
|
||
| var dest = existingAccounts[0].key; | ||
| List<Instruction> instructions = List.empty(); | ||
| List<PrivateKey> signers = List.empty(); |
There was a problem hiding this comment.
Same issue here. Just use <PrivateKey>[] to declare the list. Is the most portable and efficient way, since Dart will choose the most efficient implementation for the platform and allow more optimizations.
| } | ||
| } | ||
|
|
||
| existing: |
There was a problem hiding this comment.
Do not declare a loop label if there's not a loop inside a loop.
| import 'dart:ffi'; | ||
| import 'dart:typed_data'; | ||
|
|
||
| import 'package:crypto/crypto.dart'; |
| AssociatedTokenProgramCreateAssociatedTokenAccount( | ||
| this.subsidizer, this.wallet, this.mint); | ||
|
|
||
| late final addr = (AssociatedTokenProgram().getAssociatedAccount(wallet, mint) as PublicKey); |
|
|
||
| Instruction? _instruction; | ||
|
|
||
| Instruction? get instruction { |
| Instruction? _instruction; | ||
|
|
||
| Instruction? get instruction { | ||
| if(_instruction == null) { |
There was a problem hiding this comment.
you are not returning the _instruction.
Use the ??= operator
| var publicKeys = accounts.tokenAccountInfos; | ||
|
|
||
| return new KinServiceResponse(KinServiceResponseType.ok, publicKeys); | ||
| return new KinServiceResponse(KinServiceResponseType.ok, publicKeys.map((e) => KinTokenAccountInfo(PublicKey(e.accountId.toString()), KinAmount.fromInt(e.balance.toInt()), PublicKey(e.closeAuthority.toString()))).toList()); |
There was a problem hiding this comment.
separate in 2 lines. Too many things in the same statement.
|
Review complete, pending testing |
No description provided.