AnchorLink

class AnchorLinkSharp::AnchorLink
  : public AbiSerializationProvider

Main class

Summary

MembersDescriptions

public readonly ILinkTransport Transport

Transport used to deliver requests to the user wallet.

public readonly string ChainId

EOSIO ChainID for which requests are valid.

public readonly ILinkStorage Storage

PlayerPrefsStorage adapter used to persist sessions.

public AnchorLink( ILinkOptions options)

Create a new anchorLink instance.

public async Task< Abi > GetAbi(string account)

Fetch the ABI for given account, cached.

public string CreateCallbackUrl()

Create a new unique buoy callback url.

public async Task< SigningRequest > CreateRequest(SigningRequestCreateArguments args, ILinkTransport transport)

Create a SigningRequest instance configured for this anchorLink.

public async Task< TransactResult> SendRequest(SigningRequest request, ILinkTransport transport, bool broadcast)

Send a SigningRequest instance using this anchorLink.

public async Task< TransactResult> Transact( TransactArgsargs, TransactOptionsoptions, ILinkTransport transport)

Sign and optionally broadcast a EOSIO transaction, action or actions.

public async Task< IdentifyResult> Identify(PermissionLevel requestPermission, object info)

Send an identity request and verify the identity proof.

public async Task< LoginResult> Login(string identifier)

Login and create a persistent session.

public async Task< LinkSession> RestoreSession(string identifier, PermissionLevel auth)

Restore previous session, see [[AnchorLink.login]] to create a new session.

public async Task< List< PermissionLevel > > ListSessions(string identifier)

List stored session auths for given identifier. The most recently used session is at the top (index 0).

public async Task RemoveSession(string identifier, PermissionLevel auth)

Remove stored session for given identifier and auth.

public async void ClearSessions(string identifier)

Remove all stored sessions for given identifier.

public LinkSignatureProvider MakeSignatureProvider(string[] availableKeys, ILinkTransport transport)

Create an eosjs compatible signature provider using this anchorLink.

public async Task< CallbackPayload> WaitForCallback(string url)

Connect to a WebSocket channel and wait for a message.

public async Task PollForCallback(string url)

private readonly string _serviceAddress

private readonly SigningRequestEncodingOptions _requestOptions

private readonly Dictionary< string, Abi > _abiCache= new Dictionary<string, Abi>()

private readonly Dictionary< string, Task< GetAbiResponse > > _pendingAbis= new Dictionary<string, Task<GetAbiResponse>>()

private WebSocketWrapper _socket

private async Task TouchSession(string identifier, PermissionLevel auth, bool remove)

Makes sure session is in storage list of sessions and moves it to top (most recently used).

private async Task StoreSession(string identifier, LinkSession session)

Makes sure session is in storage list of sessions and moves it to top (most recently used).

private string SessionKey(string identifier, string[] suffixes)

Session storage key for identifier and suffix.

Members

public readonly ILinkTransport Transport

Transport used to deliver requests to the user wallet.

public readonly string ChainId

EOSIO ChainID for which requests are valid.

public readonly ILinkStorage Storage

PlayerPrefsStorage adapter used to persist sessions.

public AnchorLink( ILinkOptions options)

Create a new anchorLink instance.

public async Task< Abi > GetAbi(string account)

Fetch the ABI for given account, cached.

public string CreateCallbackUrl()

Create a new unique buoy callback url.

public async Task< SigningRequest > CreateRequest(SigningRequestCreateArguments args, ILinkTransport transport)

Create a SigningRequest instance configured for this anchorLink.

public async Task< TransactResult> SendRequest(SigningRequest request, ILinkTransport transport, bool broadcast)

Send a SigningRequest instance using this anchorLink.

public async Task< TransactResult> Transact( TransactArgsargs, TransactOptionsoptions, ILinkTransport transport)

Sign and optionally broadcast a EOSIO transaction, action or actions.

Example:

var result = await myLink.transact({transaction: myTx})

Parameters

  • args The action, actions or transaction to use.

  • options Options for this transact call.

  • transport Transport override, for internal use.

public async Task< IdentifyResult> Identify(PermissionLevel requestPermission, object info)

Send an identity request and verify the identity proof.

Parameters

  • requestPermission Optional request permission if the request is for a specific account or permission.

  • info Metadata to add to the request.

This is for advanced use-cases, you probably want to use [[AnchorLink.login]] instead.

public async Task< LoginResult> Login(string identifier)

Login and create a persistent session.

Parameters

  • identifier The session identifier, an EOSIO name ([a-z1-5]{1,12}). Should be set to the contract account if applicable.

public async Task< LinkSession> RestoreSession(string identifier, PermissionLevel auth)

Restore previous session, see [[AnchorLink.login]] to create a new session.

Parameters

  • identifier The session identifier, should be same as what was used when creating the session with [[AnchorLink.login]].

  • auth A specific session auth to restore, if omitted the most recently used session will be restored.

Returns

A [[LinkSession]] instance or null if no session can be found.

Exceptions

  • If no [[LinkStorage]] adapter is configured or there was an error retrieving the session data.

public async Task< List< PermissionLevel > > ListSessions(string identifier)

List stored session auths for given identifier. The most recently used session is at the top (index 0).

Exceptions

  • If no [[LinkStorage]] adapter is configured or there was an error retrieving the session list.

public async Task RemoveSession(string identifier, PermissionLevel auth)

Remove stored session for given identifier and auth.

Exceptions

  • If no [[LinkStorage]] adapter is configured or there was an error removing the session data.

public async void ClearSessions(string identifier)

Remove all stored sessions for given identifier.

Exceptions

  • If no [[LinkStorage]] adapter is configured or there was an error removing the session data.

public LinkSignatureProvider MakeSignatureProvider(string[] availableKeys, ILinkTransport transport)

Create an eosjs compatible signature provider using this anchorLink.

Parameters

  • availableKeys Keys the created provider will claim to be able to sign for.

  • transport (internal) Transport override for this call.

We don't know what keys are available so those have to be provided, to avoid this use [[LinkSession.makeSignatureProvider]] instead. Sessions can be created with [[AnchorLink.login]].

public async Task< CallbackPayload> WaitForCallback(string url)

Connect to a WebSocket channel and wait for a message.

public async Task PollForCallback(string url)

private readonly string _serviceAddress

private readonly SigningRequestEncodingOptions _requestOptions

private readonly Dictionary< string, Abi > _abiCache= new Dictionary<string, Abi>()

private readonly Dictionary< string, Task< GetAbiResponse > > _pendingAbis= new Dictionary<string, Task<GetAbiResponse>>()

private WebSocketWrapper _socket

private async Task TouchSession(string identifier, PermissionLevel auth, bool remove)

Makes sure session is in storage list of sessions and moves it to top (most recently used).

private async Task StoreSession(string identifier, LinkSession session)

Makes sure session is in storage list of sessions and moves it to top (most recently used).

private string SessionKey(string identifier, string[] suffixes)

Session storage key for identifier and suffix.

Last updated