@dfinity/sns 6.0.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +54 -19
  3. package/dist/index.js +1 -6
  4. package/dist/index.js.map +4 -4
  5. package/dist/index.mjs +1 -6
  6. package/dist/index.mjs.map +4 -4
  7. package/package.json +3 -8
  8. package/dist/candid/sns_governance.certified.idl.d.ts +0 -2
  9. package/dist/candid/sns_governance.certified.idl.js +0 -1432
  10. package/dist/candid/sns_governance.d.ts +0 -933
  11. package/dist/candid/sns_governance.did +0 -1069
  12. package/dist/candid/sns_governance.idl.d.ts +0 -2
  13. package/dist/candid/sns_governance.idl.js +0 -1440
  14. package/dist/candid/sns_governance_test.certified.idl.d.ts +0 -2
  15. package/dist/candid/sns_governance_test.certified.idl.js +0 -1460
  16. package/dist/candid/sns_governance_test.d.ts +0 -962
  17. package/dist/candid/sns_governance_test.did +0 -1094
  18. package/dist/candid/sns_governance_test.idl.d.ts +0 -2
  19. package/dist/candid/sns_governance_test.idl.js +0 -1468
  20. package/dist/candid/sns_root.certified.idl.d.ts +0 -2
  21. package/dist/candid/sns_root.certified.idl.js +0 -251
  22. package/dist/candid/sns_root.d.ts +0 -212
  23. package/dist/candid/sns_root.did +0 -231
  24. package/dist/candid/sns_root.idl.d.ts +0 -2
  25. package/dist/candid/sns_root.idl.js +0 -251
  26. package/dist/candid/sns_swap.certified.idl.d.ts +0 -2
  27. package/dist/candid/sns_swap.certified.idl.js +0 -499
  28. package/dist/candid/sns_swap.d.ts +0 -438
  29. package/dist/candid/sns_swap.did +0 -505
  30. package/dist/candid/sns_swap.idl.d.ts +0 -2
  31. package/dist/candid/sns_swap.idl.js +0 -507
  32. package/dist/constants/governance.constants.d.ts +0 -8
  33. package/dist/converters/governance.converters.d.ts +0 -22
  34. package/dist/converters/swap.converters.d.ts +0 -3
  35. package/dist/enums/governance.enums.d.ts +0 -35
  36. package/dist/enums/swap.enums.d.ts +0 -22
  37. package/dist/errors/common.errors.d.ts +0 -4
  38. package/dist/errors/governance.errors.d.ts +0 -2
  39. package/dist/errors/swap.errors.d.ts +0 -16
  40. package/dist/governance.canister.d.ts +0 -138
  41. package/dist/governance_test.canister.d.ts +0 -16
  42. package/dist/root.canister.d.ts +0 -19
  43. package/dist/sns.d.ts +0 -21
  44. package/dist/sns.wrapper.d.ts +0 -160
  45. package/dist/swap.canister.d.ts +0 -47
  46. package/dist/types/actions.d.ts +0 -191
  47. package/dist/types/canister.options.d.ts +0 -5
  48. package/dist/types/common.d.ts +0 -2
  49. package/dist/types/governance.params.d.ts +0 -151
  50. package/dist/types/governance_test.params.d.ts +0 -7
  51. package/dist/types/swap.params.d.ts +0 -8
  52. package/dist/utils/error.utils.d.ts +0 -12
  53. package/dist/utils/governance.utils.d.ts +0 -14
@@ -1,138 +0,0 @@
1
- import { Canister, type QueryParams } from "@dfinity/utils";
2
- import type { GetMetadataResponse, ListNervousSystemFunctionsResponse, ListProposalsResponse, ListTopicsResponse, ManageNeuron, ManageNeuronResponse, NervousSystemParameters, Neuron, NeuronId, ProposalData, _SERVICE as SnsGovernanceService } from "./candid/sns_governance";
3
- import type { SnsCanisterOptions } from "./types/canister.options";
4
- import type { SnsClaimNeuronParams, SnsDisburseNeuronParams, SnsGetNeuronParams, SnsGetProposalParams, SnsIncreaseDissolveDelayParams, SnsListNeuronsParams, SnsListProposalsParams, SnsListTopicsParams, SnsNeuronAutoStakeMaturityParams, SnsNeuronDisburseMaturityParams, SnsNeuronPermissionsParams, SnsNeuronStakeMaturityParams, SnsRegisterVoteParams, SnsSetDissolveTimestampParams, SnsSetFollowingParams, SnsSetTopicFollowees, SnsSplitNeuronParams } from "./types/governance.params";
5
- export declare class SnsGovernanceCanister extends Canister<SnsGovernanceService> {
6
- /**
7
- * Instantiate a canister to interact with the governance of a Sns project.
8
- *
9
- * @param {SnsCanisterOptions} options Miscellaneous options to initialize the canister. Its ID being the only mandatory parammeter.
10
- */
11
- static create(options: SnsCanisterOptions<SnsGovernanceService>): SnsGovernanceCanister;
12
- /**
13
- * List the neurons of the Sns
14
- */
15
- listNeurons: (params: SnsListNeuronsParams) => Promise<Neuron[]>;
16
- /**
17
- * List the proposals of the Sns
18
- */
19
- listProposals: (params: SnsListProposalsParams) => Promise<ListProposalsResponse>;
20
- /**
21
- *
22
- * List the topics of the Sns
23
- */
24
- listTopics: (params: SnsListTopicsParams) => Promise<ListTopicsResponse>;
25
- /**
26
- * Get the proposal of the Sns
27
- */
28
- getProposal: (params: SnsGetProposalParams) => Promise<ProposalData>;
29
- /**
30
- * List Nervous System Functions
31
- * Neurons can follow other neurons in specific Nervous System Functions.
32
- */
33
- listNervousSystemFunctions: (params: QueryParams) => Promise<ListNervousSystemFunctionsResponse>;
34
- /**
35
- * Get the Sns metadata (title, description, etc.)
36
- */
37
- metadata: (params: QueryParams) => Promise<GetMetadataResponse>;
38
- /**
39
- * Get the Sns nervous system parameters (default followees, max dissolve delay, max number of neurons, etc.)
40
- */
41
- nervousSystemParameters: (params: QueryParams) => Promise<NervousSystemParameters>;
42
- /**
43
- * Get the neuron of the Sns
44
- */
45
- getNeuron: (params: SnsGetNeuronParams) => Promise<Neuron>;
46
- /**
47
- * Same as `getNeuron` but returns undefined instead of raising error when not found.
48
- */
49
- queryNeuron: (params: SnsGetNeuronParams) => Promise<Neuron | undefined>;
50
- /**
51
- * Manage neuron. For advanced users.
52
- */
53
- manageNeuron: (request: ManageNeuron) => Promise<ManageNeuronResponse>;
54
- /**
55
- * Add permissions to a neuron for a specific principal
56
- */
57
- addNeuronPermissions: (params: SnsNeuronPermissionsParams) => Promise<void>;
58
- /**
59
- * Remove permissions to a neuron for a specific principal
60
- */
61
- removeNeuronPermissions: (params: SnsNeuronPermissionsParams) => Promise<void>;
62
- /**
63
- * Split neuron
64
- */
65
- splitNeuron: (params: SnsSplitNeuronParams) => Promise<NeuronId | undefined>;
66
- /**
67
- * Disburse neuron on Account
68
- */
69
- disburse: (params: SnsDisburseNeuronParams) => Promise<void>;
70
- /**
71
- * Start dissolving process of a neuron
72
- */
73
- startDissolving: (neuronId: NeuronId) => Promise<void>;
74
- /**
75
- * Stop dissolving process of a neuron
76
- */
77
- stopDissolving: (neuronId: NeuronId) => Promise<void>;
78
- /**
79
- * Stake the maturity of a neuron.
80
- *
81
- * @param {neuronId: NeuronId; percentageToStake: number;} params
82
- * @param {NeuronId} neuronId The id of the neuron for which to stake the maturity
83
- * @param {number} percentageToStake Optional. Percentage of the current maturity to stake. If not provided, all of the neuron's current maturity will be staked.
84
- */
85
- stakeMaturity: ({ neuronId, percentageToStake, }: SnsNeuronStakeMaturityParams) => Promise<void>;
86
- /**
87
- * Disburse the maturity of a neuron.
88
- *
89
- * @param {neuronId: NeuronId; toAccount?: IcrcAccount; percentageToDisburse: number; } params
90
- * @param {IcrcAccount} toAccount. Account to disburse maturity.
91
- * @param {NeuronId} neuronId The id of the neuron for which to disburse the maturity
92
- * @param {number} percentageToDisburse What percentage of the available maturity to disburse.
93
- */
94
- disburseMaturity: (params: SnsNeuronDisburseMaturityParams) => Promise<void>;
95
- /**
96
- * Changes auto-stake maturity for a Neuron.
97
- *
98
- * @param {neuronId: NeuronId; autoStake: boolean;} params
99
- * @param {NeuronId} neuronId The id of the neuron for which to request a change of the auto stake feature
100
- * @param {number} autoStake `true` to enable the auto-stake maturity for this neuron, `false` to turn it off
101
- */
102
- autoStakeMaturity: (params: SnsNeuronAutoStakeMaturityParams) => Promise<void>;
103
- /**
104
- * Increase dissolve delay of a neuron
105
- */
106
- setDissolveTimestamp: (params: SnsSetDissolveTimestampParams) => Promise<void>;
107
- /**
108
- * Increase dissolve delay of a neuron
109
- */
110
- increaseDissolveDelay: (params: SnsIncreaseDissolveDelayParams) => Promise<void>;
111
- /**
112
- * Sets followees of a neuron for a specific Nervous System Function
113
- * @deprecated will be replaced by `setFollowing` in the future.
114
- */
115
- setTopicFollowees: (params: SnsSetTopicFollowees) => Promise<void>;
116
- /**
117
- * Sets followees of a neuron for topics
118
- */
119
- setFollowing: (params: SnsSetFollowingParams) => Promise<void>;
120
- /**
121
- * Registers vote for a proposal from the neuron passed.
122
- */
123
- registerVote: (params: SnsRegisterVoteParams) => Promise<void>;
124
- /**
125
- * Refresh neuron
126
- */
127
- refreshNeuron: (neuronId: NeuronId) => Promise<void>;
128
- /**
129
- * Claim neuron
130
- */
131
- claimNeuron: ({ memo, controller, subaccount, }: SnsClaimNeuronParams) => Promise<NeuronId>;
132
- /**
133
- *
134
- * @param response ManageNeuronResponse
135
- * @throws SnsGovernanceError
136
- */
137
- private assertManageNeuronError;
138
- }
@@ -1,16 +0,0 @@
1
- import { Canister } from "@dfinity/utils";
2
- import type { _SERVICE as SnsGovernanceTestService } from "./candid/sns_governance_test";
3
- import type { SnsCanisterOptions } from "./types/canister.options";
4
- import type { SnsAddMaturityParams } from "./types/governance_test.params";
5
- export declare class SnsGovernanceTestCanister extends Canister<SnsGovernanceTestService> {
6
- /**
7
- * Instantiate a canister to interact with the governance of a Sns project.
8
- *
9
- * @param {SnsCanisterOptions} options Miscellaneous options to initialize the canister. Its ID being the only mandatory parammeter.
10
- */
11
- static create(options: SnsCanisterOptions<SnsGovernanceTestService>): SnsGovernanceTestCanister;
12
- /**
13
- * Add maturity to a neuron (only for testing purposes. Testnet only.)
14
- */
15
- addMaturity: (params: SnsAddMaturityParams) => Promise<void>;
16
- }
@@ -1,19 +0,0 @@
1
- import { Canister } from "@dfinity/utils";
2
- import type { ListSnsCanistersResponse, _SERVICE as SnsRootService } from "./candid/sns_root";
3
- import type { SnsCanisterOptions } from "./types/canister.options";
4
- export declare class SnsRootCanister extends Canister<SnsRootService> {
5
- static create(options: SnsCanisterOptions<SnsRootService>): SnsRootCanister;
6
- /**
7
- * List the canisters that are part of the Sns.
8
- *
9
- * Source code: https://github.com/dfinity/ic/blob/master/rs/sns/root/src/lib.rs
10
- *
11
- * @param {Object} params
12
- * @param {boolean} [params.certified=true] - Query or update calls
13
- *
14
- * @returns {ListSnsCanistersResponse} - A list of canisters ('root' | 'governance' | 'ledger' | 'dapps' | 'swap' | 'archives')
15
- */
16
- listSnsCanisters: ({ certified, }: {
17
- certified?: boolean;
18
- }) => Promise<ListSnsCanistersResponse>;
19
- }
package/dist/sns.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { type QueryParams } from "@dfinity/utils";
2
- import type { Agent } from "@icp-sdk/core/agent";
3
- import type { _SERVICE as SnsRootService } from "./candid/sns_root";
4
- import { SnsWrapper } from "./sns.wrapper";
5
- import type { SnsCanisterOptions } from "./types/canister.options";
6
- /**
7
- * Options to discover and initialize all canisters of a Sns.
8
- */
9
- export interface InitSnsCanistersOptions extends QueryParams {
10
- /** An agent that can be used to override the default agent. Useful to target another environment that mainnet. */
11
- agent?: Agent;
12
- /** The options that will be used to instantiate the actors of the root canister of the particular Sns. */
13
- rootOptions: Omit<SnsCanisterOptions<SnsRootService>, "agent">;
14
- }
15
- export interface InitSnsWrapper {
16
- (options: InitSnsCanistersOptions): Promise<SnsWrapper>;
17
- }
18
- /**
19
- * Lookup for the canister ids of a Sns and initialize the wrapper to access its features.
20
- */
21
- export declare const initSnsWrapper: InitSnsWrapper;
@@ -1,160 +0,0 @@
1
- import type { BalanceParams, GetAccountTransactionsParams, IcrcAccount, IcrcBlockIndex, IcrcGetTransactions, IcrcIndexCanister, IcrcLedgerCanister, IcrcTokenMetadataResponse, IcrcTokens, TransferParams } from "@dfinity/ledger-icrc";
2
- import { type QueryParams } from "@dfinity/utils";
3
- import type { Principal } from "@icp-sdk/core/principal";
4
- import type { GetMetadataResponse, ListNervousSystemFunctionsResponse, ListProposalsResponse, NervousSystemParameters, Neuron, NeuronId, ProposalData } from "./candid/sns_governance";
5
- import type { BuyerState, GetAutoFinalizationStatusResponse, GetBuyerStateRequest, GetDerivedStateResponse, GetLifecycleResponse, GetSaleParametersResponse, GetStateResponse, RefreshBuyerTokensRequest, RefreshBuyerTokensResponse, Ticket } from "./candid/sns_swap";
6
- import type { SnsGovernanceCanister } from "./governance.canister";
7
- import type { SnsRootCanister } from "./root.canister";
8
- import type { SnsSwapCanister } from "./swap.canister";
9
- import type { SnsClaimNeuronParams, SnsDisburseNeuronParams, SnsGetNeuronParams, SnsGetProposalParams, SnsIncreaseDissolveDelayParams, SnsIncreaseStakeNeuronParams, SnsListNeuronsParams, SnsListProposalsParams, SnsNeuronAutoStakeMaturityParams, SnsNeuronDisburseMaturityParams, SnsNeuronPermissionsParams, SnsNeuronStakeMaturityParams, SnsRegisterVoteParams, SnsSetDissolveTimestampParams, SnsSetFollowingParams, SnsSetTopicFollowees, SnsSplitNeuronParams, SnsStakeNeuronParams } from "./types/governance.params";
10
- import type { NewSaleTicketParams } from "./types/swap.params";
11
- interface SnsWrapperOptions {
12
- /** The wrapper for the "root" canister of the particular Sns */
13
- root: SnsRootCanister;
14
- /** The wrapper for the "governance" canister of the particular Sns */
15
- governance: SnsGovernanceCanister;
16
- /** The wrapper for the "ledger" canister of the particular Sns */
17
- ledger: IcrcLedgerCanister;
18
- /** The wrapper for the "swap" canister of the particular Sns */
19
- swap: SnsSwapCanister;
20
- /** The wrapper for the "index" canister of the particular Sns */
21
- index: IcrcIndexCanister;
22
- /** The wrapper has been instantiated and should perform query or update calls */
23
- certified: boolean;
24
- }
25
- /**
26
- * Sns wrapper - notably used by NNS-dapp - ease the access to a particular Sns.
27
- * It knows all the Sns' canisters, wrap and enhance their available features.
28
- * A wrapper either performs query or update calls.
29
- */
30
- export declare class SnsWrapper {
31
- private readonly root;
32
- private readonly governance;
33
- private readonly ledger;
34
- private readonly swap;
35
- private readonly index;
36
- private readonly certified;
37
- /**
38
- * Constructor to instantiate a Sns
39
- */
40
- constructor({ root, governance, ledger, swap, index, certified, }: SnsWrapperOptions);
41
- /**
42
- * Binds the list of canister ids of the Sns.
43
- */
44
- get canisterIds(): {
45
- rootCanisterId: Principal;
46
- ledgerCanisterId: Principal;
47
- governanceCanisterId: Principal;
48
- swapCanisterId: Principal;
49
- indexCanisterId: Principal;
50
- };
51
- listNeurons: (params: Omit<SnsListNeuronsParams, "certified">) => Promise<Neuron[]>;
52
- listProposals: (params: Omit<SnsListProposalsParams, "certified">) => Promise<ListProposalsResponse>;
53
- getProposal: (params: Omit<SnsGetProposalParams, "certified">) => Promise<ProposalData>;
54
- listNervousSystemFunctions: (params: Omit<QueryParams, "certified">) => Promise<ListNervousSystemFunctionsResponse>;
55
- metadata: (params: Omit<QueryParams, "certified">) => Promise<[GetMetadataResponse, IcrcTokenMetadataResponse]>;
56
- nervousSystemParameters: (params: Omit<QueryParams, "certified">) => Promise<NervousSystemParameters>;
57
- ledgerMetadata: (params: Omit<QueryParams, "certified">) => Promise<IcrcTokenMetadataResponse>;
58
- transactionFee: (params: Omit<QueryParams, "certified">) => Promise<IcrcTokens>;
59
- totalTokensSupply: (params: Omit<QueryParams, "certified">) => Promise<IcrcTokens>;
60
- balance: (params: Omit<BalanceParams, "certified">) => Promise<IcrcTokens>;
61
- transfer: (params: TransferParams) => Promise<IcrcBlockIndex>;
62
- getNeuron: (params: Omit<SnsGetNeuronParams, "certified">) => Promise<Neuron>;
63
- queryNeuron: (params: Omit<SnsGetNeuronParams, "certified">) => Promise<Neuron | undefined>;
64
- /**
65
- * Returns the subaccount of the next neuron to be created.
66
- *
67
- * The neuron account is a subaccount of the governance canister.
68
- * The subaccount is derived from the controller and an ascending index.
69
- *
70
- * ‼️ The id of the neuron is the subaccount (neuron ID = subaccount) ‼️.
71
- *
72
- * If the neuron does not exist for that subaccount, then we use it for the next neuron.
73
- *
74
- * The index is used in the memo of the transfer and when claiming the neuron.
75
- * This is how the backend can identify which neuron is being claimed.
76
- *
77
- * @param controller
78
- * @returns
79
- */
80
- nextNeuronAccount: (controller: Principal) => Promise<{
81
- account: IcrcAccount;
82
- index: bigint;
83
- }>;
84
- /**
85
- * Stakes a neuron.
86
- *
87
- * This is a convenient method that transfers the stake to the neuron subaccount and then claims the neuron.
88
- *
89
- * ⚠️ 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.
90
- *
91
- * @param {SnsStakeNeuronParams} params
92
- * @param {Principal} params.controller
93
- * @param {bigint} params.stakeE8s
94
- * @param {source} params.source
95
- * @returns {NeuronId}
96
- */
97
- stakeNeuron: ({ stakeE8s, source, controller, createdAt, fee, }: SnsStakeNeuronParams) => Promise<NeuronId>;
98
- /**
99
- * Increase the stake of a neuron.
100
- *
101
- * This is a convenient method that transfers the stake to the neuron subaccount and then refresh the neuron.
102
- *
103
- * ⚠️ 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.
104
- *
105
- * @param {SnsStakeNeuronParams} params
106
- * @param {Principal} params.controller
107
- * @param {bigint} params.stakeE8s
108
- * @param {source} params.source
109
- * @returns {NeuronId}
110
- */
111
- increaseStakeNeuron: ({ stakeE8s, source, neuronId, }: SnsIncreaseStakeNeuronParams) => Promise<void>;
112
- getNeuronBalance: (neuronId: NeuronId) => Promise<IcrcTokens>;
113
- addNeuronPermissions: (params: SnsNeuronPermissionsParams) => Promise<void>;
114
- refreshNeuron: (neuronId: NeuronId) => Promise<void>;
115
- claimNeuron: (params: SnsClaimNeuronParams) => Promise<NeuronId>;
116
- removeNeuronPermissions: (params: SnsNeuronPermissionsParams) => Promise<void>;
117
- splitNeuron: (params: SnsSplitNeuronParams) => Promise<NeuronId | undefined>;
118
- disburse: (params: SnsDisburseNeuronParams) => Promise<void>;
119
- startDissolving: (neuronId: NeuronId) => Promise<void>;
120
- stopDissolving: (neuronId: NeuronId) => Promise<void>;
121
- setDissolveTimestamp: (params: SnsSetDissolveTimestampParams) => Promise<void>;
122
- increaseDissolveDelay: (params: SnsIncreaseDissolveDelayParams) => Promise<void>;
123
- setTopicFollowees: (params: SnsSetTopicFollowees) => Promise<void>;
124
- setFollowing: (params: SnsSetFollowingParams) => Promise<void>;
125
- registerVote: (params: SnsRegisterVoteParams) => Promise<void>;
126
- swapState: (params: Omit<QueryParams, "certified">) => Promise<GetStateResponse>;
127
- /**
128
- * Returns the ticket if a ticket was found for the caller and the ticket
129
- * was removed successfully. Returns None if no ticket was found for the caller.
130
- * Only the owner of a ticket can remove it.
131
- *
132
- * Always certified
133
- *
134
- * @param params
135
- */
136
- notifyPaymentFailure: () => Promise<Ticket | undefined>;
137
- notifyParticipation: (params: RefreshBuyerTokensRequest) => Promise<RefreshBuyerTokensResponse>;
138
- getUserCommitment: (params: GetBuyerStateRequest) => Promise<BuyerState | undefined>;
139
- getOpenTicket: (params: Omit<QueryParams, "certified">) => Promise<Ticket | undefined>;
140
- newSaleTicket: (params: NewSaleTicketParams) => Promise<Ticket>;
141
- getLifecycle: (params: Omit<QueryParams, "certified">) => Promise<GetLifecycleResponse | undefined>;
142
- getFinalizationStatus: (params: Omit<QueryParams, "certified">) => Promise<GetAutoFinalizationStatusResponse | undefined>;
143
- getSaleParameters: (params: Omit<QueryParams, "certified">) => Promise<GetSaleParametersResponse | undefined>;
144
- getDerivedState: (params: Omit<QueryParams, "certified">) => Promise<GetDerivedStateResponse | undefined>;
145
- getTransactions: (params: GetAccountTransactionsParams) => Promise<IcrcGetTransactions>;
146
- stakeMaturity: (params: SnsNeuronStakeMaturityParams) => Promise<void>;
147
- disburseMaturity: (params: SnsNeuronDisburseMaturityParams) => Promise<void>;
148
- autoStakeMaturity: (params: SnsNeuronAutoStakeMaturityParams) => Promise<void>;
149
- private mergeParams;
150
- private assertCertified;
151
- /**
152
- * Each Sns neuron id is a subaccount of the related Sns ledger account of the Sns governance canister.
153
- *
154
- * In other words, the Sns governance canister is the owner. It has an account in the related Sns ledger and each neuron is both a child of the Sns governance canister and a subaccount in the Sns ledger.
155
- *
156
- * @private
157
- */
158
- private get owner();
159
- }
160
- export {};
@@ -1,47 +0,0 @@
1
- import { Canister, type QueryParams } from "@dfinity/utils";
2
- import type { BuyerState, GetAutoFinalizationStatusResponse, GetBuyerStateRequest, GetDerivedStateResponse, GetLifecycleResponse, GetSaleParametersResponse, GetStateResponse, RefreshBuyerTokensRequest, RefreshBuyerTokensResponse, _SERVICE as SnsSwapService, Ticket } from "./candid/sns_swap";
3
- import type { SnsCanisterOptions } from "./types/canister.options";
4
- import type { NewSaleTicketParams } from "./types/swap.params";
5
- export declare class SnsSwapCanister extends Canister<SnsSwapService> {
6
- static create(options: SnsCanisterOptions<SnsSwapService>): SnsSwapCanister;
7
- /**
8
- * Get the state of the swap
9
- */
10
- state: (params: QueryParams) => Promise<GetStateResponse>;
11
- /**
12
- * Notify of the payment failure to remove the ticket
13
- */
14
- notifyPaymentFailure: () => Promise<Ticket | undefined>;
15
- /**
16
- * Notify of the user participating in the swap
17
- */
18
- notifyParticipation: (params: RefreshBuyerTokensRequest) => Promise<RefreshBuyerTokensResponse>;
19
- /**
20
- * Get user commitment
21
- */
22
- getUserCommitment: (params: GetBuyerStateRequest & QueryParams) => Promise<BuyerState | undefined>;
23
- /**
24
- * Get sale buyers state
25
- */
26
- getDerivedState: ({ certified, }: QueryParams) => Promise<GetDerivedStateResponse>;
27
- /**
28
- * Get sale parameters
29
- */
30
- getSaleParameters: ({ certified, }: QueryParams) => Promise<GetSaleParametersResponse>;
31
- /**
32
- * Return a sale ticket if created and not yet removed (payment flow)
33
- */
34
- getOpenTicket: (params: QueryParams) => Promise<Ticket | undefined>;
35
- /**
36
- * Create a sale ticket (payment flow)
37
- */
38
- newSaleTicket: (params: NewSaleTicketParams) => Promise<Ticket>;
39
- /**
40
- * Get sale lifecycle state
41
- */
42
- getLifecycle: (params: QueryParams) => Promise<GetLifecycleResponse>;
43
- /**
44
- * Get sale lifecycle state
45
- */
46
- getFinalizationStatus: (params: QueryParams) => Promise<GetAutoFinalizationStatusResponse>;
47
- }
@@ -1,191 +0,0 @@
1
- import type { Principal } from "@icp-sdk/core/principal";
2
- import type { DefaultFollowees, DeregisterDappCanisters, ExecuteGenericNervousSystemFunction, ExtensionInit, Motion, NeuronPermissionList, RegisterDappCanisters, Subaccount, Topic } from "../candid/sns_governance";
3
- import type { Option } from "./common";
4
- export type Action = {
5
- ManageNervousSystemParameters: NervousSystemParameters;
6
- } | {
7
- AddGenericNervousSystemFunction: NervousSystemFunction;
8
- } | {
9
- AdvanceSnsTargetVersion: AdvanceSnsTargetVersion;
10
- } | {
11
- ExecuteExtensionOperation: ExecuteExtensionOperation;
12
- } | {
13
- UpgradeExtension: UpgradeExtension;
14
- } | {
15
- MintSnsTokens: MintSnsTokens;
16
- } | {
17
- ManageLedgerParameters: ManageLedgerParameters;
18
- } | {
19
- ManageDappCanisterSettings: ManageDappCanisterSettings;
20
- } | {
21
- SetTopicsForCustomProposals: SetTopicsForCustomProposals;
22
- } | {
23
- RemoveGenericNervousSystemFunction: bigint;
24
- } | {
25
- UpgradeSnsToNextVersion: Record<string, never>;
26
- } | {
27
- RegisterDappCanisters: RegisterDappCanisters;
28
- } | {
29
- RegisterExtension: RegisterExtension;
30
- } | {
31
- TransferSnsTreasuryFunds: TransferSnsTreasuryFunds;
32
- } | {
33
- UpgradeSnsControlledCanister: UpgradeSnsControlledCanister;
34
- } | {
35
- DeregisterDappCanisters: DeregisterDappCanisters;
36
- } | {
37
- Unspecified: Record<string, never>;
38
- } | {
39
- ManageSnsMetadata: ManageSnsMetadata;
40
- } | {
41
- ExecuteGenericNervousSystemFunction: ExecuteGenericNervousSystemFunction;
42
- } | {
43
- Motion: Motion;
44
- };
45
- export interface NervousSystemParameters {
46
- default_followees: Option<DefaultFollowees>;
47
- max_dissolve_delay_seconds: Option<bigint>;
48
- max_dissolve_delay_bonus_percentage: Option<bigint>;
49
- max_followees_per_function: Option<bigint>;
50
- neuron_claimer_permissions: Option<NeuronPermissionList>;
51
- neuron_minimum_stake_e8s: Option<bigint>;
52
- max_neuron_age_for_age_bonus: Option<bigint>;
53
- initial_voting_period_seconds: Option<bigint>;
54
- neuron_minimum_dissolve_delay_to_vote_seconds: Option<bigint>;
55
- reject_cost_e8s: Option<bigint>;
56
- max_proposals_to_keep_per_action: Option<number>;
57
- wait_for_quiet_deadline_increase_seconds: Option<bigint>;
58
- max_number_of_neurons: Option<bigint>;
59
- transaction_fee_e8s: Option<bigint>;
60
- max_number_of_proposals_with_ballots: Option<bigint>;
61
- max_age_bonus_percentage: Option<bigint>;
62
- neuron_grantable_permissions: Option<NeuronPermissionList>;
63
- voting_rewards_parameters: Option<VotingRewardsParameters>;
64
- max_number_of_principals_per_neuron: Option<bigint>;
65
- automatically_advance_target_version: Option<boolean>;
66
- }
67
- export interface VotingRewardsParameters {
68
- final_reward_rate_basis_points: Option<bigint>;
69
- initial_reward_rate_basis_points: Option<bigint>;
70
- reward_rate_transition_duration_seconds: Option<bigint>;
71
- round_duration_seconds: Option<bigint>;
72
- }
73
- export interface NervousSystemFunction {
74
- id: bigint;
75
- name: string;
76
- description: Option<string>;
77
- function_type: Option<FunctionType>;
78
- }
79
- export interface SetTopicsForCustomProposals {
80
- custom_function_id_to_topic: Array<[bigint, Topic]>;
81
- }
82
- export type FunctionType = {
83
- NativeNervousSystemFunction: Record<string, never>;
84
- } | {
85
- GenericNervousSystemFunction: GenericNervousSystemFunction;
86
- };
87
- export interface GenericNervousSystemFunction {
88
- validator_canister_id: Option<Principal>;
89
- target_canister_id: Option<Principal>;
90
- validator_method_name: Option<string>;
91
- target_method_name: Option<string>;
92
- topic: Option<Topic>;
93
- }
94
- export interface ExecuteExtensionOperation {
95
- extension_canister_id: Option<Principal>;
96
- operation_name: Option<string>;
97
- operation_arg: Option<ExtensionOperationArg>;
98
- }
99
- export interface AdvanceSnsTargetVersion {
100
- new_target: Option<SnsVersion>;
101
- }
102
- export interface SnsVersion {
103
- archive_wasm_hash: Option<Uint8Array | number[]>;
104
- root_wasm_hash: Option<Uint8Array | number[]>;
105
- swap_wasm_hash: Option<Uint8Array | number[]>;
106
- ledger_wasm_hash: Option<Uint8Array | number[]>;
107
- governance_wasm_hash: Option<Uint8Array | number[]>;
108
- index_wasm_hash: Option<Uint8Array | number[]>;
109
- }
110
- export interface MintSnsTokens {
111
- to_principal: Option<Principal>;
112
- to_subaccount: Option<Subaccount>;
113
- memo: Option<bigint>;
114
- amount_e8s: Option<bigint>;
115
- }
116
- export type PreciseValue = {
117
- Int: bigint;
118
- } | {
119
- Map: Array<[string, PreciseValue]>;
120
- } | {
121
- Nat: bigint;
122
- } | {
123
- Blob: Uint8Array | number[];
124
- } | {
125
- Bool: boolean;
126
- } | {
127
- Text: string;
128
- } | {
129
- Array: PreciseValue[];
130
- };
131
- export interface ExtensionOperationArg {
132
- value: Option<PreciseValue>;
133
- }
134
- export type Wasm = {
135
- Chunked: ChunkedCanisterWasm;
136
- } | {
137
- Bytes: Uint8Array | number[];
138
- };
139
- export interface UpgradeExtension {
140
- extension_canister_id: Option<Principal>;
141
- wasm: Option<Wasm>;
142
- canister_upgrade_arg: Option<ExtensionUpgradeArg>;
143
- }
144
- export interface ExtensionUpgradeArg {
145
- value: Option<PreciseValue>;
146
- }
147
- export interface ManageDappCanisterSettings {
148
- freezing_threshold: Option<bigint>;
149
- wasm_memory_threshold: Option<bigint>;
150
- canister_ids: Principal[];
151
- reserved_cycles_limit: Option<bigint>;
152
- log_visibility: Option<number>;
153
- wasm_memory_limit: Option<bigint>;
154
- memory_allocation: Option<bigint>;
155
- compute_allocation: Option<bigint>;
156
- }
157
- export interface ManageLedgerParameters {
158
- token_symbol: Option<string>;
159
- transfer_fee: Option<bigint>;
160
- token_logo: Option<string>;
161
- token_name: Option<string>;
162
- }
163
- export interface TransferSnsTreasuryFunds {
164
- from_treasury: number;
165
- to_principal: Option<Principal>;
166
- to_subaccount: Option<Subaccount>;
167
- memo: Option<bigint>;
168
- amount_e8s: bigint;
169
- }
170
- export interface ChunkedCanisterWasm {
171
- wasm_module_hash: Uint8Array | number[];
172
- store_canister_id: Option<Principal>;
173
- chunk_hashes_list: Array<Uint8Array | number[]>;
174
- }
175
- export interface UpgradeSnsControlledCanister {
176
- new_canister_wasm: Uint8Array | number[];
177
- chunked_canister_wasm: Option<ChunkedCanisterWasm>;
178
- canister_id: Option<Principal>;
179
- canister_upgrade_arg: Option<Uint8Array | number[]>;
180
- mode: Option<number>;
181
- }
182
- export interface ManageSnsMetadata {
183
- url: Option<string>;
184
- logo: Option<string>;
185
- name: Option<string>;
186
- description: Option<string>;
187
- }
188
- export interface RegisterExtension {
189
- chunked_canister_wasm: Option<ChunkedCanisterWasm>;
190
- extension_init: Option<ExtensionInit>;
191
- }
@@ -1,5 +0,0 @@
1
- import type { CanisterOptions } from "@dfinity/utils";
2
- import type { Principal } from "@icp-sdk/core/principal";
3
- export interface SnsCanisterOptions<T> extends Omit<CanisterOptions<T>, "canisterId"> {
4
- canisterId: Principal;
5
- }
@@ -1,2 +0,0 @@
1
- export type E8s = bigint;
2
- export type Option<T> = T | undefined;