@dfinity/sns 0.0.1
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.
- package/LICENSE +201 -0
- package/README.md +5 -0
- package/dist/candid/ledger.certified.idl.d.ts +2 -0
- package/dist/candid/ledger.certified.idl.js +97 -0
- package/dist/candid/ledger.d.ts +106 -0
- package/dist/candid/ledger.did +250 -0
- package/dist/candid/ledger.idl.d.ts +2 -0
- package/dist/candid/ledger.idl.js +109 -0
- package/dist/candid/sns_governance.certified.idl.d.ts +2 -0
- package/dist/candid/sns_governance.certified.idl.js +596 -0
- package/dist/candid/sns_governance.d.ts +366 -0
- package/dist/candid/sns_governance.did +303 -0
- package/dist/candid/sns_governance.idl.d.ts +2 -0
- package/dist/candid/sns_governance.idl.js +600 -0
- package/dist/candid/sns_root.certified.idl.d.ts +2 -0
- package/dist/candid/sns_root.certified.idl.js +34 -0
- package/dist/candid/sns_root.d.ts +28 -0
- package/dist/candid/sns_root.did +26 -0
- package/dist/candid/sns_root.idl.d.ts +2 -0
- package/dist/candid/sns_root.idl.js +34 -0
- package/dist/candid/sns_swap.certified.idl.d.ts +2 -0
- package/dist/candid/sns_swap.certified.idl.js +110 -0
- package/dist/candid/sns_swap.d.ts +81 -0
- package/dist/candid/sns_swap.did +61 -0
- package/dist/candid/sns_swap.idl.d.ts +2 -0
- package/dist/candid/sns_swap.idl.js +110 -0
- package/dist/cjs/index.cjs.js +853 -0
- package/dist/cjs/index.cjs.js.map +7 -0
- package/dist/esm/chunk-7F6PCBCJ.js +2 -0
- package/dist/esm/chunk-7F6PCBCJ.js.map +7 -0
- package/dist/esm/chunk-A576P2ZR.js +2 -0
- package/dist/esm/chunk-A576P2ZR.js.map +7 -0
- package/dist/esm/chunk-LXL5LYD3.js +2 -0
- package/dist/esm/chunk-LXL5LYD3.js.map +7 -0
- package/dist/esm/chunk-RB6XGLR7.js +2 -0
- package/dist/esm/chunk-RB6XGLR7.js.map +7 -0
- package/dist/esm/chunk-VMVMYL6O.js +840 -0
- package/dist/esm/chunk-VMVMYL6O.js.map +7 -0
- package/dist/esm/chunk-WPRZTZWQ.js +2 -0
- package/dist/esm/chunk-WPRZTZWQ.js.map +7 -0
- package/dist/esm/chunk-YKP66JDM.js +2 -0
- package/dist/esm/chunk-YKP66JDM.js.map +7 -0
- package/dist/esm/chunk-YL4WAPXH.js +2 -0
- package/dist/esm/chunk-YL4WAPXH.js.map +7 -0
- package/dist/esm/governance.canister.js +2 -0
- package/dist/esm/governance.canister.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/ledger.canister.js +2 -0
- package/dist/esm/ledger.canister.js.map +7 -0
- package/dist/esm/root.canister.js +2 -0
- package/dist/esm/root.canister.js.map +7 -0
- package/dist/esm/sns.js +2 -0
- package/dist/esm/sns.js.map +7 -0
- package/dist/esm/sns.wrapper.js +2 -0
- package/dist/esm/sns.wrapper.js.map +7 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/constants/governance.constants.d.ts +6 -0
- package/dist/types/governance.canister.d.ts +13 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/ledger.canister.d.ts +6 -0
- package/dist/types/root.canister.d.ts +22 -0
- package/dist/types/services/canister.d.ts +10 -0
- package/dist/types/sns.d.ts +21 -0
- package/dist/types/sns.wrapper.d.ts +43 -0
- package/dist/types/types/canister.options.d.ts +8 -0
- package/dist/types/types/governance.params.d.ts +14 -0
- package/dist/types/types/query.params.d.ts +7 -0
- package/dist/types/utils/actor.utils.d.ts +14 -0
- package/dist/types/utils/agent.utils.d.ts +5 -0
- package/dist/types/utils/asserts.utils.d.ts +3 -0
- package/dist/types/utils/did.utils.d.ts +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/sns/candid/sns_root.did */
|
|
2
|
+
export const idlFactory = ({ IDL }) => {
|
|
3
|
+
const CanisterStatusType_1 = IDL.Variant({
|
|
4
|
+
'stopped' : IDL.Null,
|
|
5
|
+
'stopping' : IDL.Null,
|
|
6
|
+
'running' : IDL.Null,
|
|
7
|
+
});
|
|
8
|
+
const DefiniteCanisterSettingsArgs = IDL.Record({
|
|
9
|
+
'controller' : IDL.Principal,
|
|
10
|
+
'freezing_threshold' : IDL.Nat,
|
|
11
|
+
'controllers' : IDL.Vec(IDL.Principal),
|
|
12
|
+
'memory_allocation' : IDL.Nat,
|
|
13
|
+
'compute_allocation' : IDL.Nat,
|
|
14
|
+
});
|
|
15
|
+
const CanisterStatusResultV2 = IDL.Record({
|
|
16
|
+
'controller' : IDL.Principal,
|
|
17
|
+
'status' : CanisterStatusType_1,
|
|
18
|
+
'freezing_threshold' : IDL.Nat,
|
|
19
|
+
'balance' : IDL.Vec(IDL.Tuple(IDL.Vec(IDL.Nat8), IDL.Nat)),
|
|
20
|
+
'memory_size' : IDL.Nat,
|
|
21
|
+
'cycles' : IDL.Nat,
|
|
22
|
+
'settings' : DefiniteCanisterSettingsArgs,
|
|
23
|
+
'idle_cycles_burned_per_day' : IDL.Nat,
|
|
24
|
+
'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
25
|
+
});
|
|
26
|
+
return IDL.Service({
|
|
27
|
+
'get_sns_canisters_summary' : IDL.Func(
|
|
28
|
+
[IDL.Vec(IDL.Principal)],
|
|
29
|
+
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Principal, CanisterStatusResultV2))],
|
|
30
|
+
[],
|
|
31
|
+
),
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const init = ({ IDL }) => { return []; };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/sns/candid/sns_swap.did */
|
|
2
|
+
export const idlFactory = ({ IDL }) => {
|
|
3
|
+
const Init = IDL.Record({
|
|
4
|
+
'min_participant_icp_e8s' : IDL.Nat64,
|
|
5
|
+
'fallback_controller_principal_ids' : IDL.Vec(IDL.Text),
|
|
6
|
+
'max_icp_e8s' : IDL.Nat64,
|
|
7
|
+
'min_participants' : IDL.Nat32,
|
|
8
|
+
'nns_governance_canister_id' : IDL.Text,
|
|
9
|
+
'icp_ledger_canister_id' : IDL.Text,
|
|
10
|
+
'sns_ledger_canister_id' : IDL.Text,
|
|
11
|
+
'max_participant_icp_e8s' : IDL.Nat64,
|
|
12
|
+
'sns_governance_canister_id' : IDL.Text,
|
|
13
|
+
'min_icp_e8s' : IDL.Nat64,
|
|
14
|
+
});
|
|
15
|
+
const ErrorRefundIcpRequest = IDL.Record({
|
|
16
|
+
'icp_e8s' : IDL.Nat64,
|
|
17
|
+
'fee_override_e8s' : IDL.Nat64,
|
|
18
|
+
});
|
|
19
|
+
const CanisterCallError = IDL.Record({
|
|
20
|
+
'code' : IDL.Opt(IDL.Int32),
|
|
21
|
+
'description' : IDL.Text,
|
|
22
|
+
});
|
|
23
|
+
const Possibility = IDL.Variant({ 'Err' : CanisterCallError });
|
|
24
|
+
const SetModeCallResult = IDL.Record({
|
|
25
|
+
'possibility' : IDL.Opt(Possibility),
|
|
26
|
+
});
|
|
27
|
+
const SweepResult = IDL.Record({
|
|
28
|
+
'failure' : IDL.Nat32,
|
|
29
|
+
'skipped' : IDL.Nat32,
|
|
30
|
+
'success' : IDL.Nat32,
|
|
31
|
+
});
|
|
32
|
+
const FinalizeSwapResponse = IDL.Record({
|
|
33
|
+
'sns_governance_normal_mode_enabled' : IDL.Opt(SetModeCallResult),
|
|
34
|
+
'sweep_icp' : IDL.Opt(SweepResult),
|
|
35
|
+
'sweep_sns' : IDL.Opt(SweepResult),
|
|
36
|
+
'create_neuron' : IDL.Opt(SweepResult),
|
|
37
|
+
});
|
|
38
|
+
const GetCanisterStatusResponse = IDL.Record({
|
|
39
|
+
'canister_cycle_balance' : IDL.Nat64,
|
|
40
|
+
});
|
|
41
|
+
const TimeWindow = IDL.Record({
|
|
42
|
+
'start_timestamp_seconds' : IDL.Nat64,
|
|
43
|
+
'end_timestamp_seconds' : IDL.Nat64,
|
|
44
|
+
});
|
|
45
|
+
const BuyerState = IDL.Record({
|
|
46
|
+
'icp_disbursing' : IDL.Bool,
|
|
47
|
+
'amount_sns_e8s' : IDL.Nat64,
|
|
48
|
+
'amount_icp_e8s' : IDL.Nat64,
|
|
49
|
+
'sns_disbursing' : IDL.Bool,
|
|
50
|
+
});
|
|
51
|
+
const State = IDL.Record({
|
|
52
|
+
'open_time_window' : IDL.Opt(TimeWindow),
|
|
53
|
+
'sns_token_e8s' : IDL.Nat64,
|
|
54
|
+
'lifecycle' : IDL.Int32,
|
|
55
|
+
'buyers' : IDL.Vec(IDL.Tuple(IDL.Text, BuyerState)),
|
|
56
|
+
});
|
|
57
|
+
const Swap = IDL.Record({ 'init' : IDL.Opt(Init), 'state' : IDL.Opt(State) });
|
|
58
|
+
const DerivedState = IDL.Record({
|
|
59
|
+
'sns_tokens_per_icp' : IDL.Float32,
|
|
60
|
+
'buyer_total_icp_e8s' : IDL.Nat64,
|
|
61
|
+
});
|
|
62
|
+
const GetStateResponse = IDL.Record({
|
|
63
|
+
'swap' : IDL.Opt(Swap),
|
|
64
|
+
'derived' : IDL.Opt(DerivedState),
|
|
65
|
+
});
|
|
66
|
+
const RefreshBuyerTokensRequest = IDL.Record({ 'buyer' : IDL.Text });
|
|
67
|
+
const SetOpenTimeWindowRequest = IDL.Record({
|
|
68
|
+
'open_time_window' : IDL.Opt(TimeWindow),
|
|
69
|
+
});
|
|
70
|
+
return IDL.Service({
|
|
71
|
+
'error_refund_icp' : IDL.Func(
|
|
72
|
+
[ErrorRefundIcpRequest],
|
|
73
|
+
[IDL.Record({})],
|
|
74
|
+
[],
|
|
75
|
+
),
|
|
76
|
+
'finalize_swap' : IDL.Func([IDL.Record({})], [FinalizeSwapResponse], []),
|
|
77
|
+
'get_canister_status' : IDL.Func(
|
|
78
|
+
[IDL.Record({})],
|
|
79
|
+
[GetCanisterStatusResponse],
|
|
80
|
+
[],
|
|
81
|
+
),
|
|
82
|
+
'get_state' : IDL.Func([IDL.Record({})], [GetStateResponse], []),
|
|
83
|
+
'refresh_buyer_tokens' : IDL.Func(
|
|
84
|
+
[RefreshBuyerTokensRequest],
|
|
85
|
+
[IDL.Record({})],
|
|
86
|
+
[],
|
|
87
|
+
),
|
|
88
|
+
'refresh_sns_tokens' : IDL.Func([IDL.Record({})], [IDL.Record({})], []),
|
|
89
|
+
'set_open_time_window' : IDL.Func(
|
|
90
|
+
[SetOpenTimeWindowRequest],
|
|
91
|
+
[IDL.Record({})],
|
|
92
|
+
[],
|
|
93
|
+
),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
export const init = ({ IDL }) => {
|
|
97
|
+
const Init = IDL.Record({
|
|
98
|
+
'min_participant_icp_e8s' : IDL.Nat64,
|
|
99
|
+
'fallback_controller_principal_ids' : IDL.Vec(IDL.Text),
|
|
100
|
+
'max_icp_e8s' : IDL.Nat64,
|
|
101
|
+
'min_participants' : IDL.Nat32,
|
|
102
|
+
'nns_governance_canister_id' : IDL.Text,
|
|
103
|
+
'icp_ledger_canister_id' : IDL.Text,
|
|
104
|
+
'sns_ledger_canister_id' : IDL.Text,
|
|
105
|
+
'max_participant_icp_e8s' : IDL.Nat64,
|
|
106
|
+
'sns_governance_canister_id' : IDL.Text,
|
|
107
|
+
'min_icp_e8s' : IDL.Nat64,
|
|
108
|
+
});
|
|
109
|
+
return [Init];
|
|
110
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface BuyerState {
|
|
2
|
+
icp_disbursing: boolean;
|
|
3
|
+
amount_sns_e8s: bigint;
|
|
4
|
+
amount_icp_e8s: bigint;
|
|
5
|
+
sns_disbursing: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface CanisterCallError {
|
|
8
|
+
code: [] | [number];
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DerivedState {
|
|
12
|
+
sns_tokens_per_icp: number;
|
|
13
|
+
buyer_total_icp_e8s: bigint;
|
|
14
|
+
}
|
|
15
|
+
export interface ErrorRefundIcpRequest {
|
|
16
|
+
icp_e8s: bigint;
|
|
17
|
+
fee_override_e8s: bigint;
|
|
18
|
+
}
|
|
19
|
+
export interface FinalizeSwapResponse {
|
|
20
|
+
sns_governance_normal_mode_enabled: [] | [SetModeCallResult];
|
|
21
|
+
sweep_icp: [] | [SweepResult];
|
|
22
|
+
sweep_sns: [] | [SweepResult];
|
|
23
|
+
create_neuron: [] | [SweepResult];
|
|
24
|
+
}
|
|
25
|
+
export interface GetCanisterStatusResponse {
|
|
26
|
+
canister_cycle_balance: bigint;
|
|
27
|
+
}
|
|
28
|
+
export interface GetStateResponse {
|
|
29
|
+
swap: [] | [Swap];
|
|
30
|
+
derived: [] | [DerivedState];
|
|
31
|
+
}
|
|
32
|
+
export interface Init {
|
|
33
|
+
min_participant_icp_e8s: bigint;
|
|
34
|
+
fallback_controller_principal_ids: Array<string>;
|
|
35
|
+
max_icp_e8s: bigint;
|
|
36
|
+
min_participants: number;
|
|
37
|
+
nns_governance_canister_id: string;
|
|
38
|
+
icp_ledger_canister_id: string;
|
|
39
|
+
sns_ledger_canister_id: string;
|
|
40
|
+
max_participant_icp_e8s: bigint;
|
|
41
|
+
sns_governance_canister_id: string;
|
|
42
|
+
min_icp_e8s: bigint;
|
|
43
|
+
}
|
|
44
|
+
export type Possibility = { Err: CanisterCallError };
|
|
45
|
+
export interface RefreshBuyerTokensRequest {
|
|
46
|
+
buyer: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SetModeCallResult {
|
|
49
|
+
possibility: [] | [Possibility];
|
|
50
|
+
}
|
|
51
|
+
export interface SetOpenTimeWindowRequest {
|
|
52
|
+
open_time_window: [] | [TimeWindow];
|
|
53
|
+
}
|
|
54
|
+
export interface State {
|
|
55
|
+
open_time_window: [] | [TimeWindow];
|
|
56
|
+
sns_token_e8s: bigint;
|
|
57
|
+
lifecycle: number;
|
|
58
|
+
buyers: Array<[string, BuyerState]>;
|
|
59
|
+
}
|
|
60
|
+
export interface Swap {
|
|
61
|
+
init: [] | [Init];
|
|
62
|
+
state: [] | [State];
|
|
63
|
+
}
|
|
64
|
+
export interface SweepResult {
|
|
65
|
+
failure: number;
|
|
66
|
+
skipped: number;
|
|
67
|
+
success: number;
|
|
68
|
+
}
|
|
69
|
+
export interface TimeWindow {
|
|
70
|
+
start_timestamp_seconds: bigint;
|
|
71
|
+
end_timestamp_seconds: bigint;
|
|
72
|
+
}
|
|
73
|
+
export interface _SERVICE {
|
|
74
|
+
error_refund_icp: (arg_0: ErrorRefundIcpRequest) => Promise<{}>;
|
|
75
|
+
finalize_swap: (arg_0: {}) => Promise<FinalizeSwapResponse>;
|
|
76
|
+
get_canister_status: (arg_0: {}) => Promise<GetCanisterStatusResponse>;
|
|
77
|
+
get_state: (arg_0: {}) => Promise<GetStateResponse>;
|
|
78
|
+
refresh_buyer_tokens: (arg_0: RefreshBuyerTokensRequest) => Promise<{}>;
|
|
79
|
+
refresh_sns_tokens: (arg_0: {}) => Promise<{}>;
|
|
80
|
+
set_open_time_window: (arg_0: SetOpenTimeWindowRequest) => Promise<{}>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Generated from IC repo commit a1080f27696c890c19d7068f668bd062f3787564 'rs/sns/swap/canister/swap.did' by import-candid
|
|
2
|
+
type BuyerState = record {
|
|
3
|
+
icp_disbursing : bool;
|
|
4
|
+
amount_sns_e8s : nat64;
|
|
5
|
+
amount_icp_e8s : nat64;
|
|
6
|
+
sns_disbursing : bool;
|
|
7
|
+
};
|
|
8
|
+
type CanisterCallError = record { code : opt int32; description : text };
|
|
9
|
+
type DerivedState = record {
|
|
10
|
+
sns_tokens_per_icp : float32;
|
|
11
|
+
buyer_total_icp_e8s : nat64;
|
|
12
|
+
};
|
|
13
|
+
type ErrorRefundIcpRequest = record {
|
|
14
|
+
icp_e8s : nat64;
|
|
15
|
+
fee_override_e8s : nat64;
|
|
16
|
+
};
|
|
17
|
+
type FinalizeSwapResponse = record {
|
|
18
|
+
sns_governance_normal_mode_enabled : opt SetModeCallResult;
|
|
19
|
+
sweep_icp : opt SweepResult;
|
|
20
|
+
sweep_sns : opt SweepResult;
|
|
21
|
+
create_neuron : opt SweepResult;
|
|
22
|
+
};
|
|
23
|
+
type GetCanisterStatusResponse = record { canister_cycle_balance : nat64 };
|
|
24
|
+
type GetStateResponse = record { swap : opt Swap; derived : opt DerivedState };
|
|
25
|
+
type Init = record {
|
|
26
|
+
min_participant_icp_e8s : nat64;
|
|
27
|
+
fallback_controller_principal_ids : vec text;
|
|
28
|
+
max_icp_e8s : nat64;
|
|
29
|
+
min_participants : nat32;
|
|
30
|
+
nns_governance_canister_id : text;
|
|
31
|
+
icp_ledger_canister_id : text;
|
|
32
|
+
sns_ledger_canister_id : text;
|
|
33
|
+
max_participant_icp_e8s : nat64;
|
|
34
|
+
sns_governance_canister_id : text;
|
|
35
|
+
min_icp_e8s : nat64;
|
|
36
|
+
};
|
|
37
|
+
type Possibility = variant { Err : CanisterCallError };
|
|
38
|
+
type RefreshBuyerTokensRequest = record { buyer : text };
|
|
39
|
+
type SetModeCallResult = record { possibility : opt Possibility };
|
|
40
|
+
type SetOpenTimeWindowRequest = record { open_time_window : opt TimeWindow };
|
|
41
|
+
type State = record {
|
|
42
|
+
open_time_window : opt TimeWindow;
|
|
43
|
+
sns_token_e8s : nat64;
|
|
44
|
+
lifecycle : int32;
|
|
45
|
+
buyers : vec record { text; BuyerState };
|
|
46
|
+
};
|
|
47
|
+
type Swap = record { init : opt Init; state : opt State };
|
|
48
|
+
type SweepResult = record { failure : nat32; skipped : nat32; success : nat32 };
|
|
49
|
+
type TimeWindow = record {
|
|
50
|
+
start_timestamp_seconds : nat64;
|
|
51
|
+
end_timestamp_seconds : nat64;
|
|
52
|
+
};
|
|
53
|
+
service : (Init) -> {
|
|
54
|
+
error_refund_icp : (ErrorRefundIcpRequest) -> (record {});
|
|
55
|
+
finalize_swap : (record {}) -> (FinalizeSwapResponse);
|
|
56
|
+
get_canister_status : (record {}) -> (GetCanisterStatusResponse);
|
|
57
|
+
get_state : (record {}) -> (GetStateResponse) query;
|
|
58
|
+
refresh_buyer_tokens : (RefreshBuyerTokensRequest) -> (record {});
|
|
59
|
+
refresh_sns_tokens : (record {}) -> (record {});
|
|
60
|
+
set_open_time_window : (SetOpenTimeWindowRequest) -> (record {});
|
|
61
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/sns/candid/sns_swap.did */
|
|
2
|
+
export const idlFactory = ({ IDL }) => {
|
|
3
|
+
const Init = IDL.Record({
|
|
4
|
+
'min_participant_icp_e8s' : IDL.Nat64,
|
|
5
|
+
'fallback_controller_principal_ids' : IDL.Vec(IDL.Text),
|
|
6
|
+
'max_icp_e8s' : IDL.Nat64,
|
|
7
|
+
'min_participants' : IDL.Nat32,
|
|
8
|
+
'nns_governance_canister_id' : IDL.Text,
|
|
9
|
+
'icp_ledger_canister_id' : IDL.Text,
|
|
10
|
+
'sns_ledger_canister_id' : IDL.Text,
|
|
11
|
+
'max_participant_icp_e8s' : IDL.Nat64,
|
|
12
|
+
'sns_governance_canister_id' : IDL.Text,
|
|
13
|
+
'min_icp_e8s' : IDL.Nat64,
|
|
14
|
+
});
|
|
15
|
+
const ErrorRefundIcpRequest = IDL.Record({
|
|
16
|
+
'icp_e8s' : IDL.Nat64,
|
|
17
|
+
'fee_override_e8s' : IDL.Nat64,
|
|
18
|
+
});
|
|
19
|
+
const CanisterCallError = IDL.Record({
|
|
20
|
+
'code' : IDL.Opt(IDL.Int32),
|
|
21
|
+
'description' : IDL.Text,
|
|
22
|
+
});
|
|
23
|
+
const Possibility = IDL.Variant({ 'Err' : CanisterCallError });
|
|
24
|
+
const SetModeCallResult = IDL.Record({
|
|
25
|
+
'possibility' : IDL.Opt(Possibility),
|
|
26
|
+
});
|
|
27
|
+
const SweepResult = IDL.Record({
|
|
28
|
+
'failure' : IDL.Nat32,
|
|
29
|
+
'skipped' : IDL.Nat32,
|
|
30
|
+
'success' : IDL.Nat32,
|
|
31
|
+
});
|
|
32
|
+
const FinalizeSwapResponse = IDL.Record({
|
|
33
|
+
'sns_governance_normal_mode_enabled' : IDL.Opt(SetModeCallResult),
|
|
34
|
+
'sweep_icp' : IDL.Opt(SweepResult),
|
|
35
|
+
'sweep_sns' : IDL.Opt(SweepResult),
|
|
36
|
+
'create_neuron' : IDL.Opt(SweepResult),
|
|
37
|
+
});
|
|
38
|
+
const GetCanisterStatusResponse = IDL.Record({
|
|
39
|
+
'canister_cycle_balance' : IDL.Nat64,
|
|
40
|
+
});
|
|
41
|
+
const TimeWindow = IDL.Record({
|
|
42
|
+
'start_timestamp_seconds' : IDL.Nat64,
|
|
43
|
+
'end_timestamp_seconds' : IDL.Nat64,
|
|
44
|
+
});
|
|
45
|
+
const BuyerState = IDL.Record({
|
|
46
|
+
'icp_disbursing' : IDL.Bool,
|
|
47
|
+
'amount_sns_e8s' : IDL.Nat64,
|
|
48
|
+
'amount_icp_e8s' : IDL.Nat64,
|
|
49
|
+
'sns_disbursing' : IDL.Bool,
|
|
50
|
+
});
|
|
51
|
+
const State = IDL.Record({
|
|
52
|
+
'open_time_window' : IDL.Opt(TimeWindow),
|
|
53
|
+
'sns_token_e8s' : IDL.Nat64,
|
|
54
|
+
'lifecycle' : IDL.Int32,
|
|
55
|
+
'buyers' : IDL.Vec(IDL.Tuple(IDL.Text, BuyerState)),
|
|
56
|
+
});
|
|
57
|
+
const Swap = IDL.Record({ 'init' : IDL.Opt(Init), 'state' : IDL.Opt(State) });
|
|
58
|
+
const DerivedState = IDL.Record({
|
|
59
|
+
'sns_tokens_per_icp' : IDL.Float32,
|
|
60
|
+
'buyer_total_icp_e8s' : IDL.Nat64,
|
|
61
|
+
});
|
|
62
|
+
const GetStateResponse = IDL.Record({
|
|
63
|
+
'swap' : IDL.Opt(Swap),
|
|
64
|
+
'derived' : IDL.Opt(DerivedState),
|
|
65
|
+
});
|
|
66
|
+
const RefreshBuyerTokensRequest = IDL.Record({ 'buyer' : IDL.Text });
|
|
67
|
+
const SetOpenTimeWindowRequest = IDL.Record({
|
|
68
|
+
'open_time_window' : IDL.Opt(TimeWindow),
|
|
69
|
+
});
|
|
70
|
+
return IDL.Service({
|
|
71
|
+
'error_refund_icp' : IDL.Func(
|
|
72
|
+
[ErrorRefundIcpRequest],
|
|
73
|
+
[IDL.Record({})],
|
|
74
|
+
[],
|
|
75
|
+
),
|
|
76
|
+
'finalize_swap' : IDL.Func([IDL.Record({})], [FinalizeSwapResponse], []),
|
|
77
|
+
'get_canister_status' : IDL.Func(
|
|
78
|
+
[IDL.Record({})],
|
|
79
|
+
[GetCanisterStatusResponse],
|
|
80
|
+
[],
|
|
81
|
+
),
|
|
82
|
+
'get_state' : IDL.Func([IDL.Record({})], [GetStateResponse], ['query']),
|
|
83
|
+
'refresh_buyer_tokens' : IDL.Func(
|
|
84
|
+
[RefreshBuyerTokensRequest],
|
|
85
|
+
[IDL.Record({})],
|
|
86
|
+
[],
|
|
87
|
+
),
|
|
88
|
+
'refresh_sns_tokens' : IDL.Func([IDL.Record({})], [IDL.Record({})], []),
|
|
89
|
+
'set_open_time_window' : IDL.Func(
|
|
90
|
+
[SetOpenTimeWindowRequest],
|
|
91
|
+
[IDL.Record({})],
|
|
92
|
+
[],
|
|
93
|
+
),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
export const init = ({ IDL }) => {
|
|
97
|
+
const Init = IDL.Record({
|
|
98
|
+
'min_participant_icp_e8s' : IDL.Nat64,
|
|
99
|
+
'fallback_controller_principal_ids' : IDL.Vec(IDL.Text),
|
|
100
|
+
'max_icp_e8s' : IDL.Nat64,
|
|
101
|
+
'min_participants' : IDL.Nat32,
|
|
102
|
+
'nns_governance_canister_id' : IDL.Text,
|
|
103
|
+
'icp_ledger_canister_id' : IDL.Text,
|
|
104
|
+
'sns_ledger_canister_id' : IDL.Text,
|
|
105
|
+
'max_participant_icp_e8s' : IDL.Nat64,
|
|
106
|
+
'sns_governance_canister_id' : IDL.Text,
|
|
107
|
+
'min_icp_e8s' : IDL.Nat64,
|
|
108
|
+
});
|
|
109
|
+
return [Init];
|
|
110
|
+
};
|