.md

sl.contracts

Find contracts that conform to a trait, or get one from the registry by id.

@secondlayer/sdk@15.5.02 methodsfrom source with openpkgIndex guide
list(params)ContractsEnvelopeFind contracts conforming to trait.
get(contractId, opts)ContractSummary | nullGet one contract from the registry by id, or null.

sl.contracts.list(params)

REST GET /v1/contractssource

Find contracts conforming to trait. trait is required (server 400s without it).

sl.contracts.list(params: ContractsListParams): Promise<ContractsEnvelope>

Parameters

hover a row to find it in the code

Required

traitrequiredstringRequired. Trait identifier to match (e.g. "sip-010", or a fully-qualified trait).

Options

conformanceContractConformanceMatch source. Defaults to "any" server-side.
include"abi"Set to "abi" to include the full ABI blob in each row.
limitnumberPage size, 1–500 (default 100 server-side).
cursorstringOpaque cursor from a prior response's next_cursor.
Returns Promise<ContractsEnvelope>
contracts
ContractSummary[]
next_cursor
string | null

Get one contract from the registry by id, or null.

The prod-safe ABI source. Pass { includeAbi: true } for the full ABI blob. Resolves to null on 404.

sl.contracts.get(
contractId: string,
opts?: { includeAbi?: boolean },
): Promise<ContractSummary | null>

Parameters

hover a row to find it in the code

Required

contractIdrequiredstring

Options

opts.includeAbiboolean
Returns Promise<ContractSummary | null>
contract_id
string
deployer
string
block_height
number
declared_traits
string[] | null
inferred_standards
string[] | null
abi_status
string
abi
Present only when include: "abi" was requested.
ContractConformance
Whether a trait match must be declared in source, inferred from ABI, or either.
ContractsEnvelope
One page of contracts and the cursor for the next page.
ContractsListParams
Trait, conformance, and paging for listing contracts.
ContractSummary
A deployed contract with its traits, standards, and ABI status.
Edit on GitHub