wharfkit / session

Create account-based sessions, perform transactions, and allow users to login using Antelope-based blockchains.
Other
10 stars 1 forks source link

Add some default ESR options to the TransactContext #15

Closed aaroncox closed 1 year ago

aaroncox commented 1 year ago

Every developer working with ESR payloads in a plugin shouldn't have to manually define these if they don't want:

https://github.com/wharfkit/resource-provider-plugin/blob/14f4860c47449bc6ed2b770b49247515538e11ab/src/index.ts#L144-L147

We either need an easier way to create an ESR payload (a helper of some sort in the context) or to include those as a default so you can just pass them when creating an ESR object, like so:

        const request = await SigningRequest.create(
            {transaction: response.data.request[1]},
            context.esrOptions
        )
shaqk commented 1 year ago

So will the context.esrOptions also house and allow overriding of the callback server (cb.anchor.link)? Or that is going to be part of implementing the UI communication?

aaroncox commented 1 year ago

Yeah, that'll be a part of the UI communication, through the wallet plugins themselves.

ESR itself and the esrOptions parameter above are just so that developers don't need to specify the encoding options:

https://github.com/greymass/eosio-signing-request/blob/6fc84b2355577d6461676bff417c76e4f6f2f5c3/src/signing-request.ts#L281-L288