Types¶
All types are exported from @dilithia/browser-sdk and can be imported directly:
import type {
DilithiaConnectResult,
DilithiaSignedMessage,
ChainClient,
// ...
} from "@dilithia/browser-sdk";
DilithiaConnectResult¶
Returned by connect() and switchChain().
type DilithiaConnectResult = {
address: string; // Connected account address
publicKey: string; // ML-DSA-65 public key (hex)
networkId: string; // Network identifier
networkLabel: string | null; // Human-readable network name
permissions: string[]; // Granted permissions
chainId: string; // Chain ID
rpcUrl: string; // RPC endpoint URL
mode: string; // Wallet mode
};
| Field | Type | Description |
|---|---|---|
address |
string |
The connected account's address |
publicKey |
string |
ML-DSA-65 public key, hex-encoded |
networkId |
string |
Network identifier |
networkLabel |
string \| null |
Human-readable network name, or null |
permissions |
string[] |
List of granted permission strings |
chainId |
string |
Chain ID of the connected network |
rpcUrl |
string |
RPC endpoint URL for creating a ChainClient |
mode |
string |
Wallet mode |
DilithiaSignedMessage¶
Returned by signMessage().
type DilithiaSignedMessage = {
algorithm: string; // Signing algorithm (e.g., "ML-DSA-65")
address: string; // Signer address
publicKey: string; // Signer public key
message: string; // Original message
signature: string; // Signature (hex)
};
| Field | Type | Description |
|---|---|---|
algorithm |
string |
Signing algorithm used (e.g., "ML-DSA-65") |
address |
string |
Address of the signing account |
publicKey |
string |
Public key of the signing account |
message |
string |
The original message that was signed |
signature |
string |
The hex-encoded signature |
DilithiaSignedPayload¶
Returned by signPayload().
type DilithiaSignedPayload = {
algorithm: string; // Signing algorithm
address: string; // Signer address
publicKey: string; // Signer public key
signature: string; // Signature (hex)
payload: Record<string, unknown>; // Original payload object
payload_json: string; // JSON-serialized payload
};
| Field | Type | Description |
|---|---|---|
algorithm |
string |
Signing algorithm used |
address |
string |
Address of the signing account |
publicKey |
string |
Public key of the signing account |
signature |
string |
The hex-encoded signature |
payload |
Record<string, unknown> |
The original payload object |
payload_json |
string |
The payload serialized as a JSON string |
DilithiaProvider¶
The raw provider object available at window.dilithia. Returned by getDilithiaProvider().
type DilithiaProvider = {
isDilithia: true;
providerVersion?: string;
supportedMethods?: string[];
enable: () => Promise<DilithiaConnectResult>;
request: (args: { method: string; params?: Record<string, unknown> }) => Promise<unknown>;
on: (eventName: DilithiaEventName, handler: (detail: unknown) => void) => () => void;
removeListener: (eventName: DilithiaEventName, handler: (detail: unknown) => void) => void;
};
| Field | Type | Description |
|---|---|---|
isDilithia |
true |
Always true; used for provider detection |
providerVersion |
string \| undefined |
Version of the wallet extension |
supportedMethods |
string[] \| undefined |
List of supported RPC methods |
enable |
() => Promise<DilithiaConnectResult> |
Legacy connect method |
request |
(args) => Promise<unknown> |
JSON-RPC style request method |
on |
(eventName, handler) => () => void |
Subscribe to events; returns unsubscribe function |
removeListener |
(eventName, handler) => void |
Remove an event listener |
DilithiaEventName¶
Accepted by on().
| Value | Description |
|---|---|
"accountsChanged" |
The active account changed |
"chainChanged" |
The wallet switched to a different chain |
"permissionsChanged" |
Granted permissions were updated |
"disconnect" |
The wallet disconnected |
TxOptions¶
Accepted by all transactional wallet functions.
| Field | Type | Description |
|---|---|---|
paymaster |
string \| undefined |
Address of a paymaster contract that will cover gas fees |
TransactionResult¶
Returned by sendTransaction(), callContract(), and transfer().
type TransactionResult = {
accepted: boolean; // Whether the network accepted the transaction
txHash: string; // Transaction hash
};
| Field | Type | Description |
|---|---|---|
accepted |
boolean |
true if the network accepted the transaction |
txHash |
string |
The transaction hash for tracking |
BalanceResult¶
Returned by ChainClient.getBalance().
type BalanceResult = {
balance: string; // Balance as a string (to preserve precision)
address: string; // Account address
};
| Field | Type | Description |
|---|---|---|
balance |
string |
Token balance as a string to preserve precision |
address |
string |
The queried account address |
Receipt¶
Returned by ChainClient.getReceipt() and ChainClient.waitForReceipt().
type Receipt = {
txHash: string; // Transaction hash
blockHeight: number; // Block in which the tx was included
status: string; // Node status string
result?: unknown; // Execution result (if any)
error?: string; // Error message (if failed)
gasUsed: number; // Gas consumed
feePaid: number; // Fee paid in DILI
};
TransactionHistoryPage¶
Returned by ChainClient.getTransactionHistory().
type TransactionHistoryPage = {
address: string; // Queried account address
txHashes: string[]; // Transaction hashes for this page
count: number; // Number of hashes in this page
nextCursor: number | null; // Cursor for the next page, if any
};
| Field | Type | Description |
|---|---|---|
address |
string |
Account address used for the lookup. |
txHashes |
string[] |
Transaction hashes returned for the current page. |
count |
number |
Number of hashes returned in the current page. |
nextCursor |
number \| null |
Cursor to request the next page, or null if there is no next page. |
GasEstimate¶
Returned by ChainClient.estimateGas().
type GasEstimate = {
gasLimit: number; // Maximum gas units
baseFee: number; // Current base fee per gas unit
estimatedCost: number; // Estimated total cost in DILI
};
| Field | Type | Description |
|---|---|---|
gasLimit |
number |
Maximum gas units for the call |
baseFee |
number |
Current base fee per gas unit |
estimatedCost |
number |
Estimated total cost in DILI |
NetworkInfo¶
Returned by ChainClient.getNetworkInfo().
type NetworkInfo = {
chainId: string; // Chain ID
blockHeight: number; // Current block height
baseFee: number; // Current base fee
networkId: string; // Network identifier (currently mirrors chainId)
networkLabel: string | null; // Human-readable network name if available
};
| Field | Type | Description |
|---|---|---|
chainId |
string |
Chain ID |
blockHeight |
number |
Current block height |
baseFee |
number |
Current base fee per gas unit |
networkId |
string |
Network identifier, currently mirroring chainId |
networkLabel |
string \| null |
Human-readable name if exposed, otherwise null |
ShieldedDepositResult¶
Returned by shieldedDeposit().
type ShieldedDepositResult = {
commitment: string; // Poseidon hash commitment
txHash: string; // Transaction hash
};
| Field | Type | Description |
|---|---|---|
commitment |
string |
The Poseidon hash commitment added to the Merkle tree |
txHash |
string |
Transaction hash for tracking |
ShieldedWithdrawResult¶
Returned by shieldedWithdraw().
type ShieldedWithdrawResult = {
nullifier: string; // Nullifier to prevent double-spending
proof: string; // STARK proof
txHash: string; // Transaction hash
};
| Field | Type | Description |
|---|---|---|
nullifier |
string |
Nullifier hash that prevents double-spending |
proof |
string |
The STARK proof generated by the wallet |
txHash |
string |
Transaction hash for tracking |
ShieldedBalanceResult¶
Represents the user's shielded pool balance, tracked locally by the wallet.
type ShieldedBalanceResult = {
commitments: string[]; // Unspent commitment hashes
totalValue: number; // Total shielded balance in DILI
};
| Field | Type | Description |
|---|---|---|
commitments |
string[] |
Array of unspent commitment hashes |
totalValue |
number |
Total shielded balance in DILI |
ComplianceProofType¶
Accepted by shieldedComplianceProof().
| Value | Description |
|---|---|
"not_on_sanctions" |
Prove the account is not on a sanctions list |
"tax_paid" |
Prove taxes have been paid on shielded activity |
"balance_range" |
Prove the shielded balance falls within a range |
NameRecord¶
Returned by name service query methods such as resolveName(), reverseResolveName(), lookupName(), and getNamesByOwner().
type NameRecord = {
name: string; // Registered name
address: string; // Resolved address
owner?: string; // Owner address (if available)
target?: string; // Resolution target (if available)
};
| Field | Type | Description |
|---|---|---|
name |
string |
The registered name |
address |
string |
The resolved address |
owner |
string \| undefined |
Owner address, present in detailed lookups |
target |
string \| undefined |
Resolution target, present in detailed lookups |
RegistrationCost¶
Returned by ChainClient.getRegistrationCost().
type RegistrationCost = {
name: string; // The name being priced
cost: number; // Registration cost in DILI
duration: number; // Registration duration in blocks
};
| Field | Type | Description |
|---|---|---|
name |
string |
The name being priced |
cost |
number |
Registration cost in DILI |
duration |
number |
Registration duration in blocks |
SchemaAttribute¶
Used when registering a credential schema via registerSchema().
type SchemaAttribute = {
name: string; // Attribute name
type: string; // Attribute type (e.g., "u64", "string", "bool")
};
| Field | Type | Description |
|---|---|---|
name |
string |
Attribute name |
type |
string |
Attribute type (e.g., "u64", "string", "bool") |
CredentialSchema¶
Returned by ChainClient.getSchema().
type CredentialSchema = {
name: string; // Schema name
version: string; // Schema version
attributes: SchemaAttribute[]; // List of attribute definitions
};
| Field | Type | Description |
|---|---|---|
name |
string |
Schema name |
version |
string |
Schema version |
attributes |
SchemaAttribute[] |
List of attribute definitions |
Credential¶
Returned by ChainClient.getCredential(), ChainClient.listCredentialsByHolder(), and ChainClient.listCredentialsByIssuer().
type Credential = {
commitment: string; // Credential commitment hash
issuer: string; // Issuer address
holder: string; // Holder address
schemaHash: string; // Schema hash
status: string; // Credential status (e.g., "active", "revoked")
};
| Field | Type | Description |
|---|---|---|
commitment |
string |
Credential commitment hash |
issuer |
string |
Issuer address |
holder |
string |
Holder address |
schemaHash |
string |
Schema hash |
status |
string |
Credential status (e.g., "active", "revoked") |
SelectiveDisclosure¶
Parameters for selective disclosure proof verification via verifyCredentialProof().
type SelectiveDisclosure = {
commitment: string; // Credential commitment
disclosedFields: string[]; // Fields being disclosed
proof: string; // ZK proof
};
| Field | Type | Description |
|---|---|---|
commitment |
string |
Credential commitment hash |
disclosedFields |
string[] |
Array of field names being disclosed |
proof |
string |
The ZK proof |
ProofVerificationResult¶
Result of on-chain credential proof verification.
type ProofVerificationResult = {
valid: boolean; // Whether the proof is valid
commitment: string; // The credential commitment verified
fields: string[]; // Disclosed field names
};
| Field | Type | Description |
|---|---|---|
valid |
boolean |
true if the proof verified successfully |
commitment |
string |
The credential commitment that was verified |
fields |
string[] |
The disclosed field names |
MultisigWallet¶
Returned by ChainClient.getMultisigWallet().
type MultisigWallet = {
address: string; // Multisig wallet address
signers: string[]; // Array of signer addresses
threshold: number; // Required number of approvals
nonce: number; // Current transaction nonce
};
| Field | Type | Description |
|---|---|---|
address |
string |
Multisig wallet address |
signers |
string[] |
Array of signer addresses |
threshold |
number |
Number of approvals required to execute a transaction |
nonce |
number |
Current transaction nonce |
MultisigTx¶
Returned by ChainClient.getMultisigTx() and ChainClient.listMultisigPendingTxs().
type MultisigTx = {
txId: number; // Transaction ID within the multisig wallet
wallet: string; // Multisig wallet address
to: string; // Destination address
value: number; // Transfer value
approvals: string[]; // Addresses that have approved
executed: boolean; // Whether the transaction has been executed
};
| Field | Type | Description |
|---|---|---|
txId |
number |
Transaction ID within the multisig wallet |
wallet |
string |
Multisig wallet address |
to |
string |
Destination address |
value |
number |
Transfer value |
approvals |
string[] |
Array of addresses that have approved |
executed |
boolean |
true if the transaction has been executed |