Skip to content

SnsWrapper

Defined in: packages/canisters/src/sns/sns.wrapper.ts:68

Sns wrapper - notably used by NNS-dapp - ease the access to a particular Sns. It knows all the Sns’ canisters, wrap and enhance their available features. A wrapper either performs query or update calls.

new SnsWrapper(__namedParameters): SnsWrapper

Defined in: packages/canisters/src/sns/sns.wrapper.ts:79

Constructor to instantiate a Sns

SnsWrapperOptions

SnsWrapper

get canisterIds(): object

Defined in: packages/canisters/src/sns/sns.wrapper.ts:98

Binds the list of canister ids of the Sns.

object

governanceCanisterId: Principal

indexCanisterId: Principal

ledgerCanisterId: Principal

rootCanisterId: Principal

swapCanisterId: Principal

addNeuronPermissions(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:323

SnsNeuronPermissionsParams

Promise<void>


autoStakeMaturity(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:451

SnsNeuronAutoStakeMaturityParams

Promise<void>


balance(params): Promise<bigint>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:164

Omit<BalanceParams, "certified">

Promise<bigint>


claimNeuron(params): Promise<NeuronId>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:331

SnsClaimNeuronParams

Promise<NeuronId>


disburse(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:347

SnsDisburseNeuronParams

Promise<void>


disburseMaturity(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:447

SnsNeuronDisburseMaturityParams

Promise<void>


getDerivedState(params): Promise<GetDerivedStateResponse | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:432

Omit<QueryParams, "certified">

Promise<GetDerivedStateResponse | undefined>


getFinalizationStatus(params): Promise<GetAutoFinalizationStatusResponse | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:422

Omit<QueryParams, "certified">

Promise<GetAutoFinalizationStatusResponse | undefined>


getLifecycle(params): Promise<GetLifecycleResponse | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:417

Omit<QueryParams, "certified">

Promise<GetLifecycleResponse | undefined>


getNeuron(params): Promise<Neuron>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:173

Omit<SnsGetNeuronParams, "certified">

Promise<Neuron>


getNeuronBalance(neuronId): Promise<bigint>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:312

NeuronId

Promise<bigint>


getOpenTicket(params): Promise<Ticket | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:408

Omit<QueryParams, "certified">

Promise<Ticket | undefined>


getProposal(params): Promise<ProposalData>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:124

Omit<SnsGetProposalParams, "certified">

Promise<ProposalData>


getSaleParameters(params): Promise<GetSaleParametersResponse | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:427

Omit<QueryParams, "certified">

Promise<GetSaleParametersResponse | undefined>


getTransactions(params): Promise<GetTransactions>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:437

GetIndexAccountTransactionsParams

Promise<GetTransactions>


getUserCommitment(params): Promise<BuyerState | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:403

GetBuyerStateRequest

Promise<BuyerState | undefined>


increaseDissolveDelay(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:364

SnsIncreaseDissolveDelayParams

Promise<void>


increaseStakeNeuron(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:293

Increase the stake of a neuron.

This is a convenient method that transfers the stake to the neuron subaccount and then refresh the neuron.

⚠️ This feature is provided as it without warranty. It does not implement any additional checks of the validity of the payment flow - e.g. it does not handle refund nor calls refresh again in case of errors.

SnsIncreaseStakeNeuronParams

Promise<void>


ledgerMetadata(params): Promise<IcrcTokenMetadataResponse>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:149

Omit<QueryParams, "certified">

Promise<IcrcTokenMetadataResponse>


listNervousSystemFunctions(params): Promise<ListNervousSystemFunctionsResponse>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:129

Omit<QueryParams, "certified">

Promise<ListNervousSystemFunctionsResponse>


listNeurons(params): Promise<Neuron[]>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:114

Omit<SnsListNeuronsParams, "certified">

Promise<Neuron[]>


listProposals(params): Promise<ListProposalsResponse>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:119

Omit<SnsListProposalsParams, "certified">

Promise<ListProposalsResponse>


metadata(params): Promise<[GetMetadataResponse, IcrcTokenMetadataResponse]>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:134

Omit<QueryParams, "certified">

Promise<[GetMetadataResponse, IcrcTokenMetadataResponse]>


nervousSystemParameters(params): Promise<NervousSystemParameters>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:144

Omit<QueryParams, "certified">

Promise<NervousSystemParameters>


newSaleTicket(params): Promise<Ticket>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:414

NewSaleTicketParams

Promise<Ticket>


nextNeuronAccount(controller): Promise<{ account: IcrcAccount; index: bigint; }>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:199

Returns the subaccount of the next neuron to be created.

The neuron account is a subaccount of the governance canister. The subaccount is derived from the controller and an ascending index.

‼️ The id of the neuron is the subaccount (neuron ID = subaccount) ‼️.

If the neuron does not exist for that subaccount, then we use it for the next neuron.

The index is used in the memo of the transfer and when claiming the neuron. This is how the backend can identify which neuron is being claimed.

Principal

Promise<{ account: IcrcAccount; index: bigint; }>


notifyParticipation(params): Promise<RefreshBuyerTokensResponse>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:398

RefreshBuyerTokensRequest

Promise<RefreshBuyerTokensResponse>


notifyPaymentFailure(): Promise<Ticket | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:394

Returns the ticket if a ticket was found for the caller and the ticket was removed successfully. Returns None if no ticket was found for the caller. Only the owner of a ticket can remove it.

Always certified

Promise<Ticket | undefined>


queryNeuron(params): Promise<Neuron | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:178

Omit<SnsGetNeuronParams, "certified">

Promise<Neuron | undefined>


refreshNeuron(neuronId): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:327

NeuronId

Promise<void>


registerVote(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:377

SnsRegisterVoteParams

Promise<void>


removeNeuronPermissions(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:336

SnsNeuronPermissionsParams

Promise<void>


setDissolveTimestamp(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:359

SnsSetDissolveTimestampParams

Promise<void>


setFollowing(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:373

SnsSetFollowingParams

Promise<void>


setTopicFollowees(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:369

SnsSetTopicFollowees

Promise<void>


splitNeuron(params): Promise<NeuronId | undefined>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:341

SnsSplitNeuronParams

Promise<NeuronId | undefined>


stakeMaturity(params): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:443

SnsNeuronStakeMaturityParams

Promise<void>


stakeNeuron(params): Promise<NeuronId>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:246

Stakes a neuron.

This is a convenient method that transfers the stake to the neuron subaccount and then claims the neuron.

⚠️ This feature is provided as it without warranty. It does not implement any additional checks of the validity of the payment flow - e.g. it does not handle refund nor retries claiming the neuron in case of errors.

SnsStakeNeuronParams

Promise<NeuronId>


startDissolving(neuronId): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:351

NeuronId

Promise<void>


stopDissolving(neuronId): Promise<void>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:355

NeuronId

Promise<void>


swapState(params): Promise<GetStateResponse>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:380

Omit<QueryParams, "certified">

Promise<GetStateResponse>


totalTokensSupply(params): Promise<bigint>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:159

Omit<QueryParams, "certified">

Promise<bigint>


transactionFee(params): Promise<bigint>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:154

Omit<QueryParams, "certified">

Promise<bigint>


transfer(params): Promise<bigint>

Defined in: packages/canisters/src/sns/sns.wrapper.ts:170

TransferParams

Promise<bigint>