-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathproposalCreationTypes.ts
More file actions
620 lines (555 loc) · 15.1 KB
/
proposalCreationTypes.ts
File metadata and controls
620 lines (555 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
import { Governance } from '@solana/spl-governance'
import { ProgramAccount } from '@solana/spl-governance'
import { MintInfo } from '@solana/spl-token'
import { PublicKey, Keypair, TransactionInstruction } from '@solana/web3.js'
import { getNameOf } from '@tools/core/script'
import { SupportedMintName } from '@tools/sdk/solend/configuration'
import { DepositWithMintAccount, Voter } from 'VoteStakeRegistry/sdk/accounts'
import { LockupKind } from 'VoteStakeRegistry/tools/types'
import { AssetAccount, StakeAccount } from '@utils/uiTypes/assets'
import { RealmInfo } from '@models/registry/api'
import * as PaymentStreaming from '@mean-dao/payment-streaming'
// Alphabetical order
export enum PackageEnum {
Common,
Distribution,
Dual,
GatewayPlugin,
Identity,
MangoMarketV4,
MeanFinance,
NftPlugin,
PsyFinance,
Pyth,
Serum,
Solend,
Symmetry,
Squads,
Switchboard,
VsrPlugin,
}
export interface UiInstruction {
serializedInstruction: string
additionalSerializedInstructions?: string[]
isValid: boolean
governance: ProgramAccount<Governance> | undefined
customHoldUpTime?: number
prerequisiteInstructions?: TransactionInstruction[]
prerequisiteInstructionsSigners?: (Keypair | null)[]
chunkBy?: number
signers?: Keypair[]
}
export interface SplTokenTransferForm {
destinationAccount: string
amount: number | undefined
governedTokenAccount: AssetAccount | undefined
programId: string | undefined
mintInfo: MintInfo | undefined
}
export interface AddCouncilMembersForm {
governedTokenAccount: AssetAccount | undefined,
memberAddresses: string[],
amount: number | undefined,
mintInfo: MintInfo | undefined
}
export interface BurnTokensForm {
amount: number | undefined
governedTokenAccount: AssetAccount | undefined
mintInfo: MintInfo | undefined
}
export interface DomainNameTransferForm {
destinationAccount: string
governedAccount: AssetAccount | undefined
domainAddress: string | undefined
}
export interface MeanCreateAccount {
governedTokenAccount: AssetAccount | undefined
label: string | undefined
mintInfo: MintInfo | undefined
amount: number | undefined
type: PaymentStreaming.AccountType
}
export interface MeanFundAccount {
governedTokenAccount: AssetAccount | undefined
mintInfo: MintInfo | undefined
amount: number | undefined
paymentStreamingAccount: PaymentStreaming.PaymentStreamingAccount | undefined
}
export interface MeanWithdrawFromAccount {
governedTokenAccount: AssetAccount | undefined
mintInfo: MintInfo | undefined
amount: number | undefined
paymentStreamingAccount: PaymentStreaming.PaymentStreamingAccount | undefined
destination: string | undefined
}
export interface MeanCreateStream {
governedTokenAccount: AssetAccount | undefined
paymentStreamingAccount: PaymentStreaming.PaymentStreamingAccount | undefined
streamName: string | undefined
destination: string | undefined
mintInfo: MintInfo | undefined
allocationAssigned: number | undefined
rateAmount: number | undefined
rateInterval: 0 | 1 | 2 | 3 | 4 | 5
startDate: string
}
export interface MeanTransferStream {
governedTokenAccount: AssetAccount | undefined
stream: PaymentStreaming.Stream | undefined
destination: string | undefined
}
export interface GrantForm {
destinationAccount: string
amount: number | undefined
governedTokenAccount: AssetAccount | undefined
mintInfo: MintInfo | undefined
lockupKind: LockupKind
startDateUnixSeconds: number
periods: number
allowClawback: boolean
}
export interface ClawbackForm {
governedTokenAccount: AssetAccount | undefined
voter: Voter | null
deposit: DepositWithMintAccount | null
holdupTime: number
}
export interface SendTokenCompactViewForm extends Omit<SplTokenTransferForm, 'amount' | 'destinationAccount'> {
destinationAccount: string[]
amount: (number | undefined)[]
txDollarAmount: (string | undefined)[]
description: string
title: string
}
export interface StakingViewForm {
destinationAccount: AssetAccount | undefined
amount: number | undefined
governedTokenAccount: AssetAccount | undefined
description: string
title: string
}
export interface MintForm {
destinationAccount: string
amount: number | undefined
mintAccount: AssetAccount | undefined
programId: string | undefined
}
export interface ProgramUpgradeForm {
governedAccount: AssetAccount | undefined
programId: string | undefined
bufferAddress: string
bufferSpillAddress?: string | undefined
}
export const programUpgradeFormNameOf = getNameOf<ProgramUpgradeForm>()
export interface MangoMakeAddOracleForm {
governedAccount: AssetAccount | undefined
programId: string | undefined
mangoGroup: string | undefined
oracleAccount: string | undefined
}
export type NameValue = {
name: string
value: string
}
/* PsyOptions American options */
export interface PsyFinanceMintAmericanOptionsForm {
contractSize: number
expirationUnixTimestamp: number
optionTokenDestinationAccount: string
quoteMint: string
size: number | undefined
strike: number
underlyingAccount: AssetAccount | undefined
underlyingMint: PublicKey | undefined
writerTokenDestinationAccount: string
}
export interface PsyFinanceBurnWriterForQuote {
size: number
writerTokenAccount: AssetAccount | undefined
quoteDestination: string
}
export interface PsyFinanceClaimUnderlyingPostExpiration {
size: number
writerTokenAccount: AssetAccount | undefined
underlyingDestination: string
}
export interface PsyFinanceExerciseOption {
size: number
optionTokenAccount: AssetAccount | undefined
quoteAssetAccount: AssetAccount | undefined
}
/* End PsyOptions American options */
export interface Base64InstructionForm {
governedAccount: AssetAccount | undefined
base64: string
holdUpTime: number
}
export interface EmptyInstructionForm {
governedAccount: AssetAccount | undefined
}
export interface CreateAssociatedTokenAccountForm {
governedAccount?: AssetAccount
splTokenMint?: string
}
export interface CreateSolendObligationAccountForm {
governedAccount?: AssetAccount
}
export interface InitSolendObligationAccountForm {
governedAccount?: AssetAccount
}
export interface DepositReserveLiquidityAndObligationCollateralForm {
governedAccount?: AssetAccount
uiAmount: string
mintName?: SupportedMintName
}
export interface WithdrawObligationCollateralAndRedeemReserveLiquidityForm {
governedAccount?: AssetAccount
uiAmount: string
mintName?: SupportedMintName
destinationLiquidity?: string
}
export interface RefreshObligationForm {
governedAccount?: AssetAccount
mintName?: SupportedMintName
}
export interface RefreshReserveForm {
governedAccount?: AssetAccount
mintName?: SupportedMintName
}
export interface CreateTokenMetadataForm {
name: string
symbol: string
uri: string
mintAccount: AssetAccount | undefined
programId: string | undefined
}
export interface UpdateTokenMetadataForm {
name: string
symbol: string
uri: string
mintAccount: AssetAccount | undefined
programId: string | undefined
}
export interface SerumInitUserForm {
governedAccount?: AssetAccount
owner: string
programId: string
}
export interface SerumGrantLockedForm {
governedAccount?: AssetAccount
owner: string
mintInfo: MintInfo | undefined
amount: number | undefined
programId: string
}
export interface SerumUpdateConfigParam {
governedAccount?: AssetAccount // Config Authority
claimDelay?: number
redeemDelay?: number
cliffPeriod?: number
linearVestingPeriod?: number
}
export interface SerumUpdateConfigAuthority {
governedAccount?: AssetAccount // Config Authority
newAuthority?: string
}
export interface JoinDAOForm {
governedAccount?: AssetAccount
mintInfo: MintInfo | undefined
realm: RealmInfo | null
amount?: number
}
export enum Instructions {
AddCouncilMembers,
Base64,
Burn,
ChangeMakeDonation,
Clawback,
CloseTokenAccount,
CloseMultipleTokenAccounts,
ConfigureGatewayPlugin,
ConfigureNftPluginCollection,
CreateAssociatedTokenAccount,
CreateGatewayPluginRegistrar,
CreateNftPluginMaxVoterWeight,
CreateNftPluginRegistrar,
CreateSolendObligationAccount,
CreateTokenMetadata,
CreateVsrRegistrar,
DeactivateValidatorStake,
DepositReserveLiquidityAndObligationCollateral,
DifferValidatorStake,
DualFinanceAirdrop,
DualFinanceExerciseStakingOption,
DualFinanceLiquidityStakingOption,
DualFinanceInitStrike,
DualFinanceStakingOption,
DualFinanceGso,
DualFinanceGsoWithdraw,
DualFinanceStakingOptionWithdraw,
DualFinanceDelegate,
DualFinanceDelegateWithdraw,
DualFinanceVoteDeposit,
DaoVote,
DistributionCloseVaults,
DistributionFillVaults,
DelegateStake,
RemoveStakeLock,
Grant,
InitSolendObligationAccount,
JoinDAO,
MangoV4PerpCreate,
MangoV4PerpEdit,
MangoV4OpenBookRegisterMarket,
MangoV4OpenBookEditMarket,
MangoV4TokenEdit,
MangoV4TokenRegister,
MangoV4TokenRegisterTrustless,
MangoV4GroupEdit,
IdlSetBuffer,
MangoV4IxGateSet,
MangoV4AltSet,
MangoV4AltExtend,
MangoV4StubOracleCreate,
MangoV4StubOracleSet,
MangoV4TokenAddBank,
MangoV4AdminWithdrawTokenFees,
MangoV4WithdrawPerpFees,
MeanCreateAccount,
MeanCreateStream,
MeanFundAccount,
MeanTransferStream,
MeanWithdrawFromAccount,
Mint,
None,
ProgramUpgrade,
PsyFinanceBurnWriterForQuote,
PsyFinanceClaimUnderlyingPostExpiration,
PsyFinanceExerciseOption,
PsyFinanceMintAmericanOptions,
RealmConfig,
RefreshSolendObligation,
RefreshSolendReserve,
SerumGrantLockedMSRM,
SerumGrantLockedSRM,
SerumGrantVestMSRM,
SerumGrantVestSRM,
SerumInitUser,
SerumUpdateGovConfigAuthority,
SerumUpdateGovConfigParams,
SquadsMeshAddMember,
SquadsMeshChangeThresholdMember,
SquadsMeshRemoveMember,
PythRecoverAccount,
PythUpdatePoolAuthority,
StakeValidator,
SwitchboardFundOracle,
WithdrawFromOracle,
Transfer,
TransferDomainName,
UpdateTokenMetadata,
VotingMintConfig,
WithdrawObligationCollateralAndRedeemReserveLiquidity,
WithdrawValidatorStake,
SplitStake,
AddKeyToDID,
RemoveKeyFromDID,
AddServiceToDID,
RemoveServiceFromDID,
RevokeGoverningTokens,
SetMintAuthority,
SanctumDepositStake,
SanctumWithdrawStake,
SymmetryCreateBasket,
SymmetryEditBasket,
SymmetryDeposit,
SymmetryWithdraw
}
export interface ComponentInstructionData {
governedAccount?: ProgramAccount<Governance> | undefined
getInstruction?: () => Promise<UiInstruction>
type: any
}
export interface InstructionsContext {
instructionsData: ComponentInstructionData[]
voteByCouncil?: boolean | null
handleSetInstructions: (val, index) => void
governance: ProgramAccount<Governance> | null | undefined
setGovernance: (val) => void
}
export interface ChangeNonprofit {
name: string
description: string
ein: string
classification: string
category: string
address_line: string
city: string
state: string
zip_code: string
icon_url: string
email?: string
website: string
socials: {
facebook?: string
instagram?: string
tiktok?: string
twitter?: string
youtube?: string
}
crypto: {
solana_address: string
ethereum_address: string
}
}
export interface ValidatorStakingForm {
governedTokenAccount: AssetAccount | undefined
validatorVoteKey: string
amount: number
seed: number
}
export interface ValidatorDeactivateStakeForm {
governedTokenAccount: AssetAccount | undefined
stakingAccount: StakeAccount | undefined
}
export interface ValidatorWithdrawStakeForm {
governedTokenAccount: AssetAccount | undefined
stakingAccount: StakeAccount | undefined
amount: number
}
export interface ValidatorRemoveLockup {
governedTokenAccount: AssetAccount | undefined
stakeAccount: string
}
export interface DelegateStakeForm {
governedTokenAccount: AssetAccount | undefined
stakingAccount: StakeAccount | undefined
votePubkey: string
}
export interface DualFinanceAirdropForm {
root: string
amount: number
eligibilityStart: number
eligibilityEnd: number
amountPerVoter: number
treasury: AssetAccount | undefined
}
export interface DualFinanceStakingOptionForm {
strike: number
soName: string | undefined
optionExpirationUnixSeconds: number
numTokens: string
lotSize: number
baseTreasury: AssetAccount | undefined
quoteTreasury: AssetAccount | undefined
payer: AssetAccount | undefined
userPk: string | undefined
}
export interface DualFinanceGsoForm {
strike: number
soName: string | undefined
optionExpirationUnixSeconds: number
numTokens: number
lotSize: number
subscriptionPeriodEnd: number
lockupRatio: number
lockupMint: string
baseTreasury: AssetAccount | undefined
quoteTreasury: AssetAccount | undefined
payer: AssetAccount | undefined
}
export interface DualFinanceLiquidityStakingOptionForm {
optionExpirationUnixSeconds: number
numTokens: number
lotSize: number
baseTreasury: AssetAccount | undefined
quoteTreasury: AssetAccount | undefined
payer: AssetAccount | undefined
}
export interface DualFinanceInitStrikeForm {
strikes: string
soName: string
payer: AssetAccount | undefined
baseTreasury: AssetAccount | undefined
}
export interface DualFinanceExerciseForm {
numTokens: number
soName: string | undefined
baseTreasury: AssetAccount | undefined
quoteTreasury: AssetAccount | undefined
optionAccount: AssetAccount | undefined
}
export interface DualFinanceWithdrawForm {
soName: string | undefined
baseTreasury: AssetAccount | undefined
mintPk: string | undefined
}
export interface DualFinanceGsoWithdrawForm {
soName: string | undefined
baseTreasury: AssetAccount | undefined
}
export interface DualFinanceDelegateForm {
delegateAccount: string | undefined
realm: string | undefined
delegateToken: AssetAccount | undefined
}
export interface DualFinanceDelegateWithdrawForm {
realm: string | undefined
delegateToken: AssetAccount | undefined
}
export interface DualFinanceVoteDepositForm {
numTokens: number
realm: string | undefined
delegateToken: AssetAccount | undefined
}
export interface SymmetryCreateBasketForm {
governedAccount?: AssetAccount,
basketType: number,
basketName: string,
basketSymbol: string,
basketMetadataUrl: string,
basketComposition: {
name: string,
symbol: string,
token: PublicKey;
weight: number;
}[],
rebalanceThreshold: number,
rebalanceSlippageTolerance: number,
depositFee: number,
feeCollectorAddress:string,
liquidityProvision: boolean,
liquidityProvisionRange: number,
}
export interface SymmetryEditBasketForm {
governedAccount?: AssetAccount,
basketAddress?: PublicKey,
basketType: number,
basketName: string,
basketSymbol: string,
basketMetadataUrl: string,
basketComposition: {
name: string,
symbol: string,
token: PublicKey;
weight: number;
}[],
rebalanceThreshold: number,
rebalanceSlippageTolerance: number,
depositFee: number,
feeCollectorAddress:string,
liquidityProvision: boolean,
liquidityProvisionRange: number,
}
export interface SymmetryDepositForm {
governedAccount?: AssetAccount,
basketAddress?: PublicKey,
depositToken?: PublicKey,
depositAmount: number,
}
export interface SymmetryWithdrawForm {
governedAccount?: AssetAccount,
basketAddress?: PublicKey,
withdrawAmount: number,
withdrawType: number
}