New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@heliofi/sdk

Package Overview
Dependencies
Maintainers
7
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@heliofi/sdk

## Introduction

  • 0.0.5-alpha.0
  • npm
  • Socket score

Version published
Weekly downloads
77
increased by266.67%
Maintainers
7
Weekly downloads
 
Created
Source

Helio SDK

Introduction

NPM package with Typescript.

HelioSDK is a collection of software development tools in one installable package.

This SDK are required for developing a Helio app.

Installation

yarn add @heliofi/sdk

HelioSDK Services

Properties table for the HelioSDK

MethodsParamsReturnDescription
constructoroptions?: { cluster: Cluster }voidset properties, cluster available values: devnet, mainnet-beta, testnet
setClustercluster: Clustervoidset cluster available value
currencyServicenoneCurrencyService, neverreturns object CurrencyService
apiServicenoneHelioApiConnector, neverreturns object HelioApiAdapter
solExplorerServicenoneSolExplorerService, neverreturns object SolExplorerService
tokenConversionServicenoneTokenConversionService, neverreturns object TokenConversionService
paylinkServicenonePaylinkSubmitService, neverreturns object PaylinkSubmitService
configServicenoneConfigService, neverreturns object ConfigService
 Cluster = "devnet" | "testnet" | "mainnet-beta";

Properties table for the CurrencyService

MethodsParamsReturnDescription
getCurrenciesnonePromise<Currency[]>if currencies are empty adds currencies
getCurrencyBySymbolsymbol: stringCurrency, neverget currency by symbol (e.g. "SOl")
getCurrencyByMintmint: stringCurrency, neverget currency by mint address
  Currency: {
    blockchain: {
      engine: {
        id: string;
        type: "EVM" | "SOL";
      };
    };
    id: string;
    symbol: string;
    name: string;
    mintAddress?: string;
    coinMarketCapId: number;
    decimals: number;
    symbolPrefix?: string;
    order: number;
    type?: "FIAT" | "DIGITAL";
    iconUrl?: string;
  };

Properties table for the HelioApiAdapter

MethodsParamsReturnDescription
findAddressquery: string, country_code: stringPromise<FetchifyFindAddress>get addresses list by area code and country code
retrieveAddressaddress_id: string, country_code: stringPromise<FetchifyRetrieveAddress>get address more info by address id and country code
listCurrenciesnonePromise<Currency[]>get currencies list
getPaymentRequestByIdPublicid: stringPromise<any>get paylink info
getTokenSwapMintAddressesmintAddress: stringPromise<string[]>get mint addresses list
getTokenSwapQuotepaymentRequestId: string, paymentRequestType: PaymentRequestType,
fromMint: string, quantity?: number,
normalizedPrice?: number, toMint?: string
Promise<SwapRouteToken>get route token for swap
getLivePriceamount: number, to: string, from: string,
paymentRequestId?: string, paymentRequestType?: string
Promise<TokenQuoting>get converted data
getPreparedTransactionMessageurl: string, body: stringPromise<PrepareTransaction>prepare transaction to send
getPreparedTransactionSwapMessageurl: string, body: stringPromise<PrepareSwapTransaction>prepare transaction to send for swap case
  FetchifyFindAddress: {
    results: {
      id: string;
      count: number;
      labels: string[];
    }[];
  };
  
  FetchifyRetrieveAddress: {
    result: {
      province_name: string;
      street_name: string;
      street_prefix: string;
      street_suffix: string;
      building_number: string;
      line_2: string;
      province: string;
      locality: string;
    };
  };
  
  Currency: {
    blockchain: {
      engine: {
        id: string;
        type: "EVM" | "SOL";
      };
    };
    id: string;
    symbol: string;
    name: string;
    mintAddress?: string;
    coinMarketCapId: number;
    decimals: number;
    symbolPrefix?: string;
    order: number;
    type?: "FIAT" | "DIGITAL";
    iconUrl?: string;
  };
  
  PaymentRequestType = "PAYLINK" | "PAYSTREAM" | "INVOICE";
 
  SwapRouteToken: {
    routeToken: string;
  };

  TokenQuoting: {
    rateToken: string;
  };
 
  PrepareTransaction: {
    transactionToken: string;
    transactionMessage: string;
  };
  
  PrepareSwapTransaction: {
    standardTransaction: PrepareTransaction;
    swapTransaction: string;
  };

Properties table for the SolExplorerService

MethodsParamsReturnDescription
getSolanaExplorerTransactionURLtransactionID: stringstringget transaction URL by after pay

Properties table for the TokenConversionService

MethodsParamsReturnDescription
convertFromMinimalUnitssymbol: any, minimalAmount: numbernumberconvert from minimal amount
convertToMinimalUnitssymbol?: any actualAmount?: numbernumberconvert to minimal amount
formatPricecurrency: Currency, normalizedAmount: numberstringformat price
convertFromMinimalAndRoundsymbol: string, minimalAmount: numberstringconvert from minimal amount and round
  Currency: {
    blockchain: {
      engine: {
        id: string;
        type: "EVM" | "SOL";
      };
    };
    id: string;
    symbol: string;
    name: string;
    mintAddress?: string;
    coinMarketCapId: number;
    decimals: number;
    symbolPrefix?: string;
    order: number;
    type?: "FIAT" | "DIGITAL";
    iconUrl?: string;
  };

Properties table for the PaylinkSubmitService

MethodsParamsReturnDescription
handleTransactionprops: BasePaymentProps<BasePaymentResponse>Promise<void>prepare transaction, connect to wallet, send transaction
  import { Idl, Program } from "@project-serum/anchor";
  import { AnchorWallet } from "@solana/wallet-adapter-react";
  import { Cluster, Connection } from "@solana/web3.js";
  
  BasePaymentResponse: {
      transactionSignature: string;
      swapTransactionSignature?: string;
  };
  
  BasePaymentProps: {
    onSuccess: (event: {
      data: BasePaymentResponse;
      transaction: string;
      paymentPK?: string;
      swapTransaction?: string;
    }) => void;
    onError: (event: { transaction?: string; errorMessage: string }) => void;
    onPending?: (event: { transaction: string }) => void;
    symbol: string;
    anchorProvider: Program<HelioIdl>;
    wallet: AnchorWallet;
    connection: Connection;
    rateToken?: string;
    cluster: Cluster;
  };
  

Properties table for the ConfigService

MethodsParamsReturnDescription
getAssetUrlnonestringget helio assets url
getClusternoneClusterreturn selected cluster
setClustercluster: Clustervoidset cluster
getHelioApiBaseUrlnonestringget Helio api base url for current cluster
 Cluster = "devnet" | "testnet" | "mainnet-beta";

Example

import { HelioSDK, ClusterType } from '@heliofi/sdk';
import { Cluster } from '@solana/web3.js';

const cluster = ClusterType.Devnet;

//create object HelioSDK
const helioSDK = new HelioSDK({ cluster });

//get curriences
const currencies = helioSDK.currencyService.getCurrencies();

//get helio asset url
const url = helioSDK.configService.getAssetUrl();

//get mint addresses list
const mintAddresses = await helioSDK.apiService.getTokenSwapMintAddresses('mint address');

//get transaction url
const transactionUrl = helioSDK.solExplorerService.getSolanaExplorerTransactionURL('transaction');

//convert to minimal amount
const amount = helioSDK.tokenConversionService.convertToMinimalUnits('symbol', 100);

//handle transaction
await helioSDK.paylinkService.handleTransaction({...});

FAQs

Package last updated on 01 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc