Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
verto-cace-interface
Advanced tools
A communication package with Verto Cache System
Install with npm:
$ npm install verto-cace-interface
Signature:
fetchContract<T = any>(contractId: string, withValidity?: boolean, dontThrow?: boolean): Promise<StateResult<T> | undefined>
Parameters:
T: Interface of the contract state to be returned
contractId: Contract to be fetched
withValidity: Whether validity should be fetched (Default: false)
dontThrow: Whether it should not throw an error if contract is not found (Default: false)
Usage:
import { fetchContract } from 'verto-cace-interface';
fetchContract('t9T7DIOGxx4VWXoCEeYYarFYeERTpWIC1V3y-BPZgKE').then((result) => {
const state = result.state;
const validity = result.validity;
})
Signature:
fetchBalanceByUserAddress = async (contractId: string, userAddress: string): Promise<UserBalance | undefined>
Parameters: contractId: Contract to be fetched userAddress: Address to obtain balance from
Usage:
import { fetchBalanceByUserAddress } from 'verto-cace-interface';
fetchBalanceByUserAddress('bQGRi3eO4p7S583mYYXDeVn5EvGPFMiMWd5WBWatteY', 'vxUdiv2fGHMiIoek5E4l3M5qSuKCZtSaOBYjMRc94JU').then((result) => {
const contractId = result.contractId;
const contractName = result.name;
const contractTicker = result.ticker;
const contractLogo = result.logo;
const userBalance = result.balance;
const userAddress = result.userAddress;
const contractType = result.type;
})
Signature:
fetchBalancesForAddress = async (userAddress: string, tokenType?: string): Promise<Array<UserBalance>>
Parameters: userAddress: Address to obtain balance from tokenType: Type to filter balances from, for example: 'art'.
Usage:
import { fetchBalancesForAddress } from 'verto-cace-interface';
fetchBalancesForAddress('vxUdiv2fGHMiIoek5E4l3M5qSuKCZtSaOBYjMRc94JU').then((result) => {
const balances: Array<UserBalance> = result;
})
Signature:
fetchBalancesByUsername = async (username: string, tokenType?: string): Promise<Array<UserBalance> | undefined>
Parameters: username: Username to fetch balances from. tokenType: Type to filter balances from, for example: 'art'.
Usage:
import { fetchBalancesByUsername } from 'verto-cace-interface';
fetchBalancesByUsername('t8').then((result) => {
const balances: Array<UserBalance> = result;
balances.forEach((balance) => {
console.log('Contract Id ', balance.contractId);
console.log('Balance ', balance.balance);
})
})
Signature:
fetchBalancesInContract = async (contractId: string): Promise<BalanceAndContract>
Parameters: contractId: Contract to be fetched
Usage:
import { fetchBalancesInContract } from 'verto-cace-interface';
fetchBalancesInContract('bQGRi3eO4p7S583mYYXDeVn5EvGPFMiMWd5WBWatteY').then((result) => {
const balances: BalanceAndContract = result;
const [balancesObject, contractMetadata] = balances;
const balanceForAddress = balancesObject['vxUdiv2fGHMiIoek5E4l3M5qSuKCZtSaOBYjMRc94JU'];
const contractTicker = contractMetadata.ticker;
})
Signature:
fetchCollectionById = async (collectionId: string): Promise<CollectionResult | undefined>
Parameters: collectionId: Collection (contract) to be fetched
Usage:
import { fetchCollectionById } from 'verto-cace-interface';
fetchCollectionById('GirFtyB_PI4oQXhEFrHZLpFUqincHrDdDxPaQ1M8r00').then((result) => {
const id = result.id;
const collectionName = result.name;
const description = result.description;
const owner = result.owner;
const collaborators = result.collaborators;
const items = result.items;
})
Signature:
fetchContractsInUser = async (addressId: string): Promise<Array<string>>
Parameters: addressId: Address to obtain related-contracts from
Usage:
import { fetchContractsInUser } from 'verto-cace-interface';
fetchContractsInUser('vxUdiv2fGHMiIoek5E4l3M5qSuKCZtSaOBYjMRc94JU').then((result) => {
// Contract Ids
const relatedContractsToUser: Array<string> = result;
})
Signature:
fetchOwnershipByUsername = async (username: string): Promise<Array<string>>
Parameters: username: Username to fetch ownership from
Usage:
import { fetchOwnershipByUsername } from 'verto-cace-interface';
fetchOwnershipByUsername('t8').then((result) => {
// Contract Ids
const tokensCreatedByUser: Array<string> = result;
})
Signature:
fetchTokenMetadata = async (tokenId: string, fromContract?: boolean): Promise<TokenMetadata | undefined>
Parameters: tokenId: Token (contract) id to fetch metadata from fromContract: Whether it should be fetched from the Google CDN or Verto Database (Default: False)
Usage:
import { fetchTokenMetadata } from 'verto-cace-interface';
fetchTokenMetadata('bQGRi3eO4p7S583mYYXDeVn5EvGPFMiMWd5WBWatteY').then((result) => {
const id = result.id;
const type = result.type;
const listerUsername = result.lister;
})
Signature:
fetchTokenStateMetadata = async (tokenId: string): Promise<TokenStateMetadata | undefined>
Parameters: tokenId: Token (contract) id to fetch metadata from
Usage:
import { fetchTokenStateMetadata } from 'verto-cace-interface';
fetchTokenStateMetadata('bQGRi3eO4p7S583mYYXDeVn5EvGPFMiMWd5WBWatteY').then((result) => {
const id = result.id;
const tokenName = result.name;
const owner = result.owner;
const ticker = result.ticker;
})
Signature:
fetchTokens = async (specificType?: string): Promise<Array<TokenMetadata>>
Parameters: specificType: Whether to filter tokens with a specific type
Usage:
import { fetchTokens } from 'verto-cace-interface';
fetchTokens().then((result) => {
const allTokens: Array<TokenMetadata> = result;
allTokens.forEach((item) => {
console.log('Id ', item.id);
console.log('Type ', item.type);
console.log('Lister ', item.lister);
});
})
Signature:
fetchRandomArtwork = async (limit: number = 4): Promise<RandomArtworkResult>
Parameters: limit: Maximum number of artwork to be fetched (Default: 4)
Usage:
import { fetchRandomArtwork } from 'verto-cace-interface';
fetchRandomArtwork().then((result) => {
const artwork: Array<TokenMetadata> = result.entities;
artwork.forEach((item) => {
console.log('Lister', item.lister);
console.log('Type', item.type);
console.log('Contract ID', item.contractId);
});
})
Signature:
fetchUserCreations = async (username: string): Promise<Array<string>>
Parameters: username: Username to fetch creations from
Usage:
import { fetchUserCreations } from 'verto-cace-interface';
fetchUserCreations('t8').then((result) => {
// Contract Ids
const creations: Array<string> = result;
})
Signature:
fetchUserMetadataByUsername = async (username: string): Promise<UserMetadata | undefined>
Parameters: username: Username to fetch metadata from
Usage:
import { fetchUserMetadataByUsername } from 'verto-cace-interface';
fetchUserMetadataByUsername('t8').then((result) => {
const username = result.username;
const addresses: Array<string> = result.addresses;
})
Signature:
fetchUsers = async (): Promise<Array<CommunityContractPeople>>
Usage:
import { fetchUsers } from 'verto-cace-interface';
fetchUsers().then((result) => {
result.forEach((user) => {
console.log('Username ', user.username);
console.log('Name ', user.name);
console.log('Addresses ', user.addresses);
console.log('Image ', user.image);
console.log('Bio ', user.bio);
console.log('Links ', user.links);
})
})
Hooks are a way to invoke functions and then invoke certain behaviors inside the cache system.
cacheContractHook
Signature:
cacheContractHook = async (action: () => Promise<any> | any, contractId?: string, refreshCommunityContract?: boolean)
Parameters:
action: Action to be called inside before executing the hook
contractId: Contract to be cached right after action
has finished its execution
refreshCommunityContract: Whether the community contract should be updated after action
has finished its execution
Usage:
import { cacheContractHook } from 'verto-cace-interface';
const currentContract: string = 'ABCD1234'
const executeOrder = await cacheContractHook(async () => {
// Execute an order inside the exchange
// Or do something different, maybe buy a car.
return 'ORDER_SENT';
}, currentContract, true);
assert(executeOrder === 'ORDER_SENT');
Lifecycle:
action
(if asynchronous, it will be awaited)contractId
refreshCommunityContract
is true
, call Cache API to invoke caching of community contractFAQs
A communication package with Verto Cache System
We found that verto-cace-interface demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.