Skip to content

Commit 752f6a0

Browse files
committed
feat: implement airdrop108 in ic_panda_frontend
1 parent 2fd1b18 commit 752f6a0

File tree

20 files changed

+673
-193
lines changed

20 files changed

+673
-193
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ opt-level = 's'
2121

2222
[workspace.package]
2323
edition = "2021"
24-
version = "2.6.1"
24+
version = "2.6.4"
2525
repository = "https://github.com/ldclabs/ic-panda"
2626
keywords = ["canister", "icp", "panda"]
2727
categories = ["web-programming"]

src/ic_message_frontend/src/declarations/ic_panda_luckypool/ic_panda_luckypool.did

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ type AddPrizeInputV2 = record {
1111
quantity : nat16;
1212
expire : nat16;
1313
};
14+
type Airdrop = record {
15+
weight : nat64;
16+
subaccount : opt text;
17+
neuron_id : opt text;
18+
};
1419
type AirdropClaimInput = record {
1520
recaptcha : opt text;
1621
challenge : text;
@@ -40,6 +45,21 @@ type AirdropStateOutput = record {
4045
claimed : nat;
4146
claimable : nat;
4247
};
48+
type Airdrops108Output = record {
49+
status : int8;
50+
ledger_updated_at : nat64;
51+
airdrops : vec Airdrop;
52+
ledger_weight_total : nat64;
53+
tokens_per_weight : float64;
54+
error : opt text;
55+
neurons_hash : text;
56+
neurons_airdropped : bool;
57+
ledger_hash : text;
58+
tokens_distributed : nat64;
59+
neurons_weight_total : nat64;
60+
neurons_updated_at : nat64;
61+
ledger_airdropped : bool;
62+
};
4363
type CaptchaOutput = record { challenge : text; img_base64 : text };
4464
type ClaimPrizeInput = record { challenge : blob; code : text };
4565
type ClaimPrizeOutput = record {
@@ -102,18 +122,21 @@ type PrizeOutput = record {
102122
};
103123
type Result = variant { Ok : PrizeOutput; Err : text };
104124
type Result_1 = variant { Ok; Err : text };
105-
type Result_10 = variant { Ok : NameOutput; Err : text };
106-
type Result_11 = variant { Ok : State; Err };
107-
type Result_12 = variant { Ok : nat; Err : text };
108-
type Result_13 = variant { Ok : principal; Err };
125+
type Result_10 = variant { Ok : nat64; Err : text };
126+
type Result_11 = variant { Ok : opt NameOutput; Err };
127+
type Result_12 = variant { Ok : principal; Err : text };
128+
type Result_13 = variant { Ok : NameOutput; Err : text };
129+
type Result_14 = variant { Ok : State; Err };
130+
type Result_15 = variant { Ok : nat; Err : text };
131+
type Result_16 = variant { Ok : principal; Err };
109132
type Result_2 = variant { Ok : AirdropStateOutput; Err : text };
110133
type Result_3 = variant { Ok : AirdropStateOutput; Err };
111-
type Result_4 = variant { Ok : CaptchaOutput; Err : text };
112-
type Result_5 = variant { Ok : ClaimPrizeOutput; Err : text };
113-
type Result_6 = variant { Ok : LuckyDrawOutput; Err : text };
114-
type Result_7 = variant { Ok : text; Err : text };
115-
type Result_8 = variant { Ok : opt NameOutput; Err };
116-
type Result_9 = variant { Ok : principal; Err : text };
134+
type Result_4 = variant { Ok : Airdrops108Output; Err };
135+
type Result_5 = variant { Ok : CaptchaOutput; Err : text };
136+
type Result_6 = variant { Ok : ClaimPrizeOutput; Err : text };
137+
type Result_7 = variant { Ok : LuckyDrawOutput; Err : text };
138+
type Result_8 = variant { Ok : text; Err : text };
139+
type Result_9 = variant { Ok : bool; Err : text };
117140
type State = record {
118141
latest_luckydraw_logs : vec LuckyDrawLog;
119142
total_luckydraw : nat64;
@@ -135,34 +158,39 @@ type State = record {
135158
service : () -> {
136159
add_prize : (AddPrizeInputV2) -> (Result);
137160
admin_collect_icp : (nat) -> (Result_1);
161+
admin_collect_tokens : (nat) -> (Result_1);
138162
admin_set_managers : (vec principal) -> (Result_1);
139163
airdrop : (AirdropClaimInput) -> (Result_2);
140164
airdrop_codes_of : (principal) -> (vec AirdropCodeOutput) query;
141165
airdrop_logs : (opt nat, opt nat) -> (vec AirdropLog) query;
142166
airdrop_state_of : (opt principal) -> (Result_3) query;
167+
airdrops108_of : (opt principal) -> (Result_4) query;
143168
api_version : () -> (nat16) query;
144-
captcha : () -> (Result_4);
145-
claim_prize : (ClaimPrizeInput) -> (Result_5);
169+
captcha : () -> (Result_5);
170+
claim_prize : (ClaimPrizeInput) -> (Result_6);
146171
harvest : (AirdropHarvestInput) -> (Result_2);
147-
luckydraw : (LuckyDrawInput) -> (Result_6);
172+
luckydraw : (LuckyDrawInput) -> (Result_7);
148173
luckydraw_logs : (opt nat, opt nat) -> (vec LuckyDrawLog) query;
149174
manager_add_notification : (Notification) -> (Result_1);
150-
manager_add_prize : (AddPrizeInput) -> (Result_7);
151-
manager_add_prize_v2 : (AddPrizeInputV2) -> (Result_7);
175+
manager_add_prize : (AddPrizeInput) -> (Result_8);
176+
manager_add_prize_v2 : (AddPrizeInputV2) -> (Result_8);
152177
manager_ban_users : (vec principal) -> (Result_1);
153-
manager_get_airdrop_key : () -> (Result_7) query;
178+
manager_get_airdrop_key : () -> (Result_8) query;
154179
manager_remove_notifications : (blob) -> (Result_1);
155180
manager_set_challenge_pub_key : (text) -> (Result_1);
181+
manager_start_airdrops108 : () -> (Result_9);
156182
manager_update_airdrop_amount : (nat64) -> (Result_1);
157183
manager_update_airdrop_balance : (nat64) -> (Result_1);
184+
manager_update_airdrops108_ledger_list : (blob) -> (Result_10);
185+
manager_update_airdrops108_neurons_list : (blob) -> (Result_10);
158186
manager_update_prize_subsidy : (
159187
opt record { nat64; nat16; nat32; nat8; nat32; nat16 },
160188
) -> (Result_1);
161189
my_luckydraw_logs : (opt nat, opt nat) -> (vec LuckyDrawLog) query;
162-
name_lookup : (text) -> (Result_8) query;
163-
name_of : (opt principal) -> (Result_8) query;
190+
name_lookup : (text) -> (Result_11) query;
191+
name_of : (opt principal) -> (Result_11) query;
164192
notifications : () -> (vec Notification) query;
165-
principal_by_luckycode : (text) -> (Result_9) query;
193+
principal_by_luckycode : (text) -> (Result_12) query;
166194
prize : (text) -> (Result_2);
167195
prize_claim_logs : (principal, opt nat, opt nat) -> (vec PrizeClaimLog) query;
168196
prize_info : (text, opt principal) -> (Result) query;
@@ -171,13 +199,14 @@ service : () -> {
171199
prizes_of : (opt principal) -> (
172200
vec record { nat32; nat32; nat16; nat32; nat16; nat16 },
173201
) query;
174-
register_name : (NameInput) -> (Result_10);
175-
state : () -> (Result_11) query;
176-
unregister_name : (NameInput) -> (Result_12);
177-
update_name : (NameInput) -> (Result_10);
178-
validate2_admin_collect_icp : (nat) -> (Result_7);
179-
validate2_admin_set_managers : (vec principal) -> (Result_7);
202+
register_name : (NameInput) -> (Result_13);
203+
state : () -> (Result_14) query;
204+
unregister_name : (NameInput) -> (Result_15);
205+
update_name : (NameInput) -> (Result_13);
206+
validate2_admin_collect_icp : (nat) -> (Result_8);
207+
validate2_admin_set_managers : (vec principal) -> (Result_8);
180208
validate_admin_collect_icp : (nat) -> (Result_1);
209+
validate_admin_collect_tokens : (nat) -> (Result_8);
181210
validate_admin_set_managers : (vec principal) -> (Result_1);
182-
whoami : () -> (Result_13) query;
211+
whoami : () -> (Result_16) query;
183212
}

src/ic_message_frontend/src/declarations/ic_panda_luckypool/ic_panda_luckypool.did.d.ts

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export interface AddPrizeInputV2 {
1515
'quantity' : number,
1616
'expire' : number,
1717
}
18+
export interface Airdrop {
19+
'weight' : bigint,
20+
'subaccount' : [] | [string],
21+
'neuron_id' : [] | [string],
22+
}
1823
export interface AirdropClaimInput {
1924
'recaptcha' : [] | [string],
2025
'challenge' : string,
@@ -47,6 +52,21 @@ export interface AirdropStateOutput {
4752
'claimed' : bigint,
4853
'claimable' : bigint,
4954
}
55+
export interface Airdrops108Output {
56+
'status' : number,
57+
'ledger_updated_at' : bigint,
58+
'airdrops' : Array<Airdrop>,
59+
'ledger_weight_total' : bigint,
60+
'tokens_per_weight' : number,
61+
'error' : [] | [string],
62+
'neurons_hash' : string,
63+
'neurons_airdropped' : boolean,
64+
'ledger_hash' : string,
65+
'tokens_distributed' : bigint,
66+
'neurons_weight_total' : bigint,
67+
'neurons_updated_at' : bigint,
68+
'ledger_airdropped' : boolean,
69+
}
5070
export interface CaptchaOutput { 'challenge' : string, 'img_base64' : string }
5171
export interface ClaimPrizeInput {
5272
'challenge' : Uint8Array | number[],
@@ -114,29 +134,35 @@ export type Result = { 'Ok' : PrizeOutput } |
114134
{ 'Err' : string };
115135
export type Result_1 = { 'Ok' : null } |
116136
{ 'Err' : string };
117-
export type Result_10 = { 'Ok' : NameOutput } |
137+
export type Result_10 = { 'Ok' : bigint } |
138+
{ 'Err' : string };
139+
export type Result_11 = { 'Ok' : [] | [NameOutput] } |
140+
{ 'Err' : null };
141+
export type Result_12 = { 'Ok' : Principal } |
142+
{ 'Err' : string };
143+
export type Result_13 = { 'Ok' : NameOutput } |
118144
{ 'Err' : string };
119-
export type Result_11 = { 'Ok' : State } |
145+
export type Result_14 = { 'Ok' : State } |
120146
{ 'Err' : null };
121-
export type Result_12 = { 'Ok' : bigint } |
147+
export type Result_15 = { 'Ok' : bigint } |
122148
{ 'Err' : string };
123-
export type Result_13 = { 'Ok' : Principal } |
149+
export type Result_16 = { 'Ok' : Principal } |
124150
{ 'Err' : null };
125151
export type Result_2 = { 'Ok' : AirdropStateOutput } |
126152
{ 'Err' : string };
127153
export type Result_3 = { 'Ok' : AirdropStateOutput } |
128154
{ 'Err' : null };
129-
export type Result_4 = { 'Ok' : CaptchaOutput } |
155+
export type Result_4 = { 'Ok' : Airdrops108Output } |
156+
{ 'Err' : null };
157+
export type Result_5 = { 'Ok' : CaptchaOutput } |
130158
{ 'Err' : string };
131-
export type Result_5 = { 'Ok' : ClaimPrizeOutput } |
159+
export type Result_6 = { 'Ok' : ClaimPrizeOutput } |
132160
{ 'Err' : string };
133-
export type Result_6 = { 'Ok' : LuckyDrawOutput } |
161+
export type Result_7 = { 'Ok' : LuckyDrawOutput } |
134162
{ 'Err' : string };
135-
export type Result_7 = { 'Ok' : string } |
163+
export type Result_8 = { 'Ok' : string } |
136164
{ 'Err' : string };
137-
export type Result_8 = { 'Ok' : [] | [NameOutput] } |
138-
{ 'Err' : null };
139-
export type Result_9 = { 'Ok' : Principal } |
165+
export type Result_9 = { 'Ok' : boolean } |
140166
{ 'Err' : string };
141167
export interface State {
142168
'latest_luckydraw_logs' : Array<LuckyDrawLog>,
@@ -159,6 +185,7 @@ export interface State {
159185
export interface _SERVICE {
160186
'add_prize' : ActorMethod<[AddPrizeInputV2], Result>,
161187
'admin_collect_icp' : ActorMethod<[bigint], Result_1>,
188+
'admin_collect_tokens' : ActorMethod<[bigint], Result_1>,
162189
'admin_set_managers' : ActorMethod<[Array<Principal>], Result_1>,
163190
'airdrop' : ActorMethod<[AirdropClaimInput], Result_2>,
164191
'airdrop_codes_of' : ActorMethod<[Principal], Array<AirdropCodeOutput>>,
@@ -167,27 +194,37 @@ export interface _SERVICE {
167194
Array<AirdropLog>
168195
>,
169196
'airdrop_state_of' : ActorMethod<[[] | [Principal]], Result_3>,
197+
'airdrops108_of' : ActorMethod<[[] | [Principal]], Result_4>,
170198
'api_version' : ActorMethod<[], number>,
171-
'captcha' : ActorMethod<[], Result_4>,
172-
'claim_prize' : ActorMethod<[ClaimPrizeInput], Result_5>,
199+
'captcha' : ActorMethod<[], Result_5>,
200+
'claim_prize' : ActorMethod<[ClaimPrizeInput], Result_6>,
173201
'harvest' : ActorMethod<[AirdropHarvestInput], Result_2>,
174-
'luckydraw' : ActorMethod<[LuckyDrawInput], Result_6>,
202+
'luckydraw' : ActorMethod<[LuckyDrawInput], Result_7>,
175203
'luckydraw_logs' : ActorMethod<
176204
[[] | [bigint], [] | [bigint]],
177205
Array<LuckyDrawLog>
178206
>,
179207
'manager_add_notification' : ActorMethod<[Notification], Result_1>,
180-
'manager_add_prize' : ActorMethod<[AddPrizeInput], Result_7>,
181-
'manager_add_prize_v2' : ActorMethod<[AddPrizeInputV2], Result_7>,
208+
'manager_add_prize' : ActorMethod<[AddPrizeInput], Result_8>,
209+
'manager_add_prize_v2' : ActorMethod<[AddPrizeInputV2], Result_8>,
182210
'manager_ban_users' : ActorMethod<[Array<Principal>], Result_1>,
183-
'manager_get_airdrop_key' : ActorMethod<[], Result_7>,
211+
'manager_get_airdrop_key' : ActorMethod<[], Result_8>,
184212
'manager_remove_notifications' : ActorMethod<
185213
[Uint8Array | number[]],
186214
Result_1
187215
>,
188216
'manager_set_challenge_pub_key' : ActorMethod<[string], Result_1>,
217+
'manager_start_airdrops108' : ActorMethod<[], Result_9>,
189218
'manager_update_airdrop_amount' : ActorMethod<[bigint], Result_1>,
190219
'manager_update_airdrop_balance' : ActorMethod<[bigint], Result_1>,
220+
'manager_update_airdrops108_ledger_list' : ActorMethod<
221+
[Uint8Array | number[]],
222+
Result_10
223+
>,
224+
'manager_update_airdrops108_neurons_list' : ActorMethod<
225+
[Uint8Array | number[]],
226+
Result_10
227+
>,
191228
'manager_update_prize_subsidy' : ActorMethod<
192229
[[] | [[bigint, number, number, number, number, number]]],
193230
Result_1
@@ -196,10 +233,10 @@ export interface _SERVICE {
196233
[[] | [bigint], [] | [bigint]],
197234
Array<LuckyDrawLog>
198235
>,
199-
'name_lookup' : ActorMethod<[string], Result_8>,
200-
'name_of' : ActorMethod<[[] | [Principal]], Result_8>,
236+
'name_lookup' : ActorMethod<[string], Result_11>,
237+
'name_of' : ActorMethod<[[] | [Principal]], Result_11>,
201238
'notifications' : ActorMethod<[], Array<Notification>>,
202-
'principal_by_luckycode' : ActorMethod<[string], Result_9>,
239+
'principal_by_luckycode' : ActorMethod<[string], Result_12>,
203240
'prize' : ActorMethod<[string], Result_2>,
204241
'prize_claim_logs' : ActorMethod<
205242
[Principal, [] | [bigint], [] | [bigint]],
@@ -215,15 +252,16 @@ export interface _SERVICE {
215252
[[] | [Principal]],
216253
Array<[number, number, number, number, number, number]>
217254
>,
218-
'register_name' : ActorMethod<[NameInput], Result_10>,
219-
'state' : ActorMethod<[], Result_11>,
220-
'unregister_name' : ActorMethod<[NameInput], Result_12>,
221-
'update_name' : ActorMethod<[NameInput], Result_10>,
222-
'validate2_admin_collect_icp' : ActorMethod<[bigint], Result_7>,
223-
'validate2_admin_set_managers' : ActorMethod<[Array<Principal>], Result_7>,
255+
'register_name' : ActorMethod<[NameInput], Result_13>,
256+
'state' : ActorMethod<[], Result_14>,
257+
'unregister_name' : ActorMethod<[NameInput], Result_15>,
258+
'update_name' : ActorMethod<[NameInput], Result_13>,
259+
'validate2_admin_collect_icp' : ActorMethod<[bigint], Result_8>,
260+
'validate2_admin_set_managers' : ActorMethod<[Array<Principal>], Result_8>,
224261
'validate_admin_collect_icp' : ActorMethod<[bigint], Result_1>,
262+
'validate_admin_collect_tokens' : ActorMethod<[bigint], Result_8>,
225263
'validate_admin_set_managers' : ActorMethod<[Array<Principal>], Result_1>,
226-
'whoami' : ActorMethod<[], Result_13>,
264+
'whoami' : ActorMethod<[], Result_16>,
227265
}
228266
export declare const idlFactory: IDL.InterfaceFactory;
229267
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];

0 commit comments

Comments
 (0)