Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ixily/activ

Package Overview
Dependencies
Maintainers
0
Versions
373
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ixily/activ

Alpha Capture Trade Idea Verification. Blockchain ownership proven trade ideas and strategies.

  • 4.10.23
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
82
decreased by-58.59%
Maintainers
0
Weekly downloads
 
Created
Source

A decentralized P2P network to contribute & access alpha. (Backend)

Table of Contents

Installation

Installation:

IMPORTANT: Install node v18.x.x

npm i @ixily/activ

External packages to use activ correctly:

npm i @lit-protocol/lit-node-client-nodejs@2.1.123
npm i siwe@1.1.6
npm i jimp@0.16.1

Examples:

Go here to see and clone basic examples using activ: https://github.com/IXily

Basic initialization example:

You can install

  import {
      LitNodeProviderModule,
      CacheNodeStorageModule as CacheStorageModule,
      v4,
  } from '@ixily/activ'

  const {
      ActivV4Module,
  } = v4

  const activ = ActivV4Module;

  //@ts-ignore
  import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'
  //@ts-ignore
  import * as Siwe from "siwe";
  //@ts-ignore
  import * as Jimp from 'jimp';

  const PRIVATE_KEY = 'your_private_wallet_key';

  // create the app here: https://nft.storage
  const nftStorageKey = 'your_nft_storage_key';

  const POLYGON_CONFIG: v4.IActivConfig = {
      defaultBlockchainNetwork: 'polygon',
      defaultContract: 'v4',
      defaultContractOptions: {
          userWalletPrivateKey: PRIVATE_KEY,
      },
      litConfig: {
          litProvider: LitNodeProviderModule,
          mock: false,
      },
      nftStorageKey,
      mockNftStorage: false,
      skipPricingSignature: false,
      ipfsProxyEnabled: true,
      showLogsToDebug: true,
      cacheStorageConfig: {
          isBrowser: false,
          module: CacheStorageModule,
          dbParams: {
              provider: 'none',
          }
      }
  };

  const state = {
      configured: {
          amoy: false as boolean,
      },
      instance: {
          amoy: null as any,
      },
      privateKey: {
          amoy: null as string,
      }
  };

  const getApi = async (
      network: NetworkType = 'amoy'
  ): Promise<typeof activ> => {
      if (!state.configured[network]) {

          const initObj = {
              LitJsSdkInstance: LitJsSdk,
              SiweInstance: Siwe,
              backendWalletPrivateKey: null,
          }

          // NOTE: maybe each account have a differents private keys, for this reason we are adding the set (PRIVATE_KEY) multiples time

          switch (network) {
              case 'amoy':
                  initObj.backendWalletPrivateKey = PRIVATE_KEY;
                  await (LitNodeProviderModule as any).init(initObj);
                  await v4.ImagesModule.init({ JimpInstance: Jimp });
                  await EnvModule.set('isProd', false);
                  await activ.config(AMOY_CONFIG);
                  break;
              case 'polygon':
                  initObj.backendWalletPrivateKey = PRIVATE_KEY;
                  await (LitNodeProviderModule as any).init(initObj);
                  await v4.ImagesModule.init({ JimpInstance: Jimp });
                  await EnvModule.set('isProd', true);
                  await activ.config(POLYGON_CONFIG);
                  break;
          }

          state.configured[network] = true;
          state.instance[network] = activ;
          state.privateKey[network] = initObj.backendWalletPrivateKey;
      };

      const networkChainObj = {
          amoy: 'amoy',
          polygon: 'polygon',
      };

      await activ.selectChainContract(networkChainObj[network], 'v4', {
          userWalletPrivateKey: state.privateKey[network],
      })

      return activ
  }

 
 

Creating Investment Ideas

  • Create A New Investment Idea

    import { v4 } from '@ixily/activ'
    
    const newIdea = {
    	public: {
    		title: 'My new idea/nft',
    		description:
    			'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been',
    		image: 'data:image/svg+xml;base64,PCEtLSBieSBUcmFkaW5nVmlldyAtLT48c3ZnIHdpZHRoPSI1NiIgaGVpZ2h0PSI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjc5MzFBIiBkPSJNMCAwaDU2djU2SDB6Ii8+PHBhdGggZD0iTTM5LjkzNiAyNC43MDRjLjUxNS0zLjQ5NC0yLjEzLTUuMzU3LTUuNzczLTYuNjIybDEuMTgtNC43MDgtMi44NzctLjcxNi0xLjE0OCA0LjU5Mi0yLjI5Ni0uNTQ5IDEuMTY0LTQuNjI1LTIuODc4LS43MTUtMS4xODEgNC43MjUtMS44My0uNDMzdi0uMDE2bC0zLjk3Ni0uOTk5LS43NjYgMy4wNzhzMi4xMy41IDIuMDk2LjUxNmMxLjE2NS4zIDEuMzY1IDEuMDY1IDEuMzMyIDEuNjY0bC0xLjMzMiA1LjM5LjMuMS0uMzE2LS4wNjctMS44OCA3LjUzN2MtLjEzMy4zNS0uNS44ODItMS4zMTQuNjY1LjAzMy4wNS0yLjA4LS40OTktMi4wOC0uNDk5bC0xLjQzIDMuMjc4IDMuNzQzLjkzMSAyLjA0Ni41MzMtMS4xOTggNC43NzUgMi44NzguNzE1IDEuMTY1LTQuNzI1IDIuMzEyLjU5OS0xLjE4IDQuNzA4IDIuODc3LjcxNiAxLjE4MS00Ljc3NWM0LjkwOC45MzEgOC42MDIuNTY2IDEwLjE1LTMuODc3IDEuMjQ3LTMuNTc2LS4wNjctNS42MjMtMi42NDYtNi45ODcgMS44OC0uNDE2IDMuMjk0LTEuNjY0IDMuNjYtNC4yMWguMDE3em0tNi41NzIgOS4yMTdjLS44ODIgMy41NzctNi45MDQgMS42My04Ljg1IDEuMTY0bDEuNTgtNi4zMzhjMS45NDYuNDk5IDguMjAyIDEuNDQ3IDcuMjcgNS4xNTd2LjAxN3ptLjg4Mi05LjI2N2MtLjc5OSAzLjI0NC01LjgyMyAxLjU5Ny03LjQzNyAxLjE5OGwxLjQzLTUuNzRjMS42MzEuNCA2Ljg1NSAxLjE2NSA2LjAwNyA0LjU0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=',
    	},
    	content: {
    		reference: v4.generateUUID(),
    	},
    	strategy: {
    		reference: v4.generateUUID(),
    		name: 'Fake strategy',
    		description: 'Fake strategy just to test',
    		creatorName: 'Fake',
    		image: 'https://previews.123rf.com/images/varijanta/varijanta1601/varijanta160100039/51306453-thin-line-flat-design-banner-of-business-and-marketing-strategy-modern-vector-illustration-concept.jpg',
    	},
    	creator: {
    		name: 'William Wallace',
    		company: 'WW Company',
    		url: 'https://en.wikipedia.org/wiki/William_Wallace',
    		walletAddress: '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9',
    	},
    	access: {
    		wallets: ['0x2767441E044aCd9bbC21a759fB0517494875092d'],
    	},
    	idea: {
    		kind: 'open',
    		asset: {
    			ticker: 'BTCUSDT',
    			description: 'BTC/USDT',
    		},
    		trade: {
    			conviction: 100,
    			direction: 'long',
    		},
    		notes: {
    			commentary: 'This trade idea was opened just to test',
    		},
    	},
    	pricing: {
    		provider: 'Binance',
    	},
    }
    
    const activ = await ActivModule.getApi()
    
    const data = await activ.createIdea(payload)
    

 
 

Adjusting Investment Ideas

  • Adjusting Inverstment Ideas

    const activ = await ActivModule.getApi()
    
    const adjustIdea = await activ.adjustIdea({
    	ticker: 'BTCUSDT',
    	strategyReference: 'c407705a-6248-451d-bc12-fb7ebb43d05b',
    	creatorWallet: '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9',
    	adjustment: {
    		kind: 'increase',
    		percentage: 20,
    	},
    	pricingCredentials: {
    		provider: 'Binance',
    		auth: {
    			key: 'your_binance_key',
    		},
    	},
    	notes: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been...',
    })
    

 
 

Closing Investment Ideas

  • Closing Investment Ideas

    const activ = await ActivModule.getApi()
    
    const closeIdea = await activ.closeIdea({
    	ticker: 'BTCUSDT',
    	strategyReference: 'c407705a-6248-451d-bc12-fb7ebb43d05b',
    	creatorWallet: '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9',
    	pricingCredentials: {
    		provider: 'Binance',
    		auth: {
    			key: 'your_binance_key',
    		},
    	},
    	notes: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been...',
    })
    

 
 

Retrieving Investment Ideas

  • Retrieve all public ideas

    const page = 1
    const limit = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.getAllPublicIdeas(page, limit)
    
  • Retrieve the ideas created by the user wallet in session (used in your browser)

    const page = 1
    const limit = 10
    const filter = ['open'] // 'open', 'adjust', 'close'
    
    const activ = await ActivModule.getApi()
    const data = await activ.getIdeasOwnedBy(page, limit, filter)
    
  • Retrieve the ideas with access by the user wallet in session (used in your browser)

    const page = 1
    const limit = 10
    const filter = ['open'] // 'open', 'adjust', 'close'
    
    const activ = await ActivModule.getApi()
    const data = await activ.getIdeasClientBy(page, limit, filter)
    
  • Retrieve ideas by strategy

    const strategyReference = 'c407705a-6248-451d-bc12-fb7ebb43d05b'
    const page = 1
    const limit = 10
    const filter = ['open'] // 'open', 'adjust', 'close'
    
    const activ = await ActivModule.getApi()
    const data = await activ.getIdeasByStrategy(
    	strategyReference,
    	page,
    	limit,
    	filter,
    )
    
  • Retrieve closed ideas history by strategy

    const activ = await ActivModule.getApi()
    
    const data = await activ.getClosedIdeasHistoryByStrategy({
    	strategyReference: 'c407705a-6248-451d-bc12-fb7ebb43d05b',
    	stages: true,
    })
    
  • Retrieve NFT content/info by ID

    const nftId = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.getIdeaByNftId(nftId)
    

 
 

Retrieving Investment Strategies

  • Retrieve all public strategies

    const page = 1
    const limit = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.getAllPublicStrategies(page, limit)
    
  • Retrieve the list of strategies created by the user wallet in session (used in your browser)

    const page = 1
    const limit = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.listMyStrategies(page, limit)
    
  • Retrieve the list of accesible strategies (strategies with permission/access)

    const page = 1
    const limit = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.listAccesibleStrategies(page, limit)
    
  • Retrieve the list of all strategies

    const page = 1
    const limit = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.listAllStrategies(page, limit)
    
  • Retrieve the list of all strategies by specific creator (wallet)

    const creatorWallet = '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9'
    const type = 'all' // 'all' | 'my' | 'accesible' | 'public',
    const page = 1
    const limit = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.listAllStrategiesByCreator(
    	creatorWallet,
    	type,
    	page,
    	limit,
    )
    
  • Retrieve strategy info

    const strategyReference = 'c407705a-6248-451d-bc12-fb7ebb43d05b'
    
    const activ = await ActivModule.getApi()
    const data = await activ.getStrategyInfoDetails(strategyReference)
    

 
 

Provider Authorization (for enabling Copy Trade)

  • Authorize Provider

    const providerAddress = '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9'
    
    const activ = await ActivModule.getApi()
    await activ.authorizeProvider(providerAddress)
    
  • Revoke Provider

    const providerAddress = '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9'
    
    const activ = await ActivModule.getApi()
    await activ.revokeProvider(providerAddress)
    
  • Check Provider Authorization

    const providerAddress = '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9'
    
    const activ = await ActivModule.getApi()
    const data = await activ.authorizeCheck(providerAddress)
    
  • Create an Idea/NFT in the name of another user (i.e. the provider can create the nft if the client used the method on: - Authorize Provider)

    const client = '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC';
    const newIdea = {...} // content used like: - Create a new Idea/NFT
    
    const activ = await ActivModule.getApi();
    const data = await activ.providerCreateIdea(client, newIdea);
    

 
 

Additional Methods

  • Retrieve wallet info details

    const userWallet = '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9'
    
    const activ = await ActivModule.getApi()
    const data = await activ.getWalletInfoDetails(userWallet)
    
  • Post mint granting of access/permission to an idea

    const nftId = 10
    const walletAddresses = ['0x023C04DB0Deb586F32444A4e154596094c52E7Da']
    
    const activ = await ActivModule.getApi()
    await activ.giveIdeaAccessTo(nftId, walletAddresses)
    
  • Retrieve wallet with access/permission to an idea

    const nftId = 10
    
    const activ = await ActivModule.getApi()
    const data = await activ.getIdeaViewers(nftId)
    
  • Search asset

    const payload = {
    	provider: 'Binance',
    	auth: {
    		key: '123',
    		secret: '456', // optional
    	},
    	params: {
    		symbol: 'BTCUSDT',
    	},
    }
    const data = await activ.getPricingAsset(payload)
    
  • Reset Cache

    // content: strategy and idea
    await activ.resetCache('idea')
    await activ.resetCache('strategy')
    
  • Retrieve estimated costs to create an NFT

    const newIdea = true
    
    const activ = await ActivModule.getApi()
    const data = await activ.getEstimatedCosts(newIdea)
    
  • Check if a wallet address is valid

    const walletAddressList = ['0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9']
    
    const activ = await ActivModule.getApi()
    const data = await activ.isValidWalletAddress(walletAddressList)
    

 
 

BRA Methods

What do I need to use the BRA methods?

To use the BRA methods you need be authorized for this reason you need generate your own apiKey, steps to get:

  1. Go here: https://ixily.io/activ/account/profile
  2. Click to the "API KEYS" section (left menu)
  3. Copy and pass in the method to call
  4. Done!

 

  • Create A New Investment Idea

    import { v4 } from '@ixily/activ'
    
    const network = 'amoy' // change as necessary
    
    const apiKey = 'your_api_key'
    
    const newIdea = {
    	public: {
    		title: 'My new idea/nft',
    		description:
    			'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been',
    		image: 'data:image/svg+xml;base64,PCEtLSBieSBUcmFkaW5nVmlldyAtLT48c3ZnIHdpZHRoPSI1NiIgaGVpZ2h0PSI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjc5MzFBIiBkPSJNMCAwaDU2djU2SDB6Ii8+PHBhdGggZD0iTTM5LjkzNiAyNC43MDRjLjUxNS0zLjQ5NC0yLjEzLTUuMzU3LTUuNzczLTYuNjIybDEuMTgtNC43MDgtMi44NzctLjcxNi0xLjE0OCA0LjU5Mi0yLjI5Ni0uNTQ5IDEuMTY0LTQuNjI1LTIuODc4LS43MTUtMS4xODEgNC43MjUtMS44My0uNDMzdi0uMDE2bC0zLjk3Ni0uOTk5LS43NjYgMy4wNzhzMi4xMy41IDIuMDk2LjUxNmMxLjE2NS4zIDEuMzY1IDEuMDY1IDEuMzMyIDEuNjY0bC0xLjMzMiA1LjM5LjMuMS0uMzE2LS4wNjctMS44OCA3LjUzN2MtLjEzMy4zNS0uNS44ODItMS4zMTQuNjY1LjAzMy4wNS0yLjA4LS40OTktMi4wOC0uNDk5bC0xLjQzIDMuMjc4IDMuNzQzLjkzMSAyLjA0Ni41MzMtMS4xOTggNC43NzUgMi44NzguNzE1IDEuMTY1LTQuNzI1IDIuMzEyLjU5OS0xLjE4IDQuNzA4IDIuODc3LjcxNiAxLjE4MS00Ljc3NWM0LjkwOC45MzEgOC42MDIuNTY2IDEwLjE1LTMuODc3IDEuMjQ3LTMuNTc2LS4wNjctNS42MjMtMi42NDYtNi45ODcgMS44OC0uNDE2IDMuMjk0LTEuNjY0IDMuNjYtNC4yMWguMDE3em0tNi41NzIgOS4yMTdjLS44ODIgMy41NzctNi45MDQgMS42My04Ljg1IDEuMTY0bDEuNTgtNi4zMzhjMS45NDYuNDk5IDguMjAyIDEuNDQ3IDcuMjcgNS4xNTd2LjAxN3ptLjg4Mi05LjI2N2MtLjc5OSAzLjI0NC01LjgyMyAxLjU5Ny03LjQzNyAxLjE5OGwxLjQzLTUuNzRjMS42MzEuNCA2Ljg1NSAxLjE2NSA2LjAwNyA0LjU0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=',
    	},
    	content: {
    		reference: v4.generateUUID(),
    	},
    	strategy: {
    		reference: v4.generateUUID(),
    		name: 'Fake strategy',
    		description: 'Fake strategy just to test',
    		creatorName: 'Fake',
    		image: 'https://previews.123rf.com/images/varijanta/varijanta1601/varijanta160100039/51306453-thin-line-flat-design-banner-of-business-and-marketing-strategy-modern-vector-illustration-concept.jpg',
    	},
    	creator: {
    		name: 'William Wallace',
    		company: 'WW Company',
    		url: 'https://en.wikipedia.org/wiki/William_Wallace',
    		walletAddress: '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9',
    	},
    	access: {
    		wallets: ['0x2767441E044aCd9bbC21a759fB0517494875092d'],
    	},
    	idea: {
    		kind: 'open',
    		asset: {
    			ticker: 'BTCUSDT',
    			description: 'BTC/USDT',
    		},
    		trade: {
    			conviction: 100,
    			direction: 'long',
    		},
    		notes: {
    			commentary: 'This trade idea was opened just to test',
    		},
    	},
    	pricing: {
    		provider: 'Binance',
    	},
    }
    
    const activ = await ActivModule.getApi()
    
    const data = await activ.createIdeaFromFiatMint(payload, apiKey)
    
  • Adjusting Inverstment Ideas

    const activ = await ActivModule.getApi();
    
    const apiKey = 'your_api_key';
    
    const adjustIdea = await activ.adjustIdeaFromFiatMint(
      {
        ticker: 'BTCUSDT',
        strategyReference: 'c407705a-6248-451d-bc12-fb7ebb43d05b',
        creatorWallet: '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9',
        adjustment: {
          kind: 'increase',
          percentage: 20
        },
        pricingCredentials: {
          provider: 'Binance',
          auth: {
            key: 'your_binance_key',
          }
        },
        notes: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been...',
      },
      apiKey
    });
    
  • Closing Investment Ideas

    const activ = await ActivModule.getApi();
    
    const apiKey = 'your_api_key';
    
    const closeIdea = await activ.closeIdeaFromFiatMint(
      {
        ticker: 'BTCUSDT',
        strategyReference: 'c407705a-6248-451d-bc12-fb7ebb43d05b',
        creatorWallet: '0xaB31A127b112CcF2e97fC54A842A6a3b7070BEa9',
        pricingCredentials: {
          provider: 'Binance',
          auth: {
            key: 'your_binance_key',
          }
        },
        notes: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been...',
      },
      apiKey
    });
    

 
 

License

ACTIV is licensed under the MIT license. Open Sans is licensed under the Apache license

Keywords

FAQs

Package last updated on 05 Jul 2024

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