Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update tokenAmount and splTokenTransferCheckedInfo models #276

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

deimantasa
Copy link
Contributor

Changes

Current models have not included several fields, which seems to be existing in latest solana implementation.

Sample transaction.
Screenshot 2022-05-22 at 3 46 57 PM

After implementing changes, locally it works well.
Screenshot 2022-05-22 at 3 51 26 PM

To simulate this outcome, send USDC to your devnet wallet. It seems that checked transfer has several more fields. However - I have not found any full official json for these models, therefore not sure, if they can be nullable or are fixed. Would be great if someone could guide me here.

Furthermore, after running solana test suite and running flutter test - it simply timed out. I guess I'm not doing something correctly. Would love to get some guidance here.

Checklist

  • PR is ready for review (if not, it should be a draft).
  • PR title follows Conventional Commits guidelines.
  • Screenshots/video added.
  • Tests added.
  • Self-review done.

…` fields

feat: add helper method `singleAuthority` to retrieve corresponding authority
final List<String>? signers;

/// If [authority] is not provided, [multisigAuthority] must be provided. And vice versa.
String get singleAuthority => authority ?? multisigAuthority!;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added helper method to retrieve correct authority.

final List<String>? signers;

/// If [authority] is not provided, [multisigAuthority] must be provided. And vice versa.
String get singleAuthority => authority ?? multisigAuthority!;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added helper method to retrieve correct authority.

@deimantasa
Copy link
Contributor Author

Would be great if you could find some time (30min) for some 1-1 catchup - would love to properly spin test environment (as it does not seem to work for me now), because I'd like to also add tests for these new changes, as it's very important to not mess anything up.

@ookami-kb
Copy link
Collaborator

Sure, find me in Solana Dart developers Discord channel and let's schedule some call.

Comment on lines +66 to +80
await solanaClient.sendAndConfirmTransaction(
message: Message.only(
TokenInstruction.transferChecked(
amount: 10,
decimals: 2,
source:
Ed25519HDPublicKey.fromBase58(senderTokenAccounts[0].pubkey),
mint: token.address,
destination: wallet.publicKey,
owner: source.publicKey,
),
),
signers: [source],
commitment: Commitment.finalized,
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It keeps failing with

jsonrpc-2.0 error (-32002): Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.
	{accounts: null, err: AccountNotFound, logs: [], unitsConsumed: 0}

I assume I don't pass correct params or I'm missing something.


group('SplTokenTransferCheckedInfo test', () {
test('authority is not available', () {
// TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to make multisig transaction. Because then authority will be null and multisig with signatures - won't. Would love to have helping hand here.


group('SplTokenTransferInfo test', () {
test('authority is not available', () {
// TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to make multisig transaction. Because then authority will be null and multisig with signatures - won't. Would love to have helping hand here.

@deimantasa
Copy link
Contributor Author

Added test commit with comments. Would love to hear suggestions on how to fix mentioned problems.

@deimantasa deimantasa requested a review from ookami-kb June 9, 2022 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants