Version: Next

Class: RelayProvider

"providers/RelayProvider".RelayProvider

Hierarchy#

Implements#

Constructors#

constructor#

+ new RelayProvider(relayApiUrl: string, relayWsApiUrl: string): RelayProvider

Overrides Provider.constructor

Defined in src/providers/RelayProvider.ts:20

Parameters:#

NameType
relayApiUrlstring
relayWsApiUrlstring

Returns: RelayProvider

Properties#

ApiUrl#

ApiUrl: string

Implementation of TLProvider.ApiUrl

Inherited from Provider.ApiUrl

Defined in src/providers/Provider.ts:8


WsApiUrl#

WsApiUrl: string

Implementation of TLProvider.WsApiUrl

Inherited from Provider.WsApiUrl

Defined in src/providers/Provider.ts:9

Methods#

createWebsocketStream#

createWebsocketStream(endpoint: string, functionName: string, args: object, reconnectingOptions?: ReconnectingWSOptions): Observable<any>

Implementation of TLProvider

Inherited from Provider.createWebsocketStream

Defined in src/providers/Provider.ts:45

Creates a websocket stream connection to the server.

Parameters:#

NameTypeDescription
endpointstringWebsocket stream endpoint to connect to.
functionNamestringFunction to call on connection.
argsobjectFunction arguments.
reconnectingOptions?ReconnectingWSOptions-

Returns: Observable<any>


fetchEndpoint#

fetchEndpoint<T>(endpoint: string, options?: object): Promise<T>

Implementation of TLProvider

Inherited from Provider.fetchEndpoint

Defined in src/providers/Provider.ts:21

Returns a JSON response from the REST API of the server.

Type parameters:#

Name
T

Parameters:#

NameTypeDescription
endpointstringEndpoint to fetch.
options?objectOptional fetch options.

Returns: Promise<T>


getBalance#

getBalance(address: string): Promise<Amount>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:115

Returns balance of given address.

Parameters:#

NameTypeDescription
addressstringAddress to determine balance for.

Returns: Promise<Amount>


getIdentityImplementationAddress#

getIdentityImplementationAddress(address: string): Promise<string>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:62

Returns implementation address of identity with given address

Parameters:#

NameTypeDescription
addressstringAddress of identity

Returns: Promise<string>

the implementation address currently in use by the given identity


getIdentityNonce#

getIdentityNonce(address: string): Promise<number>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:47

Returns next nonce for identity with given address

Parameters:#

NameTypeDescription
addressstringAddress of identity

Returns: Promise<number>

the next nonce that should be used for making a meta-transaction


getMetaTxFees#

getMetaTxFees(metaTransaction: MetaTransaction): Promise<MetaTransactionFees>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:79

Returns the fees the provider would be willing to pay for the transaction

Parameters:#

NameTypeDescription
metaTransactionMetaTransactionMeta transaction to be relayed

Returns: Promise<MetaTransactionFees>

The fees value and currency network of fees for given meta transaction


getMetaTxStatus#

getMetaTxStatus(identityAddress: string, metaTransactionHash: string): Promise<MetaTransactionStatus>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:94

Parameters:#

NameType
identityAddressstring
metaTransactionHashstring

Returns: Promise<MetaTransactionStatus>


getTxInfos#

getTxInfos(address: string): Promise<TxInfos>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:31

Returns needed information for creating an ethereum transaction.

Parameters:#

NameTypeDescription
addressstringAddress of user creating the transaction

Returns: Promise<TxInfos>

Information for creating an ethereum transaction for the given user address. See type TxInfos for more details.


getTxStatus#

getTxStatus(transactionHash: string): Promise<TransactionStatusObject>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:103

Parameters:#

NameType
transactionHashstring

Returns: Promise<TransactionStatusObject>


getVersion#

getVersion(): Promise<string>

Inherited from Provider.getVersion

Defined in src/providers/Provider.ts:64

Returns the version of the currently configured provider server.

Returns: Promise<string>

Version of relay in the format <name>/vX.X.X.


postToEndpoint#

postToEndpoint<T>(endpoint: string, data: any): Promise<T>

Implementation of TLProvider

Inherited from Provider.postToEndpoint

Defined in src/providers/Provider.ts:29

Type parameters:#

Name
T

Parameters:#

NameType
endpointstring
dataany

Returns: Promise<T>


sendSignedMetaTransaction#

sendSignedMetaTransaction(signedMetaTransaction: MetaTransaction): Promise<string>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:145

Send the given signed meta-transaction to a relay server to execute it on the blockchain and returns a Promise with the transaction hash.

Parameters:#

NameTypeDescription
signedMetaTransactionMetaTransactionSigned meta-transaction to be sent to the relay server

Returns: Promise<string>

The hash of the transaction sent by the relay server, not to be confused with the hash of the meta-transaction


sendSignedTransaction#

sendSignedTransaction(signedTransaction: string): Promise<string>

Implementation of TLProvider

Defined in src/providers/RelayProvider.ts:125

Send the given signedTransaction to a relay server to execute it on the blockchain and returns a Promise with the transaction hash.

Parameters:#

NameTypeDescription
signedTransactionstring

Returns: Promise<string>