Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@abstract-money/core
Advanced tools
This repository holds the type declarations and interfaces for our smart contracts in CosmWasm. Autogenerated contracts lie in generated and those that are "fixed" are placed in src/contracts.
pnpm build
: Generate the typespnpm fix
: Temporary fixes for the autogenerated contracts (TODO)pnpm format
: Run prettierpnpm lint
: Run linterpnpm lint:fix
: Attempt linter fixespnpm install @abstract-money/core
AbstractQueryClient
for the chain on which you're using Abstract.import { AbstractQueryClient } from '@abstract-money/core'
const CHAIN_NAME = "juno"
const getAbstract = async () => {
const abstractQueryClient = await AbtsractQueryClient.connectToChain(CHAIN_NAME)
}
pnpm install graphql-request@5
To allow for strongly-typing the schemas, we recommend setting up code generation.
See https://www.apollographql.com/docs/ios/code-generation/codegen-configuration/ for alternative options.
The following uses the-guild's graphql codegen as a typescript preset. See https://the-guild.dev/graphql/codegen/plugins/presets/preset-client for client options.
pnpm install -D @graphql-codegen/cli @graphql-codegen/client-preset @graphql-typed-document-node/core
codegen.yml
. This allows for auto type generation.
Seeschema: "<API_URL>" # This can be the API URL or the schema document
documents: ['./src/**/*.{tsx,ts}', '!src/__generated__/gql/**/*']
generates:
./src/__generated__/gql/:
preset: client
presetConfig:
gqlTagName: gql
immutableTypes: true
config:
immutableTypes: true
useTypeImports: true
scalars:
# Temporarily map to any, see DAT-16
JSON: any
Semver: string
Bech32Address: string
SafeInt: number
codegen
command to package.json
{
"scripts": {
"codegen": "graphql-codegen --config codegen.yml",
"codegen:watch": "graphql-codegen --config codegen.yml --watch"
}
}
NOTE: The first time you generate the types you will not import gql
from the generated folder, rather just including the string in the file!
The following example shows how to query the Abstract API for the value of a given account.
import { gql } from '__generated__/gql'
import { type AccountValueQuery } from '__generated__/gql/graphql'
import { AbstractAccountId, abstractApiRequest } from '@abstract-money/core'
const accountValueQuery = gql(/* GraphQL */ `
query AccountValue($accountId: AccountIdInput!, $chain: ID!) {
account(chain: $chain, accountId: $accountId) {
vault {
baseAsset
value
}
}
}
`)
const CHAIN_NAME = "juno"
const getAccountValue = async (accountId: AbstractAccountId) => {
// This type is auto-generated and inferred by graphql-codegen, we are typing it for exemplary purposes
const result: AccountValueQuery = await abstractApiRequest(
accountValueQuery,
// query variables are also strongly-typed!
{
chain: CHAIN_NAME,
accountId: accountId.toApi(),
}
)
return result.account.value
}
We recommend installing the graphql plugins for the ides, where you can also include a link to the Abstract API URL for auto recognition of the schemas.
FAQs
Typings for Abstract smart contracts
The npm package @abstract-money/core receives a total of 18 weekly downloads. As such, @abstract-money/core popularity was classified as not popular.
We found that @abstract-money/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.