Skip to main content

Utils

These are the utility functions found in utils.js.

buildEthProof#

buildEthProof( assetInfo )#

Build Ethereum SPV proof using eth-proof library.


createAssetID#

createAssetID( NFTID, assetGuid )#

Returns the GUID for a child asset with the given NFT ID, which would be issued from the specified base asset.


fetchBackendAccount#

fetchBackendAccount( backendURL, addressOrXpub, options, xpub, signer )#

Fetch address or xPub information including transactions and balance information (based on options) from backend Blockbook provider.


fetchBackendAsset#

fetchBackendAsset( backendURL, assetGuid )#

Fetches asset information from the backend Blockbook provider for a specific token/asset, given by the GUID.


fetchBackendBlock#

fetchBackendBlock( backendURL, blockhash )#

Fetches the information for a block from the backend, specified by the block hash.


fetchBackendListAssets#

fetchBackendListAssets( backendUrl, filter )#

Fetches a list of assets from backend Blockbook provider via a filter


fetchBackendRawTx#

fetchBackendRawTx( backendURL, txid )#

Fetches the information for a transaction from the backend, specified by the transaction ID (txid).


fetchBackendSPVProof#

fetchBackendSPVProof( backendURL, txid )#

Fetches a SPV Proof from the backend Blockbook provider. To be used to create a proof for the NEVM bridge.


fetchBackendUTXOS#

fetchBackendUTXOS( backendURL, addressOrXpub, options )#

Fetch the UTXOs for an address or XPUB from the backend Blockbook provider.


fetchEstimateFee#

fetchEstimateFee( backendURL, blocks, options )#

Get estimated fee from backend.


fetchNotarizationFromEndPoint#

fetchNotarizationFromEndPoint( endPoint, txHex )#

Fetch notarization signature via axois from an endPoint URL, see spec for more info: https://github.com/syscoin/sips/blob/master/sip-0002.mediawiki


fetchProviderInfo#

fetchProviderInfo( backendURL )#

Fetches the provider info including blockbook and backend data.


getAllocationsFromTx#

getAllocationsFromTx( tx )#

Get allocation information for an asset transaction.


getAssetsRequiringNotarization#

getAssetsRequiringNotarization( res, assets )#

Get assets from the Result object assigned from syscointx.createTransaction() / syscointx.createAssetTransaction() that require notarization.


getAssetIDs#

getAssetIDs( assetGuid )#

Given a certain child asset's GUID this will return the base asset's GUID as well as the child asset's NFT ID.


getBaseAssetID#

getBaseAssetID( assetGuid )#

Given a certain child asset's GUID this will return the base asset's GUID, from which the child was issued with a NFT ID.


getMemoFromOpReturn#

getMemoFromOpReturn( outputs, memoHeader )#

Returns the memo from an array of outputs by finding the OP_RETURN output and extracting the memo from the script, returns null if not found.


getMemoFromScript#

getMemoFromScript( script, memoHeader )#

Get the memo from a script.


getNotarizationSignatures#

getNotarizationSignatures( notaryAssets, txHex )#

Get notarization signatures from a notary endpoint defined in the asset object. See spec for more info.


HDSigner#

HDSigner( mnemonic, password, isTestnet, networks, SLIP44, pubTypes )#

Manage an HD wallet and accounts, connects to SyscoinJS object.


notarizePSBT#

notarizePSBT( psbt, notaryAssets, rawTx )#

Notarize Result object from syscointx.createTransaction() / syscointx.createAssetTransaction() if required by the assets in the inputs of the transaction


sanitizeBlockbookUTXOs#

sanitizeBlockbookUTXOs( sysFromXpubOrAddress, utxoObj, network, txOpts, assetMap, excludeZeroConf )#

Sanitize back-end provider UTXO objects to be useful for this library.


sendRawTransaction#

sendRawTransaction( backendURL, txHex, signer )#

Sends a raw transaction to the backend Blockbook provider to send to the network.


setTransactionMemo#

setTransactionMemo( rawHex, memoHeader, buffMemo )#

Sets a transaction's memo, or returns null if not found.


signWithWIF#

signWithWIF( psbt, wif, network )#

Signs a PSBT/Result object with a WIF


TrezorSigner#

TrezorSigner( password, isTestnet, networks, SLIP44, pubTypes, connectSrc, disableLazyLoad )#

Manage an HD wallet and accounts using a Trezor hardware wallet.