How to use @iota/http-client - 2 common examples

To help you get started, we’ve selected a few @iota/http-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iotaledger / iota.js / packages / account / src / preset.ts View on Github external
export function networkAdapter({ provider }: NetworkParams): Network {
    const httpClient = createHttpClient({ provider })
    const getBalances = createGetBalances(httpClient)
    const getTrytes = createGetTrytes(httpClient)
    const getLatestInclusion = createGetLatestInclusion(httpClient)

    return {
        getTrytes: hashes => (hashes.length > 0 ? getTrytes(hashes) : Promise.resolve([])),
        getBalance: (address): Promise => getBalances([address], 100).then(({ balances }) => balances[0]),
        getBalances,
        getConsistency: createCheckConsistency(httpClient),
        getLatestInclusion: hashes => (hashes.length > 0 ? getLatestInclusion(hashes) : Promise.resolve([])),
        getBundlesFromAddresses: createGetBundlesFromAddresses(httpClient, 'lib'),
        findTransactions: createFindTransactions(httpClient),
        sendTrytes: createSendTrytes(httpClient),
        setSettings: httpClient.setSettings,
        getTransactionsToApprove: createGetTransactionsToApprove(httpClient),
        attachToTangle: createAttachToTangle(httpClient),
github iotaledger / iota.js / packages / core / src / composeAPI.ts View on Github external
export const composeAPI = (settings: Partial = {}) => {
    let provider: Provider = createHttpClient(settings)
    let attachToTangle: AttachToTangle = settings.attachToTangle || createAttachToTangle(provider)

    /**
     * Defines network provider configuration and [`attachToTangle`]{@link #module_core.attachToTangle} method.
     *
     * @method setSettings
     *
     * @memberof API
     *
     * @param {object} settings - Provider settings object
     * @param {string} [settings.provider] - Http `uri` of IRI node
     * @param {Provider} [settings.network] - Network provider to override with
     * @param {function} [settings.attachToTangle] - AttachToTangle function to override with
     * [`attachToTangle`]{@link #module_core.attachToTangle} with
     */
    function setSettings(newSettings: Partial = {}) {

@iota/http-client

Send commands to IRI over HTTP.

MIT
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis

Popular @iota/http-client functions