Skip to content

SnsWrapper

Defined in: packages/sns/src/sns.wrapper.ts:89

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/sns/src/sns.wrapper.ts:100

Constructor to instantiate a Sns

SnsWrapperOptions

SnsWrapper

get canisterIds(): object

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

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/sns/src/sns.wrapper.ts:336

SnsNeuronPermissionsParams

Promise<void>


autoStakeMaturity(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:460

SnsNeuronAutoStakeMaturityParams

Promise<void>


balance(params): Promise<bigint>

Defined in: packages/sns/src/sns.wrapper.ts:182

Omit<BalanceParams, "certified">

Promise<bigint>


claimNeuron(params): Promise<SnsNeuronId>

Defined in: packages/sns/src/sns.wrapper.ts:344

SnsClaimNeuronParams

Promise<SnsNeuronId>


disburse(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:357

SnsDisburseNeuronParams

Promise<void>


disburseMaturity(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:456

SnsNeuronDisburseMaturityParams

Promise<void>


getDerivedState(params): Promise<SnsGetDerivedStateResponse | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:441

Omit<QueryParams, "certified">

Promise<SnsGetDerivedStateResponse | undefined>


getFinalizationStatus(params): Promise<SnsGetAutoFinalizationStatusResponse | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:431

Omit<QueryParams, "certified">

Promise<SnsGetAutoFinalizationStatusResponse | undefined>


getLifecycle(params): Promise<SnsGetLifecycleResponse | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:426

Omit<QueryParams, "certified">

Promise<SnsGetLifecycleResponse | undefined>


getNeuron(params): Promise<SnsNeuron>

Defined in: packages/sns/src/sns.wrapper.ts:189

Omit<SnsGetNeuronParams, "certified">

Promise<SnsNeuron>


getNeuronBalance(neuronId): Promise<bigint>

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

SnsNeuronId

Promise<bigint>


getOpenTicket(params): Promise<SnsSwapTicket | undefined>

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

Omit<QueryParams, "certified">

Promise<SnsSwapTicket | undefined>


getProposal(params): Promise<SnsProposalData>

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

Omit<SnsGetProposalParams, "certified">

Promise<SnsProposalData>


getSaleParameters(params): Promise<SnsGetSaleParametersResponse | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:436

Omit<QueryParams, "certified">

Promise<SnsGetSaleParametersResponse | undefined>


getTransactions(params): Promise<GetTransactions>

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

GetAccountTransactionsParams

Promise<GetTransactions>


getUserCommitment(params): Promise<SnsSwapBuyerState | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:412

SnsGetBuyerStateRequest

Promise<SnsSwapBuyerState | undefined>


increaseDissolveDelay(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:374

SnsIncreaseDissolveDelayParams

Promise<void>


increaseStakeNeuron(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:308

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/sns/src/sns.wrapper.ts:167

Omit<QueryParams, "certified">

Promise<IcrcTokenMetadataResponse>


listNervousSystemFunctions(params): Promise<SnsListNervousSystemFunctionsResponse>

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

Omit<QueryParams, "certified">

Promise<SnsListNervousSystemFunctionsResponse>


listNeurons(params): Promise<SnsNeuron[]>

Defined in: packages/sns/src/sns.wrapper.ts:135

Omit<SnsListNeuronsParams, "certified">

Promise<SnsNeuron[]>


listProposals(params): Promise<SnsListProposalsResponse>

Defined in: packages/sns/src/sns.wrapper.ts:139

Omit<SnsListProposalsParams, "certified">

Promise<SnsListProposalsResponse>


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

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

Omit<QueryParams, "certified">

Promise<[SnsGetMetadataResponse, IcrcTokenMetadataResponse]>


nervousSystemParameters(params): Promise<SnsNervousSystemParameters>

Defined in: packages/sns/src/sns.wrapper.ts:162

Omit<QueryParams, "certified">

Promise<SnsNervousSystemParameters>


newSaleTicket(params): Promise<SnsSwapTicket>

Defined in: packages/sns/src/sns.wrapper.ts:423

NewSaleTicketParams

Promise<SnsSwapTicket>


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

Defined in: packages/sns/src/sns.wrapper.ts:214

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<SnsRefreshBuyerTokensResponse>

Defined in: packages/sns/src/sns.wrapper.ts:407

RefreshBuyerTokensRequest

Promise<SnsRefreshBuyerTokensResponse>


notifyPaymentFailure(): Promise<SnsSwapTicket | undefined>

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

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<SnsSwapTicket | undefined>


queryNeuron(params): Promise<SnsNeuron | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:193

Omit<SnsGetNeuronParams, "certified">

Promise<SnsNeuron | undefined>


refreshNeuron(neuronId): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:340

SnsNeuronId

Promise<void>


registerVote(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:387

SnsRegisterVoteParams

Promise<void>


removeNeuronPermissions(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:348

SnsNeuronPermissionsParams

Promise<void>


setDissolveTimestamp(params): Promise<void>

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

SnsSetDissolveTimestampParams

Promise<void>


setFollowing(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:383

SnsSetFollowingParams

Promise<void>


setTopicFollowees(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:379

SnsSetTopicFollowees

Promise<void>


splitNeuron(params): Promise<SnsNeuronId | undefined>

Defined in: packages/sns/src/sns.wrapper.ts:353

SnsSplitNeuronParams

Promise<SnsNeuronId | undefined>


stakeMaturity(params): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:452

SnsNeuronStakeMaturityParams

Promise<void>


stakeNeuron(params): Promise<SnsNeuronId>

Defined in: packages/sns/src/sns.wrapper.ts:261

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<SnsNeuronId>


startDissolving(neuronId): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:361

SnsNeuronId

Promise<void>


stopDissolving(neuronId): Promise<void>

Defined in: packages/sns/src/sns.wrapper.ts:365

SnsNeuronId

Promise<void>


swapState(params): Promise<GetStateResponse>

Defined in: packages/sns/src/sns.wrapper.ts:390

Omit<QueryParams, "certified">

Promise<GetStateResponse>


totalTokensSupply(params): Promise<bigint>

Defined in: packages/sns/src/sns.wrapper.ts:177

Omit<QueryParams, "certified">

Promise<bigint>


transactionFee(params): Promise<bigint>

Defined in: packages/sns/src/sns.wrapper.ts:172

Omit<QueryParams, "certified">

Promise<bigint>


transfer(params): Promise<bigint>

Defined in: packages/sns/src/sns.wrapper.ts:186

TransferParams

Promise<bigint>