Class ArkCoin
- Namespace
- NArk.Abstractions
- Assembly
- NArk.Abstractions.dll
A spendable VTXO with the spending script, contract, and expiry data the SDK needs to participate in a batch or perform an offchain send.
public class ArkCoin : Coin, ICoin, ICoinable
- Inheritance
-
CoinArkCoin
- Implements
-
ICoinICoinable
- Inherited Members
-
Coin._OverrideScriptCodeCoin.GetScriptCode()Coin.GetHashVersion()Coin.ToScriptCoin(Script)Coin.TryToScriptCoin(Script)Coin.TryToScriptCoin(PubKey)Coin.ToColoredCoin(AssetMoney)Coin.OverrideScriptCode(Script)Coin.IsMalleableCoin.CanGetScriptCodeCoin.OutpointCoin.TxOutCoin.AmountCoin.ScriptPubKey
Constructors
ArkCoin(ArkCoin)
public ArkCoin(ArkCoin other)
Parameters
otherArkCoin
ArkCoin(string, ArkContract, DateTimeOffset, DateTimeOffset?, uint?, OutPoint, TxOut, OutputDescriptor?, ScriptBuilder, WitScript?, LockTime?, Sequence?, bool, bool, IReadOnlyList<VtxoAsset>?)
public ArkCoin(string walletIdentifier, ArkContract contract, DateTimeOffset birth, DateTimeOffset? expiresAt, uint? expiresAtHeight, OutPoint outPoint, TxOut txOut, OutputDescriptor? signerDescriptor, ScriptBuilder spendingScriptBuilder, WitScript? spendingConditionWitness, LockTime? lockTime, Sequence? sequence, bool swept, bool unrolled, IReadOnlyList<VtxoAsset>? assets = null)
Parameters
walletIdentifierstringcontractArkContractbirthDateTimeOffsetexpiresAtDateTimeOffset?expiresAtHeightuint?outPointOutPointtxOutTxOutsignerDescriptorOutputDescriptorspendingScriptBuilderScriptBuilderspendingConditionWitnessWitScriptlockTimeLockTime?sequenceSequence?sweptboolunrolledboolassetsIReadOnlyList<VtxoAsset>
Properties
Assets
Ark-issued assets attached to this coin; null for BTC-only coins.
public IReadOnlyList<VtxoAsset>? Assets { get; }
Property Value
Birth
When this coin was first observed.
public DateTimeOffset Birth { get; }
Property Value
Contract
The on-chain contract that encumbers this coin.
public ArkContract Contract { get; }
Property Value
ExpiresAt
Wall-clock expiry; null when expiry is block-height only.
public DateTimeOffset? ExpiresAt { get; }
Property Value
ExpiresAtHeight
Block-height expiry; null when expiry is time-based only.
public uint? ExpiresAtHeight { get; }
Property Value
- uint?
LockTime
Transaction locktime required when spending, or null.
public LockTime? LockTime { get; }
Property Value
- LockTime?
Sequence
Input sequence required for OP_CSV leaves; null for non-CSV scripts.
public Sequence? Sequence { get; }
Property Value
- Sequence?
SignerDescriptor
Output descriptor used to sign spends of this coin.
public OutputDescriptor? SignerDescriptor { get; }
Property Value
SpendingConditionWitness
Additional witness data prepended to the script path witness, when required by the spending condition.
public WitScript? SpendingConditionWitness { get; }
Property Value
- WitScript
SpendingScript
Compiled tapscript leaf for spending.
public TapScript SpendingScript { get; }
Property Value
- TapScript
SpendingScriptBuilder
Builds the tapscript leaf used when spending this coin.
public ScriptBuilder SpendingScriptBuilder { get; }
Property Value
Swept
True if the Arkade server has already swept this coin's VTXO on-chain.
public bool Swept { get; }
Property Value
Unrolled
True if this coin came from the unilateral-exit (unroll) path rather than a batch.
public bool Unrolled { get; }
Property Value
WalletIdentifier
Owner wallet ID.
public string WalletIdentifier { get; }
Property Value
Methods
CanSpendOffchain(TimeHeight)
True when the coin can participate in an offchain Arkade intent (not yet expired or swept).
public bool CanSpendOffchain(TimeHeight current)
Parameters
currentTimeHeight
Returns
CanSpendOffchain(TimeHeight, IReadOnlyDictionary<ECXOnlyPubKey, long>)
As CanSpendOffchain(TimeHeight), but additionally excludes coins under a deprecated signer past its cutoff (IsDeprecatedSignerPastCutoff(IReadOnlyDictionary<ECXOnlyPubKey, long>, long)): past the cutoff the operator stops co-signing, so the coin is no longer offchain-spendable even though it is not yet recoverable.
public bool CanSpendOffchain(TimeHeight current, IReadOnlyDictionary<ECXOnlyPubKey, long> deprecatedSigners)
Parameters
currentTimeHeightdeprecatedSignersIReadOnlyDictionary<ECXOnlyPubKey, long>
Returns
FillPsbtInput(PSBT)
Populates the PSBT input for this coin with taproot spend-info and condition witness. Returns null if this coin's outpoint is not in the PSBT.
public PSBTInput? FillPsbtInput(PSBT psbt)
Parameters
psbtPSBT
Returns
- PSBTInput
GetRawExpiry()
Returns expiry as a raw number: unix seconds for time-gated, block height for height-gated, 0 if no expiry.
public double GetRawExpiry()
Returns
IsDeprecatedSignerPastCutoff(IReadOnlyDictionary<ECXOnlyPubKey, long>, long)
True when this coin's contract is bound to a deprecated Arkade server signer whose
cooperative-sign cutoff has already passed — the operator will no longer co-sign an offchain
spend, so the coin can only be redeemed once it becomes recoverable (after expiry). A cutoff
of 0 means "no cutoff" and is never treated as past.
public bool IsDeprecatedSignerPastCutoff(IReadOnlyDictionary<ECXOnlyPubKey, long> deprecatedSigners, long nowUnixSeconds)
Parameters
deprecatedSignersIReadOnlyDictionary<ECXOnlyPubKey, long>Deprecated signer pubkeys mapped to their cutoff (unix seconds), from
ArkServerInfo.DeprecatedSigners.nowUnixSecondslongThe current time in unix seconds.
Returns
IsRecoverable(TimeHeight)
True when the coin must be redeemed on-chain (swept or past expiry).
public bool IsRecoverable(TimeHeight current)
Parameters
currentTimeHeight
Returns
RequiresForfeit()
True when spending this coin offchain requires submitting a forfeit transaction.
public bool RequiresForfeit()