Skip to main content

Import

import {
  createSharesClient,
  initializeFromShyConfig,
  assertSharesManifest,
  SHARES_MANIFEST_CONTRACT_VERSION   // "shyshares-v1"
} from 'shyware/sdk/web/sharesClient.js'

Initialization

const client = await initializeFromShyConfig(shyconfig, options?)
Requires contract_version: "shyshares-v1". Validates that governance and execution blocks are present and that transfer_layer: "shywire" is set in the governance block.

Organization

await client.listOrganizations()
// → Organization[]

await client.getOrganization(organizationId)
// → Organization { id, name, memberCount, ... }

Membership

// Build an account commitment for a wallet address
const { commitment } = await client.createAccountCommitment({
  walletAddress: '0xabc...'
})
// → { commitment: H("account:wallet:0xabc...") }

// Snapshot of delegated voting weight at the current block
await client.getMembershipSnapshot(commitment)
// → { weight, delegatedFrom, snapshotHeight }
getMembershipSnapshot returns the effective voting weight for the commitment at the snapshot block used for the current active proposal (if any). Token transfers after the snapshot block do not affect weight for that proposal — see fixed governance snapshot.

Proposals

await client.listProposals(filters?)
// filters: { organizationId, status, proposalClass }
// → Proposal[]

await client.getProposal(proposalId)
// → Proposal { id, class, question, options, snapshotBlock, thresholds, status }

await client.getTally(proposalId)
// → Tally | null

Create a proposal

await client.createProposal({
  organizationId: 'dao-1',
  class: 'parameter_change',     // must match governance.proposal_classes
  question: 'Increase fee to 0.3%?',
  options: ['yes', 'no'],
  quorumBps: 3000,               // 30% of total weight
  approvalBps: 5000,             // 50% of participating weight
  snapshotMode: 'proposal_creation_time'  // or 'voting_start' or block height
})

Close a proposal

await client.closeProposal(proposalId, {
  finalizeAt: Date.now() / 1000   // unix seconds
})

Weighted ballot

await client.submitWeightedBallot({
  proposalId: 'proposal-42',
  choice: 'yes',
  accountCommitment: commitment,
  identityInput: { walletAddress: '0xabc...' }
})
The ballot carries identity_hash = H("account:wallet:walletAddress"). Voting weight is read from the membership snapshot — the voter’s full token weight is applied without revealing the wallet address in List 1. The List 2 record contains only the commitment hash.

Action queue

await client.listActions(filters?)
// → QueuedAction[]

await client.getAction(actionId)
// → QueuedAction { id, type, payload, proposalId, status, enqueueHeight }

Dispatch a queued action

await client.dispatchAction(actionId, {
  adapter: 'shywire',    // or 'byodao'
  adapterPayload: { ... }
})
Actions are enqueued to canonical ledger state when a proposal crosses both quorum and approval thresholds. dispatchAction triggers execution through the configured adapter. The canonical queue record is the authoritative governance result — external dispatch is not required to define it.

Governance snapshot

Claim 16 of the patent covers the three snapshot timing options:
snapshotModeWhen weight is fixed
proposal_creation_timeAt the block the proposal is created
voting_startAt the submission-period opening block
block_heightAt an explicit block height referenced in the proposal record
Token transfers or delegation changes after the snapshot block do not alter a previously determined effective voting weight for that proposal.