[AVLE] Posting using Steem Keychain

in Steemit Dev Group3 years ago (edited)

This is a posting created through the AVLE dapp.

Previously I showed how to create a post using posting key.

[AVLE] Posting using AVLE Dapp

This time I will show you creating a post using steem keychain.
This is the first try to communicate the dart (Flutter's programming language) and the Steem keychain which is written in Javascript.

Image upload

Image signing is done also done by steem keychain.

image.png

Other options settings are the same as one with posting key.

Broadcast a post

To broadcast a post or to create a post transaction, keychain is also used. Here requestPost function of keychain is used.

The code explains itself.

_submitPostByKeychain(
      {required Posting posting, required Map<String, dynamic> options}) {
    final jsonOptions = {
      'author': options['author'],
      'permlink': options['permlink'],
      'max_accepted_payout': options['max_accepted_payout'],
      'percent_steem_dollars': options['percent_steem_dollars'],
      'allow_votes': options['allow_votes'],
      'allow_curation_rewards': options['allow_curation_rewards'],
      'extensions': [
        [
          0,
          {
            "beneficiaries": options['beneficiaries']
                .map(
                  (item) => {
                    "account": item.account,
                    "weight": item.weight,
                  },
                )
                .toList(),
          }
        ]
      ]
    };
    printWarning('posting option for keychain: ${json.encode(jsonOptions)}');

    steemKeychain.requestPost(
      username: posting.postRef.author,
      title: posting.title,
      body: posting.body,
      parent_permlink: posting.parentRef!.permlink,
      parent_author: '',
      json_metadata: posting.meta,
      permlink: posting.postRef.permlink,
      comment_options: json.encode(jsonOptions),
      callback: dartJs.allowInterop(
        (response) {
          print('requestPost response: ${response['message']}');
        },
      ),
    );
  }

Here is the advanced setting:
image.png

and the options:

image.png

Posting Result

Here is the screenshot of the post data:

image.png

Beneficiaries were set as expected and other data are all good.

Post stored in DB

Post content is stored correctly in Firebase Store. All are good!
image.png

Resteem / Vote / Comment / Follow / Support

This project will Make STEEM Great Again! I, the developer of PLAY STEEM mobile app, am doing my best to bring people to the STEEM ecosystem.

Thank you for your support.

@steemcurator01

Sort:  

응원합니다. ^^

열심히 응원해주셔서 여기까지 올 수 있었습니다. 고맙습니다!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64344.02
ETH 3142.36
USDT 1.00
SBD 4.01