TypeScript SDK for interacting with ITEM smart contracts, tokenized asset contracts, and ITEM authentication workflows on Neo N3.
- Developer portal: docs.item.systems
- SDK docs: docs.item.systems/sdk/ts
- Local API docs: run
npm run docs - Docs index: docs-src/DOCS_INDEX.md
- Workflow playbooks
- Architecture, data model, and lifecycle
- Authentication
- Tokenized asset contract workflows
- Troubleshooting and error handling
- Security and production integration guidance
- Environments, compatibility, and setup
- API overview
- Utils
- Examples
npm install @item-systems/itemThe SDK centers on the Item class, which wraps the ITEM contract and related tokenized asset contract workflows.
It supports:
- contract initialization against Neo N3
- read and write operations for users, items, epochs, configurations, and assets
- item binding and locking workflows
- ITEM authentication and validation flows
- tokenized asset contract helpers such as
ownerOf,claimItem,itemsOf, and token property lookups - utility helpers for transaction polling, NDEF decoding, key handling, and deployment support
- smartcard helpers and transports for card-oriented integrations
The repository now separates tests by execution intent:
npm test/npm run test:unit: deterministic default suite used for local validation and CI.npm run test:integration: environment-backed ITEM workflow tests undertests/integration/**. These require configured.envvalues and may interact with live services or mutate state.npm run test:manual: manual or hardware-backed tests undertests/manual/**. Some specs require explicit opt-in flags such asRUN_SMARTCARD_MANUAL=1.npm run test:all: runs all tiers in sequence.
Contributors should keep new fast, deterministic coverage in the default unit suite and place live, stateful, or hardware-dependent tests in the explicit integration/manual tiers.
Item cannot be constructed with new Item(). Use await Item.init(...).
import { Item, constants } from '@item-systems/item'
const item = await Item.init({
node: constants.NeoN3NetworkOptions.MainNet,
})
const totalItems = await item.totalItems()
console.log({ totalItems })
const nfi = await item.getItem({ localNfid: 1 })
console.log(nfi)Write operations require a signer account that is authorized for the target contract action.
import { Item, constants } from '@item-systems/item'
import { wallet } from '@cityofzion/neon-js'
const account = new wallet.Account(process.env.NEO_PRIVATE_KEY!)
const item = await Item.init({
node: constants.NeoN3NetworkOptions.TestNet,
account,
})
const txid = await item.setItemProperty({
localNfid: 1,
globalPid: '01',
state: '01',
})
console.log({ txid })Item.init accepts ConstructorOptions:
node?: string— RPC endpoint. Defaults to ITEM mainnet RPC.scriptHash?: string— ITEM contract script hash. Defaults to the package's canonical deployment.invoker?: Neo3Invoker— custom invoker if you already manage invocation/signing externally.listener?: Neo3EventListener— custom event listener for transaction completion.parser?: Neo3Parser— custom parser. Defaults toNeonParser.account?: wallet.Account— signer used by the default invoker for state-changing methods.
If you do not pass invoker or listener, the SDK creates Neon-based defaults.
import { constants } from '@item-systems/item'
constants.NeoN3NetworkOptions.LocalNet
constants.NeoN3NetworkOptions.TestNet
constants.NeoN3NetworkOptions.MainNetUse this when your app already owns wallet/session state.
import { Item } from '@item-systems/item'
import { NeonEventListener, NeonInvoker, NeonParser } from '@cityofzion/neon-dappkit'
const invoker = await NeonInvoker.init({
rpcAddress: 'https://testnet1.neo.coz.io:443',
account,
})
const listener = new NeonEventListener('https://testnet1.neo.coz.io:443')
const item = await Item.init({
scriptHash: '0x3491b358a9ddce38cb567e2bb8bd1bf783cd556d',
node: 'https://testnet1.neo.coz.io:443',
invoker,
listener,
parser: NeonParser,
})The SDK uses two patterns for state-changing methods:
-
Async submission methods such as
createItem,bindItem,authItem,claimItem- submit a transaction
- return a transaction id (
txid)
-
*Syncmethods such ascreateItemSync,bindItemSync,authItemSync- submit the transaction
- wait for the application log
- parse and return the contract result
Examples:
const txid = await item.createConfiguration()
const log = await Utils.transactionCompletion(txid, {
node: constants.NeoN3NetworkOptions.TestNet,
timeout: 30_000,
})
const localCid = await item.createConfigurationSync()Use the async form when your app already has its own transaction tracking pipeline. Use the *Sync form when you want the SDK to wait and parse the result for you.
Read:
getUsergetUserWithAddressgetUserPropertiestotalUsers
Write:
createUsersetUserPropertysetUserPropertySync
Read:
totalItemsgetItemgetItemWithKeygetItemWithTacgetItemProperties
Write / lifecycle:
createItemcreateItemSyncsetItemPropertysetItemPropertySyncbindItembindItemSynclockItemlockItemSyncpurgeItempurgeItemSync
Authentication:
authItemauthItemSyncisAuthValid
Read:
getEpochgetEpochItemsgetEpochPropertiestotalEpochs
Write:
setEpochPropertysetEpochPropertySync
Read:
getConfigurationgetConfigurationPropertiesgetConfigurationAssetstotalConfigurations
Write:
createConfigurationcreateConfigurationSyncsetConfigurationPropertysetConfigurationPropertySync
Read:
getAssetgetAssetWithKeygetAssetBurnLogtotalAssets
These methods bridge from ITEM records to the bound tokenized asset contract:
tokenPropertiestokenPropertiesWithNfiditemsOfisClaimableisClaimableWithNfidclaimItemclaimItemSyncownerOf
updateupdateSync
const itemRecord = await item.getItem({ localNfid: 42 })
console.log(itemRecord.binding_token_id)
console.log(itemRecord.epoch.binding_script_hash)Note: placeholder values below are illustrative only. Replace them with real public keys, auth payloads, script hashes, and accounts from your environment.
const itemRecord = await item.getItemWithKey({
pubKey: '03abc123...',
})import { types } from '@item-systems/item'
const auth = {
message: '00112233',
proof: 'aabbccdd',
challenge: types.AuthChallenge.ILS_PERMISSIVE,
}
const validation = await item.isAuthValid({
localNfid: 42,
auth,
})
console.log(validation.valid)const ok = await item.claimItemSync({
pubKey: '03abc123...',
auth,
receiverAccount: 'NXYZ...',
})
console.log(ok)See examples/README.md for small runnable reference snippets.
If you are building a real integration, read these before shipping:
- Workflow playbooks
- Troubleshooting and error handling
- Security and production integration guidance
- Environments, compatibility, and setup
npm run tsc
npm test
npm run docs