dart_psr 0.1.5
dart_psr: ^0.1.5 copied to clipboard

dart-psr is used to generate a Proton signing request (PSR) for a transaction/action/actions[]/identity request to be send, sign and broadcast to a node by Proton Wallet

dart-psr #

dart-psr is used to generate a Proton signing request (PSR) for a transaction/action/actions[]/identity request to be send, sign and broadcast to a node by Proton Wallet

ESR protocol documentation -> https://github.com/eosio-eps/EEPs/blob/master/EEPS/eep-7.md#ESR---The--EOSIO-Signing-Request--protocol

dart-psr is based on javascript library eosio-signing-request -> https://github.com/greymass/eosio-signing-request

Request format -> https://github.com/eosio-eps/EEPs/blob/master/EEPS/eep-7.md#payload

Examples #

https://github.com/ProtonProtocol/dart-psr/tree/feature/eosio-signing-request/example

Usage #

####Import

import 'package:dart_psr/dart_psr.dart';

####Create Signing request object with a eos node url, version and ChainName


var psr = ProtonSigningRequest('https://proton.eoscafeblock.com', 'v1',
    chainName: ChainName.PROTON);

####Encode a transaction

var auth = <Authorization>[
    Authorization()
      ..actor = 'otctest'
      ..permission = 'active'
  ];

  var data = <String, String>{'owner': 'otctest'};

  var actions = <Action>[
    Action()
      ..account = 'eosio'
      ..name = 'refund'
      ..authorization = auth
      ..data = data,
  ];

  var transaction = Transaction()..actions = actions;

  var encoded = await psr.encodeTransaction(transaction);

####Encode an action

var auth = <Authorization>[
    Authorization.fromJson(ESRConstants.PlaceholderAuth)
  ];

  var data = <String, String>{'owner': 'otctest'};

  var action = Action()
    ..account = 'eosio'
    ..name = 'refund'
    ..authorization = auth
    ..data = data;

  var encoded = await psr.encodeAction(action);

####Encode a list of actions

var auth = <Authorization>[
    Authorization.fromJson(ESRConstants.PlaceholderAuth)
  ];

  var data1 = <String, String>{'owner': 'otctest'};

  var action1 = Action()
    ..account = 'eosio'
    ..name = 'refund'
    ..authorization = auth
    ..data = data1;

  var data2 = <String, String>{'owner': 'otctest'};

  var action2 = Action()
    ..account = 'eosio'
    ..name = 'refund'
    ..authorization = auth
    ..data = data2;

  var actions = <Action>[action1, action2];

  var encoded = await psr.encodeActions(actions);

####Encode an identity request

  var permission = IdentityPermission()
    ..actor = 'otctest'
    ..permission = 'active';

  var identity = Identity()..identityPermission = permission;
  String callback = "https://cNallback.com";

  var encoded = await psr.encodeIdentity(identity, callback);

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1
likes
60
pub points
5%
popularity

Publisher

Unknown

dart-psr is used to generate a Proton signing request (PSR) for a transaction/action/actions[]/identity request to be send, sign and broadcast to a node by Proton Wallet

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

http, json_annotation, pointycastle, proton_archive, protondart

More

Packages that depend on dart_psr