SdkShared
SDK class encapsulating shared logic to be inherited.
Hierarchy
SdkShared
↳
SdkBase
↳
SdkRouter
↳
SdkPool
↳
SdkUtils
Methods
approveIfNeeded
▸ approveIfNeeded(domainId
, assetId
, amount
, infiniteApprove?
): Promise
<undefined
| TransactionRequest
>
Returns the transaction request for an allowance approval.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
|
|
| The domain ID. |
|
|
| The address of the token. |
|
|
| The amount of the token. |
|
|
| (optional) Whether to approve an infinite amount. |
Returns
Promise
<undefined
| TransactionRequest
>
providers.TransactionRequest object.
calculateCanonicalKey
▸ calculateCanonicalKey(domainId
, canonicalId
): string
Returns the hash of the canonical ID + canonical domain.
Remarks
This key is used as the unique identifier for a canonical token, across all domains.
Parameters
Name | Type | Description |
---|---|---|
|
| The canonical domain ID of the token. |
|
| The canonical ID of the token. |
Returns
string
changeSignerAddress
▸ changeSignerAddress(signerAddress
): Promise
<void
>
Switches the signer address in the SDK config.
Parameters
Name | Type | Description |
---|---|---|
|
| The new signer address. |
Returns
Promise
<void
>
getAssetsData
▸ getAssetsData(): Promise
<AssetData
[]>
Fetches the list of registered assets.
Returns
Promise
<AssetData
[]>
Array of objects containing assets registered to the network, in the form of:
getAssetsDataByDomainAndKey
▸ getAssetsDataByDomainAndKey(domainId
, key
): Promise
<undefined
| AssetData
>
Retrieve the asset data for a specific domain and key.
Parameters
Name | Type | Description |
---|---|---|
|
| The domain ID. |
|
| The canonical hash of the canonical token. |
Returns
Promise
<undefined
| AssetData
>
The object containing asset data.
getCanonicalTokenId
▸ getCanonicalTokenId(domainId
, tokenAddress
): Promise
<[string
, string
]>
Returns the canonical ID and canonical domain of a token.
Parameters
Name | Type | Description |
---|---|---|
|
| The canonical domain ID of the token. |
|
| The address of the token. |
Returns
Promise
<[string
, string
]>
getSupported
▸ getSupported(): Promise
<ConnextSupport
[]>
Fetches the list of supported networks and assets.
Returns
Promise
<ConnextSupport
[]>
Array of objects containing networks and assets supported by the protocol, in the form of:
isNextAsset
▸ isNextAsset(tokenAddress
): Promise
<undefined
| boolean
>
Returns whether the specified token is a Connext-issued (local) token.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the token. |
Returns
Promise
<undefined
| boolean
>
Boolean or undefined if the specified token is not registered.
parseConnextTransactionReceipt
▸ parseConnextTransactionReceipt(transactionReceipt
): any
Parses a providers.TransactionReceipt for the logs.
Parameters
Name | Type | Description |
---|---|---|
|
| providers.TransactionReceipt object. |
Returns
any
Array of providers.Log objects.
domainToChainName
▸ Static
domainToChainName(domainId
): string
Returns the chain name for a specified domain.
Parameters
Name | Type | Description |
---|---|---|
|
| The domain ID. |
Returns
string
The chain name.
chainIdToDomain
▸ Static
chainIdToDomain(chainId
): number
Returns the chain name for a specified domain.
Parameters
Name | Type | Description |
---|---|---|
|
| The domain ID. |
Returns
number
The domain of the chain.
getBlockNumberFromUnixTimestamp
▸ Static
getBlockNumberFromUnixTimestamp(domainId
, unixTimestamp
): Promise
<number
>
Uses an external API to fetch the block number from a unix timestamp.
Parameters
Name | Type | Description |
---|---|---|
|
| The domain ID. |
|
| The unix timestamp. |
Returns
Promise
<number
>
Last updated