Connection status of the RPC URL
Broadcasts a transaction for execution.
The validity data of the transaction
The demos instance
The response from the node
Broadcast a confirmed transaction and wait for inclusion.
Polls the node's getTransactionStatus RPC until the tx is observed
included or failed, or until opts.timeoutMs elapses (default 60s).
Use this when you want a single call with a deterministic outcome.
Use plain broadcast() when you want to handle async confirmation
yourself.
On timeout, throws BroadcastTimeoutError carrying the tx hash,
the last observed state, and the elapsed time so the caller can
resume polling.
When opts.failFastOnBroadcastError is true, also throws
BroadcastFailedError synchronously when the broadcast itself can't
reach the node (e.g., ECONNREFUSED, ENOTFOUND). HTTP 5xx responses
are NOT considered fail-fast cases - the server did answer, so the
tx may still have landed and polling should run. Defaults to false
for one release to preserve current callers' behavior.
The validity data of the transaction (from confirm)
The demos instance
Optionalopts: { OptionalfailIf true, throw BroadcastFailedError
immediately when the broadcast can't contact the node. Defaults to false.
OptionalpollDelay between status polls. Defaults to 500.
OptionaltimeoutTotal time to wait for inclusion. Defaults to 60_000.
The original broadcast response and the terminal status.
Confirms a transaction.
The transaction to confirm
The validity data of the transaction containing the gas information.
Signs a transaction after hashing its content.
The transaction to be signed.
The keypair to use for signing.
A Promise that resolves to the signed transaction.
Signs a message with a given algorithm.
The message to sign.
The keypair to use for signing.
The algorithm related to the keypair.
A Promise that resolves to the signed message.
Convert a legacy DEM number input to an OS bigint for internal
carrying. Only whole-DEM number inputs are accepted on this
legacy path — fractional DEM is rejected with a clear error
directing callers to the bigint OS path (denomination.demToOs).
Rationale: silently flooring (the previous behaviour) discarded up
to ~10^9 OS per call without warning. The migration period
tolerates legacy number callers, but only at exact DEM
granularity — anything sub-DEM must come in as bigint so the
caller has explicitly opted into OS arithmetic.
Create a signed L2PS hash update transaction for DTR relay to validators.
L2PS hash updates are self-directed transactions that carry consolidated hash information representing multiple L2PS transactions. These transactions are automatically relayed to validators via DTR (Distributed Transaction Routing) to enable consensus on L2PS network activity without exposing transaction content.
The unique identifier of the L2PS network
SHA-256 hash representing all L2PS transactions
Number of transactions included in this hash update
The demos instance (for getting the address nonce)
The signed L2PS hash update transaction
Create a signed DEMOS transaction to send native tokens to a given address.
P4 dual-input:
bigint: OS amount (preferred — 1 DEM = 10^9 OS).number: DEM amount (legacy, deprecated). Auto-converted to OS.Internal carrier in tx.content.amount is bigint OS; the
serializerGate (run from demos.sign) emits the right wire shape
per the connected node's fork status.
The reciever
DEM number (legacy) or OS bigint.
The demos instance (for getting the address nonce)
The signed transaction.
Create a signed networkUpgrade proposal transaction.
Only active validators may propose. The node rejects proposals whose
proposedParameters violate safety bounds (≤50% change, absolute
floor/ceiling) or overlap keys with other pending/activating proposals.
Activation block. Must be ≥ tallyBlock + grace period.
UUID. Also used as lexicographic activation-order tiebreaker.
Subset of NetworkParameters to change.
Human-readable reason, ≤1024 bytes.
Create a signed validatorStake transaction. Used both for initial
validator registration and to top up an existing stake.
Stake amount in base-unit DEMOS, encoded as a bigint string.
Validator's public endpoint (required on first stake; subsequent top-ups may overwrite it).
The demos instance (for nonce + signing).
Create a signed DEMOS transaction to store binary data on the blockchain. Data is stored in the sender's account.
The binary data to store (will be base64-encoded)
The demos instance (for getting the address nonce)
The signed storage transaction.
Create a signed DEMOS transaction to send native tokens to a given address.
Alias of pay. Same dual-input semantics — bigint OS
preferred, number DEM accepted as the deprecated path.
The reciever
DEM number (legacy) or OS bigint.
The demos instance (for getting the address nonce)
The signed transaction.
Create a signed validatorUnstake transaction. Arms the unstake lock
period; after UNSTAKE_LOCK_BLOCKS have elapsed the validator may call
validatorExit.
Create a signed validatorExit transaction. Only accepted by the
network once unstake_available_at <= currentBlock.
Create a signed networkUpgradeVote transaction.
The voter must be in the validator snapshot taken at the proposal's confirmation block, and may cast exactly one vote per proposal (final, non-revocable).
Get a cost quote for an IPFS operation without submitting a transaction.
Use this to estimate costs and populate custom_charges before signing.
Pipe the response through IPFSOperations.quoteToCustomCharges
(or createCustomCharges) to obtain a max_cost_os decimal-string
suitable for the transaction's custom_charges.ipfs.max_cost_os
field. The helpers handle both pre-fork (cost_dem) and
post-fork (cost_os) node response shapes.
Size of file in bytes
IPFS operation type ('IPFS_ADD', 'IPFS_PIN', or 'IPFS_UNPIN')
OptionaldurationBlocks: numberOptional duration in blocks (for PIN operations)
Cost quote with detailed breakdown
Reads a storage program by address.
The address of the storage program to read
The response from the node
Creates and signs a storage program transaction given a payload.
The payload to sign
The signed transaction
Broadcasts a transaction for execution.
The validity data of the transaction
The demos instance
The response from the node
Broadcast a confirmed transaction and wait for inclusion.
Polls the node's getTransactionStatus RPC until the tx is observed
included or failed, or until opts.timeoutMs elapses (default 60s).
Use this when you want a single call with a deterministic outcome.
Use plain broadcast() when you want to handle async confirmation
yourself.
On timeout, throws BroadcastTimeoutError carrying the tx hash,
the last observed state, and the elapsed time so the caller can
resume polling.
When opts.failFastOnBroadcastError is true, also throws
BroadcastFailedError synchronously when the broadcast itself can't
reach the node (e.g., ECONNREFUSED, ENOTFOUND). HTTP 5xx responses
are NOT considered fail-fast cases - the server did answer, so the
tx may still have landed and polling should run. Defaults to false
for one release to preserve current callers' behavior.
The validity data of the transaction (from confirm)
The demos instance
Optionalopts: { OptionalfailIf true, throw BroadcastFailedError
immediately when the broadcast can't contact the node. Defaults to false.
OptionalpollDelay between status polls. Defaults to 500.
OptionaltimeoutTotal time to wait for inclusion. Defaults to 60_000.
The original broadcast response and the terminal status.
Confirms a transaction.
The transaction to confirm
The validity data of the transaction containing the gas information.
Signs a transaction after hashing its content.
The transaction to be signed.
The keypair to use for signing.
A Promise that resolves to the signed transaction.
Signs a message with a given algorithm.
The message to sign.
The keypair to use for signing.
The algorithm related to the keypair.
A Promise that resolves to the signed message.
Convert a legacy DEM number input to an OS bigint for internal
carrying. Only whole-DEM number inputs are accepted on this
legacy path — fractional DEM is rejected with a clear error
directing callers to the bigint OS path (denomination.demToOs).
Rationale: silently flooring (the previous behaviour) discarded up
to ~10^9 OS per call without warning. The migration period
tolerates legacy number callers, but only at exact DEM
granularity — anything sub-DEM must come in as bigint so the
caller has explicitly opted into OS arithmetic.
Create a signed L2PS hash update transaction for DTR relay to validators.
L2PS hash updates are self-directed transactions that carry consolidated hash information representing multiple L2PS transactions. These transactions are automatically relayed to validators via DTR (Distributed Transaction Routing) to enable consensus on L2PS network activity without exposing transaction content.
The unique identifier of the L2PS network
SHA-256 hash representing all L2PS transactions
Number of transactions included in this hash update
The demos instance (for getting the address nonce)
The signed L2PS hash update transaction
Create a signed DEMOS transaction to send native tokens to a given address.
P4 dual-input:
bigint: OS amount (preferred — 1 DEM = 10^9 OS).number: DEM amount (legacy, deprecated). Auto-converted to OS.Internal carrier in tx.content.amount is bigint OS; the
serializerGate (run from demos.sign) emits the right wire shape
per the connected node's fork status.
The reciever
DEM number (legacy) or OS bigint.
The demos instance (for getting the address nonce)
The signed transaction.
Create a signed networkUpgrade proposal transaction.
Only active validators may propose. The node rejects proposals whose
proposedParameters violate safety bounds (≤50% change, absolute
floor/ceiling) or overlap keys with other pending/activating proposals.
Activation block. Must be ≥ tallyBlock + grace period.
UUID. Also used as lexicographic activation-order tiebreaker.
Subset of NetworkParameters to change.
Human-readable reason, ≤1024 bytes.
Create a signed validatorStake transaction. Used both for initial
validator registration and to top up an existing stake.
Stake amount in base-unit DEMOS, encoded as a bigint string.
Validator's public endpoint (required on first stake; subsequent top-ups may overwrite it).
The demos instance (for nonce + signing).
Create a signed DEMOS transaction to store binary data on the blockchain. Data is stored in the sender's account.
The binary data to store (will be base64-encoded)
The demos instance (for getting the address nonce)
The signed storage transaction.
Create a signed DEMOS transaction to send native tokens to a given address.
Alias of pay. Same dual-input semantics — bigint OS
preferred, number DEM accepted as the deprecated path.
The reciever
DEM number (legacy) or OS bigint.
The demos instance (for getting the address nonce)
The signed transaction.
Create a signed validatorUnstake transaction. Arms the unstake lock
period; after UNSTAKE_LOCK_BLOCKS have elapsed the validator may call
validatorExit.
Create a signed validatorExit transaction. Only accepted by the
network once unstake_available_at <= currentBlock.
Create a signed networkUpgradeVote transaction.
The voter must be in the validator snapshot taken at the proposal's confirmation block, and may cast exactly one vote per proposal (final, non-revocable).
Broadcasts a transaction for execution.
The validity data of the transaction
The demos instance
The response from the node
Broadcast a confirmed transaction and wait for inclusion.
Polls the node's getTransactionStatus RPC until the tx is observed
included or failed, or until opts.timeoutMs elapses (default 60s).
Use this when you want a single call with a deterministic outcome.
Use plain broadcast() when you want to handle async confirmation
yourself.
On timeout, throws BroadcastTimeoutError carrying the tx hash,
the last observed state, and the elapsed time so the caller can
resume polling.
When opts.failFastOnBroadcastError is true, also throws
BroadcastFailedError synchronously when the broadcast itself can't
reach the node (e.g., ECONNREFUSED, ENOTFOUND). HTTP 5xx responses
are NOT considered fail-fast cases - the server did answer, so the
tx may still have landed and polling should run. Defaults to false
for one release to preserve current callers' behavior.
The validity data of the transaction (from confirm)
The demos instance
Optionalopts: { OptionalfailIf true, throw BroadcastFailedError
immediately when the broadcast can't contact the node. Defaults to false.
OptionalpollDelay between status polls. Defaults to 500.
OptionaltimeoutTotal time to wait for inclusion. Defaults to 60_000.
The original broadcast response and the terminal status.
Confirms a transaction.
The transaction to confirm
The validity data of the transaction containing the gas information.
Same as demos.sign.
Signs a transaction after hashing its content.
The transaction to be signed.
Signs a message with a given algorithm.
The message to sign.
The keypair to use for signing.
The algorithm related to the keypair.
A Promise that resolves to the signed message.
Convert a legacy DEM number input to an OS bigint for internal
carrying. Only whole-DEM number inputs are accepted on this
legacy path — fractional DEM is rejected with a clear error
directing callers to the bigint OS path (denomination.demToOs).
Rationale: silently flooring (the previous behaviour) discarded up
to ~10^9 OS per call without warning. The migration period
tolerates legacy number callers, but only at exact DEM
granularity — anything sub-DEM must come in as bigint so the
caller has explicitly opted into OS arithmetic.
Create a signed L2PS hash update transaction for DTR relay to validators.
L2PS hash updates are self-directed transactions that carry consolidated hash information representing multiple L2PS transactions. These transactions are automatically relayed to validators via DTR (Distributed Transaction Routing) to enable consensus on L2PS network activity without exposing transaction content.
The unique identifier of the L2PS network
SHA-256 hash representing all L2PS transactions
Number of transactions included in this hash update
The demos instance (for getting the address nonce)
The signed L2PS hash update transaction
Create a signed DEMOS transaction to send native tokens to a given address.
P4 dual-input:
bigint: OS amount (preferred — 1 DEM = 10^9 OS).number: DEM amount (legacy, deprecated). Auto-converted to OS.Internal carrier in tx.content.amount is bigint OS; the
serializerGate (run from demos.sign) emits the right wire shape
per the connected node's fork status.
The reciever
DEM number (legacy) or OS bigint.
The demos instance (for getting the address nonce)
The signed transaction.
Create a signed networkUpgrade proposal transaction.
Only active validators may propose. The node rejects proposals whose
proposedParameters violate safety bounds (≤50% change, absolute
floor/ceiling) or overlap keys with other pending/activating proposals.
Activation block. Must be ≥ tallyBlock + grace period.
UUID. Also used as lexicographic activation-order tiebreaker.
Subset of NetworkParameters to change.
Human-readable reason, ≤1024 bytes.
Create a signed validatorStake transaction. Used both for initial
validator registration and to top up an existing stake.
Stake amount in base-unit DEMOS, encoded as a bigint string.
Validator's public endpoint (required on first stake; subsequent top-ups may overwrite it).
The demos instance (for nonce + signing).
Create a signed DEMOS transaction to store binary data on the blockchain. Data is stored in the sender's account.
The binary data to store (will be base64-encoded)
The demos instance (for getting the address nonce)
The signed storage transaction.
Create a signed DEMOS transaction to send native tokens to a given address.
Alias of pay. Same dual-input semantics — bigint OS
preferred, number DEM accepted as the deprecated path.
The reciever
DEM number (legacy) or OS bigint.
The demos instance (for getting the address nonce)
The signed transaction.
Create a signed validatorUnstake transaction. Arms the unstake lock
period; after UNSTAKE_LOCK_BLOCKS have elapsed the validator may call
validatorExit.
Create a signed validatorExit transaction. Only accepted by the
network once unstake_available_at <= currentBlock.
Create a signed networkUpgradeVote transaction.
The voter must be in the validator snapshot taken at the proposal's confirmation block, and may cast exactly one vote per proposal (final, non-revocable).
Fetch a domain ownership proof file over HTTPS.
Retrieves https://<host>/.well-known/demos-cci.txt and returns its
body plus the verified hostname. Used by
Identities.addDomainIdentity to prove control of a web domain.
The full proof URL (https://
The keypair of the connected wallet
Programmatic transaction facade — one call per transaction type.
Collapses the classic build → sign → confirm → broadcast flow into a
single method per operation (run.pay, run.attest.*, run.tokens.*,
…) that auto-broadcasts within a configurable fee ceiling (default
5 DEM). Additive: the classic pay/confirm/broadcast methods are
unchanged.
Built lazily on first access (and memoised) rather than in the
constructor. Two reasons: (1) the singleton demos = Demos.instance is
created at import time, so eagerly constructing the namespaces during
new Demos() — which reach into @/abstraction, tokens, contracts — is
the part that risked tripping the websdk↔abstraction import cycle;
deferring construction removes that crash vector. (2) it avoids building
~6 objects on every new Demos() that many callers never touch.
Note: the programmatic module graph is still loaded when this file is
imported (a static import cannot be deferred in ESM). That residual
cycle is benign — no module reads a cross-cycle binding at evaluation
time, only inside functions — and has been narrowed by importing
Identities directly from @/abstraction/Identities rather than via the
@/abstraction barrel.
Identity attestations (web2 proofs) + the DAHR web2-proxy.
Run a DAHR web2-proxy attestation.
Unlike the identity builders above, DAHR does not go through
ctx.run: the web2 proxy performs its own sign + confirm +
broadcast lifecycle server-side. As a result
ProgrammaticTxOptions (e.g. maxFee, confirm) do not
apply here — there is no local confirm/broadcast stage to govern.
The proxy request parameters (url, method, options).
The web2 proxy result, including the attested response.
Link a Discord identity to the connected wallet, end to end.
The Discord message proof URL.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a domain identity (CCI) to the connected wallet, end to end.
Requires the proof payload from
Identities.createDomainProofPayload to already be hosted at
https://<host>/.well-known/demos-cci.txt.
The domain being claimed (e.g. "example.com"). A full URL is also accepted; only the host is used.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link an Ethos wallet identity to the connected wallet, end to end.
The Ethos wallet identity data to link.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a GitHub identity to the connected wallet, end to end.
The GitHub gist/raw proof URL.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a Human Passport identity to the connected wallet, end to end.
The Human Passport identity data to link.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a Nomis wallet identity to the connected wallet, end to end.
The Nomis wallet identity data to link.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Bind post-quantum (PQC) identities to the connected wallet, end to end.
Generates the requested PQC keypairs, signs each address with the wallet's ed25519 key, and links them on the GCR.
The PQC algorithms to bind, or "all" (default)
to bind every supported algorithm.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove an Ethos wallet identity from the connected wallet, end to end.
The identifying data (chain, subchain, address) for the Ethos identity to remove.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove a Human Passport identity from the connected wallet, end to end.
The EVM address of the Human Passport identity to remove.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove a Nomis wallet identity from the connected wallet, end to end.
The Nomis wallet identity data identifying the identity to remove.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove post-quantum (PQC) identities from the connected wallet, end to end.
The PQC algorithms to remove, or "all"
(default) to remove every supported algorithm.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove a web2 identity that was added via TLSNotary, end to end.
The platform context ("github", "discord", or "telegram").
The username to remove.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove an Unstoppable Domain identity from the connected wallet, end to end.
The UD domain to unlink (e.g. "brad.crypto").
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove a web2 identity from the connected wallet, end to end.
The identity to unlink (context + username).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove a crosschain (XM) identity from the connected wallet, end to end.
The crosschain identity to unlink.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a Telegram identity to the connected wallet, end to end.
The signed Telegram bot attestation.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a web2 identity via a TLSNotary attestation, end to end.
The proof and its associated fields come from a TLSNotary presentation over the platform's API (GitHub, Discord, or Telegram).
The platform context ("github", "discord", or "telegram").
The TLSNotary presentation.
The hash of the proven received transcript.
The revealed byte ranges of the transcript.
The revealed received transcript bytes.
The username from the proven response.
The user id from the proven response.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a Twitter/X identity to the connected wallet, end to end.
The tweet proof URL.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link an Unstoppable Domain identity to the connected wallet, end to end.
The signing address must be the owner or an authorized address in the
supplied UnifiedDomainResolution (resolve it first via
Identities.resolveUDDomain), and must have signed the challenge.
The address used to sign the challenge (owner or authorized on the domain).
The signature over the challenge message.
The challenge message that was signed.
The resolved domain data (owner, network, registry type, authorized addresses).
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Link a crosschain (XM) identity from a signature, end to end.
The signature-inference payload identifying the crosschain address to link.
OptionalreferralCode: stringOptional referral code for incentive points.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Native bridge operation submission.
Submit a compiled bridge operation as a nativeBridge transaction,
end to end.
NativeBridgeMethods.generateOperationTx signs the transaction
(deriving nonce from the Demos instance); the shared runner then
confirms it and (in "auto" mode) broadcasts it within the fee cap.
The compiled bridge operation returned by the RPC.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Smart contracts — RPC-native, NOT fee-capped (see namespace docs).
Get a handle to an already-deployed contract. Read-only; no tx.
Start a batch of deploy/call operations (see DemosContracts.batch).
Call a method on an existing contract by address.
RPC-native (not fee-capped). Returns the raw
ContractCallResult, not a ProgrammaticTxResult.
Target contract address.
Method name to invoke.
Optionalargs: unknown[]Method arguments (default []).
Optionaloptions: ContractCallOptionsCall options (gas, etc.).
Deploy a smart contract from source. Requires a connected wallet.
RPC-native (not fee-capped). Returns the deployed
ContractInstance, not a ProgrammaticTxResult.
Contract source code.
OptionalconstructorArgs: unknown[]Constructor arguments (default []).
Optionaloptions: ContractDeployOptionsDeploy options (gas, etc.).
Deploy a contract from a named template.
Registered template name.
Optionalparams: Record<string, unknown>Template parameters.
Estimate gas for a contract call. Read-only; no tx.
Target contract address.
Method name.
Optionalargs: unknown[]Method arguments (default []).
List the available contract template names.
d402 payments.
Settle an HTTP 402 payment requirement, end to end.
Payment requirements from the 402 response (amount, recipient, resourceId, description).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Demoswork workflow submission.
Submit an assembled DemosWork script as a demoswork
transaction, end to end.
prepareDemosWorkPayload serialises and signs the work; the shared
runner then confirms it and (in "auto" mode) broadcasts it within
the fee cap.
import { DemosWork } from "@kynesyslabs/demosdk"
const work = new DemosWork()
// ... push steps / operations onto `work` ...
// auto-broadcast within the fee cap:
await demos.run.demoswork.submit(work)
// build + confirm only, broadcast later yourself:
const r = await demos.run.demoswork.submit(work, { confirm: "manual" })
await demos.broadcast(r.validityData)
The assembled DemosWork script to execute.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Escrow to social identities (send / claim / refund).
Claim escrowed funds for a social identity you have linked, end to end.
Social platform ("twitter", "github", "telegram").
Username to claim for.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Refund an expired escrow back to the original depositor, end to end.
Social platform ("twitter", "github", "telegram").
Username whose expired escrow to refund.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Send DEM to a social-identity escrow, end to end.
P4 dual-input amount: bigint OS (preferred) or number DEM
(legacy, auto-converted). Sub-DEM precision against a pre-fork
node throws.
import { denomination } from "@kynesyslabs/demosdk"
// auto-broadcast within the 5 DEM fee cap:
await demos.run.escrow.send(
"twitter", "@bob", denomination.demToOs(100),
{ expiryDays: 30, message: "Welcome to Demos!" },
)
// build + confirm only, broadcast later yourself:
const r = await demos.run.escrow.send(
"twitter", "@bob", 100n, undefined, { confirm: "manual" },
)
await demos.broadcast(r.validityData)
Social platform ("twitter", "github", "telegram").
Username on that platform (e.g., "@bob").
DEM number (legacy) or OS bigint (preferred).
Optionaloptions: { Optional escrow parameters (expiry, memo).
OptionalexpiryOptionalmessage?: stringOptionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Network-upgrade governance (propose / vote).
Submit a network-upgrade proposal, end to end.
Proposal fields (id, parameters, rationale, activation block).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Cast a vote on a pending network-upgrade proposal, end to end. The vote is final and non-revocable.
The proposal to vote on.
true to approve, false to reject.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
IPFS storage (add / pin / unpin).
Upload content to IPFS (and auto-pin it), end to end.
// auto-broadcast within the 5 DEM fee cap:
await demos.run.ipfs.add("hello world", { filename: "hello.txt" })
// with a signed cost ceiling from a quote:
const quote = await demos.ipfs.quote(bytes.length, "IPFS_ADD")
await demos.run.ipfs.add(bytes, {
customCharges: IPFSOperations.quoteToCustomCharges(quote),
})
Content to upload (Buffer, Uint8Array or string).
OptionaladdOptions: AddOptionsWithChargesFilename, metadata and optional custom charges.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Pin an existing CID to the sender's account, end to end.
The Content Identifier to pin (CIDv0 or CIDv1).
OptionalpinOptions: PinOptionsWithChargesDuration, metadata, fileSize and optional
custom charges.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Remove a pin from the sender's account, end to end.
The Content Identifier to unpin (CIDv0 or CIDv1).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Send native DEMOS tokens to an address, end to end.
import { denomination } from "@kynesyslabs/demosdk"
// auto-broadcast within the 5 DEM fee cap:
await demos.run.pay("0x...", denomination.demToOs(100))
// build + confirm only, broadcast later yourself:
const r = await demos.run.pay("0x...", 100n, { confirm: "manual" })
await demos.broadcast(r.validityData)
Receiver address (0x-prefixed hex).
DEM number (legacy) or OS bigint (preferred).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Binary storage and storage programs.
Sign and submit a storage program, end to end.
The storage program payload to sign (must carry a
storageAddress).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Store binary data on the blockchain, end to end.
The binary data to store in the sender's account.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Token creation and execution.
Approve a spender to move tokens on your behalf, end to end.
Token contract address.
Spender address being granted the allowance.
Amount to approve (bigint-valued decimal string).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Burn tokens from an address, end to end.
Token contract address.
Address to burn tokens from.
Amount to burn (bigint-valued decimal string).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Call a custom script method on the token, end to end.
Token contract address.
Method name to invoke.
Method parameters.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Deploy a new token, end to end.
Token creation parameters (name, ticker, decimals, initial supply, optional script/ACL).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Grant ACL permissions to an address, end to end.
Token contract address.
Address being granted the permissions.
Permissions to grant.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Mint new tokens to an address, end to end.
Token contract address.
Recipient of the minted tokens.
Amount to mint (bigint-valued decimal string).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Pause all token operations, end to end.
Token contract address.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Revoke ACL permissions from an address, end to end.
Token contract address.
Address the permissions are revoked from.
Permissions to revoke.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Transfer tokens to another address, end to end.
// auto-broadcast within the 5 DEM fee cap:
await demos.run.tokens.transfer("0xToken...", "0xTo...", "1000")
// build + confirm only, broadcast later yourself:
const r = await demos.run.tokens.transfer(
"0xToken...", "0xTo...", "1000", { confirm: "manual" },
)
await demos.broadcast(r.validityData)
Token contract address.
Recipient address.
Amount to transfer (bigint-valued decimal string).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Transfer tokens from one address to another using an existing allowance, end to end.
Token contract address.
Owner address the tokens are moved from.
Recipient address.
Amount to transfer (bigint-valued decimal string).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Transfer ownership of the token to a new owner, end to end.
Token contract address.
Address of the new owner.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Resume a paused token, end to end.
Token contract address.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Upgrade the token's on-chain script, end to end.
Token contract address.
New script code.
New method definitions to install.
New hooks to activate.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Alias of pay. Same dual-input amount semantics.
Receiver address (0x-prefixed hex).
DEM number (legacy) or OS bigint (preferred).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Validator staking (stake / unstake / exit).
Complete validator exit, end to end. Only accepted by the network
once the unstake timelock has elapsed
(unstake_available_at <= currentBlock).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Stake toward validator registration, or top up an existing stake, end to end.
import { denomination } from "@kynesyslabs/demosdk"
// register + auto-broadcast within the 5 DEM fee cap:
await demos.run.validator.stake(
denomination.demToOs(1000).toString(),
"https://my-validator.example",
)
// build + confirm only, broadcast later yourself:
const r = await demos.run.validator.stake(
"1000000000",
"https://my-validator.example",
{ confirm: "manual" },
)
await demos.broadcast(r.validityData)
Stake amount as a non-negative bigint-encoded string (OS).
Validator's public endpoint (required on first stake; used to reach the node).
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Arm the unstake lock, end to end. Starts the timelock after which exit becomes accepted by the network.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Cross-chain (XM) operation submission.
Submit a fully-built XMScript as a crosschainOperation
transaction, end to end.
prepareXMPayload signs the transaction; the shared runner then
confirms it and (in "auto" mode) broadcasts it within the fee cap.
import { prepareXMScript } from "@kynesyslabs/demosdk"
const xmScript = prepareXMScript({ chain: "eth", ... })
// auto-broadcast within the fee cap:
await demos.run.xm.submit(xmScript)
// build + confirm only, broadcast later yourself:
const r = await demos.run.xm.submit(xmScript, { confirm: "manual" })
await demos.broadcast(r.validityData)
The assembled cross-chain script to execute.
Optionalopts: ProgrammaticTxOptionsFee ceiling / confirmation strategy / wait behaviour.
Connection status of the wallet
StaticinstanceBroadcasts a transaction for execution.
The validity data of the transaction
The response from the node
Broadcast a confirmed transaction and wait until it lands on chain
(or fails) by polling the node's getTransactionStatus RPC.
Throws BroadcastTimeoutError if no terminal state is observed
before the timeout elapses. Use plain broadcast() if you want to
handle async confirmation yourself.
The validity data of the transaction
Optionalopts: { OptionalpollDelay between polls. Defaults to 500.
OptionaltimeoutTotal time to wait. Defaults to 60_000.
Confirms a transaction.
The transaction to confirm
The validity data of the transaction containing the gas information.
Connects to a Demos wallet using the provided master seed.
The master seed of the wallet
Optionaloptions: { The options for the wallet connection
Optionalalgorithm?: SigningAlgorithmThe algorithm to use for the wallet
Optionaldual_Whether to include the ed25519 signature along with the PQC signature, when signing with unlinked PQC keypairs (i.e. PQC keypairs not linked to your ed25519 address on the network).
The public key of the wallet
Lists currently-open proposals (pending tally or activating after approval). Rejected/active historical proposals are not included.
Get the mempool.
Fetches the connected node's per-fork activation status.
Mirrors the node's getNetworkInfo nodeCall
(libs/network/handlers/forkHandlers.ts). The response carries
activation height, current chain head, and the activated boolean
for every known fork.
Caches the result on this Demos instance for the instance's
lifetime (no TTL). To re-fetch after a node upgrade, construct a
fresh Demos instance.
On RPC failure (404, malformed response, network error), this
method returns null and the SDK assumes pre-fork wire format.
A console.warn is emitted exactly once per Demos instance
recommending the operator upgrade the target node.
The fork-status payload, or null if the RPC failed.
Returns the currently-active NetworkParameters — the result of folding
every active NetworkUpgrade over the genesis defaults.
Returns the live vote tally for a specific proposal — total snapshot
weight, approve/reject breakdowns, per-validator votes, threshold, and
a passed flag.
Get the transaction history of an address.
The address
The type of transaction. Defaults to "all".
Optionallimit?: numberOptionalstart?: numberA list of transaction ordered from the most recent to the oldest.
Get all transactions.
Optionalstart: number | "latest"Optionallimit: numberGet transaction by hash.
The transaction hash
Returns the ordered history of proposals whose status has reached
active. Ordered by effectiveAtBlock ASC, then proposalId ASC.
Get a validator's current record (stake, status, unstake timestamps). Returns null if the address is not (and never was) a validator.
List validators at a given block (defaults to the current head). Only
returns validators whose valid_at block is <= the queried block and
whose status is still active.
OptionalblockNumber: numberCreate a signed DEMOS transaction to send native tokens to a given address.
P4 dual-input:
bigint (preferred, post-v3): amount in OS (smallest unit;
1 DEM = 10^9 OS). Use denomination.demToOs(...) to convert
a human-readable DEM input.number (deprecated, v2 callers): amount in DEM. Auto-converted
to OS internally via OS_PER_DEM. Will be removed in v4.Sub-DEM precision is rejected with SubDemPrecisionError when
the connected node is pre-fork — its legacy DEM-number wire
cannot carry < 1 DEM and silent truncation is unacceptable. The
caller can either round to a whole DEM or upgrade the target
node.
The receiver address (0x-prefixed hex).
DEM number (legacy) or OS bigint (preferred).
The signed transaction.
Signs a transaction.
The transaction to sign
The signed transaction
Signs a message.
The message to sign
Optionaloptions: { The options for the message signing
Optionalalgorithm?: SigningAlgorithmThe algorithm to use for the message signing. Defaults to the connected wallet's algorithm.
The signature of the message
One-call bootstrap: connect to a node and (optionally) a wallet, then
return the ready instance for immediate use with demos.run.*.
Convenience wrapper over connect + connectWallet — no
new behaviour, just the two-step setup collapsed into one. Omit
wallet to connect read-only.
The URL of the demos node.
Optionalwallet: string | Uint8Array<ArrayBufferLike>Master seed / mnemonic (string) or raw seed bytes. Omit to connect without a wallet.
OptionalwalletOptions: { Forwarded to connectWallet.
Optionalalgorithm?: SigningAlgorithmOptionaldual_This connected Demos instance.
Create a signed DEMOS transaction to store binary data on the blockchain. Data is stored in the sender's account.
The binary data to store
The signed storage transaction.
Create a TLSNotary instance for HTTPS attestation.
This method discovers the notary endpoints from the connected node and returns an initialized TLSNotary instance.
Optionalconfig: TLSNotaryConfigOptional explicit configuration (overrides discovery)
Initialized TLSNotary instance
// Option 1: Auto-discovery from connected node (preferred)
const demos = new Demos({ rpc: 'https://node.demos.sh' });
await demos.connect();
const tlsn = await demos.tlsnotary();
// Option 2: Explicit configuration
const tlsn = await demos.tlsnotary({
notaryUrl: 'wss://other-node.demos.sh:7047',
websocketProxyUrl: 'wss://other-node.demos.sh:55688',
});
// Attest an HTTPS request
const result = await tlsn.attest({
url: 'https://api.github.com/users/octocat',
});
console.log('Verified server:', result.verification.serverName);
Create a signed DEMOS transaction to send native tokens to a given address.
Alias of pay. Same dual-input semantics — bigint is the
preferred OS shape; number is the deprecated legacy DEM shape.
The receiver address (0x-prefixed hex).
DEM number (legacy) or OS bigint (preferred).
The signed transaction.
Verifies a message.
The message to verify
The signature of the message
The public key of the message
Optionaloptions: { The options for the message verification
Optionalalgorithm?: SigningAlgorithmThe algorithm to use for the message verification. Defaults to the connected wallet's algorithm or ed25519 if no wallet is connected.
Whether the message is verified
Static_coerceCoerce a wire-format amount/fee value (legacy DEM number,
post-fork OS decimal string, or in-flight bigint) to an OS
bigint. Used by _calculateAndApplyGasFee and other internal
arithmetic paths to stay in OS-bigint regardless of which wire
shape the caller produced. Mirrors the node's toOsBigint helper
in forks/serializerGate.ts.
StaticstartStatic one-call bootstrap over the shared singleton — starts
Demos.instance and returns it ready for demos.run.*.
The URL of the demos node.
Optionalwallet: string | Uint8Array<ArrayBufferLike>Master seed / mnemonic (string) or raw seed bytes.
OptionalwalletOptions: { Forwarded to connectWallet.
Optionalalgorithm?: SigningAlgorithmOptionaldual_The started shared Demos instance.
This class provides methods to interact with the DEMOS blockchain.