The AlphaCapture Protocol is currently in the process of being upgraded to use the Lit Protocol Mainnet (Habanero).
The AlphaCapture Protocol (previously IXily) SDK allows the creation and retrieval of Investment Ideas and Strategies, together with supporting methods for Access Control.
There are two SDKs, one intended for server side use such as algorithmic creation of ideas and a second for use in dApps, primarily for the display of ideas.
Please ensure Node >v18.x.x installed.
Install the AlphaCapture SDK
npm i @ixily/activ
npm i @ixily/activ-web
Install External Dependencies (Required)
Lit Protocol
Lit Protocol is used for Investment Idea NFT encryption/decryption and access control. See more at
npm i @lit-protocol/lit-node-client-nodejs@2.1.123
SIWE (Sign In With Ethereum)
npm i siwe
JIMP (Javascript Image Manipulation)
JIMP is used to support the processing of images that are associated with the creator's profile and/or with the asset created.
npm i jimp
Initial Setup
Import the required libraries.
import { CacheNodeStorageModule, LitNodeProviderModule } from "@ixily/activ/dist/sdk";
import {
SDK,
CONTRACT,
} from "@ixily/activ";
import v4 = SDK.v4;
import CI = CONTRACT.CONTRACT_INTERFACES;
import { EnvModule } from "@ixily/activ/dist/sdk/activ-v4";
export type NetworkType = 'amoy' | 'polygon';
const {ActivV4Module} = v4;
const activ = ActivV4Module;
Configure Keys
Wallet
Please specify the wallet to create Investment Ideas (or that which has access to Ideas) and ensure it is sufficiently funded if creating Ideas (with MATIC).
const PRIVATE_KEY = 'your_private_wallet_key';
IPFS Storage
Supplementary Investment Idea data, such as detailed pricing data, is stored on IPFS. Please provide your own key to store the data.
const nftStorageKey = 'your_nft_storage_key';
Configure Chain
Currently the Polygon (PoS) Mainnet and Amoy Testnet are supported.
Requesting content directly from chain can be slow, particularly as Ideas need to be decrypted. There are several options to cache data using standard tools such as Redis. If you are considering implementing a cache, please contact us for further details.
Initialise SDK
export const getActiv = async (
network: NetworkType = 'polygon'
): Promise<typeof activ> => {
if (!state.configured[network]) {
const initObj = {
LitJsSdkInstance: LitJsSdk,
SiweInstance: Siwe,
backendWalletPrivateKey: '',
}
// 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 as any).configured[network] = true;
(state as any).instance[network] = activ;
(state as any).privateKey[network] = initObj.backendWalletPrivateKey;
};
const networkChainObj = {
amoy: 'amoy',
polygon: 'polygon',
};
await activ.selectChainContract(networkChainObj[network], 'v4', {
userWalletPrivateKey: state.privateKey[network],
})
return activ
}
Ready to go...
You should now be able to connect to a network and view the SDK contract.