@streamflow/staking 11.0.4 → 11.1.0-alpha.p335.b571df3

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/dist/esm/index.js CHANGED
@@ -22,6 +22,7 @@ __export(constants_exports, {
22
22
  FEE_PRECISION_FACTOR_BN: () => FEE_PRECISION_FACTOR_BN,
23
23
  FEE_PROGRAM_ID: () => FEE_PROGRAM_ID,
24
24
  FEE_VALUE_PREFIX: () => FEE_VALUE_PREFIX,
25
+ FUND_DELEGATE_PREFIX: () => FUND_DELEGATE_PREFIX,
25
26
  REWARD_AMOUNT_DECIMALS: () => REWARD_AMOUNT_DECIMALS,
26
27
  REWARD_AMOUNT_PRECISION_FACTOR: () => REWARD_AMOUNT_PRECISION_FACTOR,
27
28
  REWARD_AMOUNT_PRECISION_FACTOR_BN: () => REWARD_AMOUNT_PRECISION_FACTOR_BN,
@@ -52,7 +53,8 @@ __export(constants_exports, {
52
53
  STAKE_POOL_PROGRAM_ID: () => STAKE_POOL_PROGRAM_ID,
53
54
  STAKE_VAULT_PREFIX: () => STAKE_VAULT_PREFIX,
54
55
  STREAMFLOW_TREASURY_PUBLIC_KEY: () => STREAMFLOW_TREASURY_PUBLIC_KEY,
55
- U64_MAX: () => U64_MAX
56
+ U64_MAX: () => U64_MAX,
57
+ WORKER_PUBLIC_KEY: () => WORKER_PUBLIC_KEY
56
58
  });
57
59
  var FEE_PRECISION_FACTOR = 1e4;
58
60
  var FEE_PRECISION_FACTOR_BN = new BN4(FEE_PRECISION_FACTOR);
@@ -74,7 +76,9 @@ var REWARD_VAULT_PREFIX = Buffer.from("reward-vault", "utf-8");
74
76
  var REWARD_ENTRY_PREFIX = Buffer.from("reward-entry", "utf-8");
75
77
  var CONFIG_PREFIX = Buffer.from("config", "utf-8");
76
78
  var FEE_VALUE_PREFIX = Buffer.from("fee-value", "utf-8");
79
+ var FUND_DELEGATE_PREFIX = Buffer.from("fund-delegate", "utf-8");
77
80
  var STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
81
+ var WORKER_PUBLIC_KEY = new PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
78
82
  var ANCHOR_DISCRIMINATOR_OFFSET = 8;
79
83
  var STAKE_ENTRY_STAKE_POOL_OFFSET = ANCHOR_DISCRIMINATOR_OFFSET + 4;
80
84
  var STAKE_ENTRY_PAYER_OFFSET = STAKE_ENTRY_STAKE_POOL_OFFSET + 32;
@@ -3334,7 +3338,7 @@ var reward_pool_dynamic_default = {
3334
3338
  address: "RWRDyfZa6Rk9UYi85yjYYfGmoUqffLqjo6vZdFawEez",
3335
3339
  metadata: {
3336
3340
  name: "reward_pool_dynamic",
3337
- version: "2.4.0",
3341
+ version: "2.6.0",
3338
3342
  spec: "0.1.0",
3339
3343
  description: "Reward pools with dynamic rewards distribution"
3340
3344
  },
@@ -3785,149 +3789,599 @@ var reward_pool_dynamic_default = {
3785
3789
  }
3786
3790
  },
3787
3791
  {
3788
- name: "system_program",
3789
- address: "11111111111111111111111111111111"
3790
- }
3791
- ],
3792
- args: []
3793
- },
3794
- {
3795
- name: "create_pool",
3796
- discriminator: [
3797
- 233,
3798
- 146,
3799
- 209,
3800
- 142,
3801
- 207,
3802
- 104,
3803
- 64,
3804
- 188
3805
- ],
3806
- accounts: [
3807
- {
3808
- name: "stake_pool",
3809
- docs: [
3810
- "Stake Pool to Which Reward Pool is being added"
3811
- ]
3812
- },
3813
- {
3814
- name: "reward_pool",
3792
+ name: "system_program",
3793
+ address: "11111111111111111111111111111111"
3794
+ }
3795
+ ],
3796
+ args: []
3797
+ },
3798
+ {
3799
+ name: "create_fund_delegate",
3800
+ discriminator: [
3801
+ 131,
3802
+ 15,
3803
+ 250,
3804
+ 148,
3805
+ 39,
3806
+ 103,
3807
+ 14,
3808
+ 232
3809
+ ],
3810
+ accounts: [
3811
+ {
3812
+ name: "reward_pool",
3813
+ docs: [
3814
+ "Reward Pool"
3815
+ ]
3816
+ },
3817
+ {
3818
+ name: "mint",
3819
+ docs: [
3820
+ "Mint of reward tokens"
3821
+ ],
3822
+ relations: [
3823
+ "reward_pool"
3824
+ ]
3825
+ },
3826
+ {
3827
+ name: "fund_delegate",
3828
+ docs: [
3829
+ "Fund Delegate account that stores fund configuration"
3830
+ ],
3831
+ writable: true,
3832
+ pda: {
3833
+ seeds: [
3834
+ {
3835
+ kind: "const",
3836
+ value: [
3837
+ 102,
3838
+ 117,
3839
+ 110,
3840
+ 100,
3841
+ 45,
3842
+ 100,
3843
+ 101,
3844
+ 108,
3845
+ 101,
3846
+ 103,
3847
+ 97,
3848
+ 116,
3849
+ 101
3850
+ ]
3851
+ },
3852
+ {
3853
+ kind: "account",
3854
+ path: "reward_pool"
3855
+ }
3856
+ ]
3857
+ }
3858
+ },
3859
+ {
3860
+ name: "token_account",
3861
+ docs: [
3862
+ "Token account that stores tokens for funding, should be topped up prior to funding"
3863
+ ],
3864
+ writable: true,
3865
+ pda: {
3866
+ seeds: [
3867
+ {
3868
+ kind: "account",
3869
+ path: "fund_delegate"
3870
+ },
3871
+ {
3872
+ kind: "account",
3873
+ path: "token_program"
3874
+ },
3875
+ {
3876
+ kind: "account",
3877
+ path: "mint"
3878
+ }
3879
+ ],
3880
+ program: {
3881
+ kind: "const",
3882
+ value: [
3883
+ 140,
3884
+ 151,
3885
+ 37,
3886
+ 143,
3887
+ 78,
3888
+ 36,
3889
+ 137,
3890
+ 241,
3891
+ 187,
3892
+ 61,
3893
+ 16,
3894
+ 41,
3895
+ 20,
3896
+ 142,
3897
+ 13,
3898
+ 131,
3899
+ 11,
3900
+ 90,
3901
+ 19,
3902
+ 153,
3903
+ 218,
3904
+ 255,
3905
+ 16,
3906
+ 132,
3907
+ 4,
3908
+ 142,
3909
+ 123,
3910
+ 216,
3911
+ 219,
3912
+ 233,
3913
+ 248,
3914
+ 89
3915
+ ]
3916
+ }
3917
+ }
3918
+ },
3919
+ {
3920
+ name: "authority",
3921
+ docs: [
3922
+ "Reward Pool authority"
3923
+ ],
3924
+ writable: true,
3925
+ signer: true,
3926
+ relations: [
3927
+ "reward_pool"
3928
+ ]
3929
+ },
3930
+ {
3931
+ name: "worker",
3932
+ writable: true,
3933
+ address: "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u"
3934
+ },
3935
+ {
3936
+ name: "associated_token_program",
3937
+ docs: [
3938
+ "The [Associated Token] program."
3939
+ ],
3940
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
3941
+ },
3942
+ {
3943
+ name: "token_program"
3944
+ },
3945
+ {
3946
+ name: "system_program",
3947
+ address: "11111111111111111111111111111111"
3948
+ }
3949
+ ],
3950
+ args: [
3951
+ {
3952
+ name: "start_ts",
3953
+ type: "u64"
3954
+ },
3955
+ {
3956
+ name: "period",
3957
+ type: "u64"
3958
+ },
3959
+ {
3960
+ name: "expiry_ts",
3961
+ type: "u64"
3962
+ }
3963
+ ]
3964
+ },
3965
+ {
3966
+ name: "create_pool",
3967
+ discriminator: [
3968
+ 233,
3969
+ 146,
3970
+ 209,
3971
+ 142,
3972
+ 207,
3973
+ 104,
3974
+ 64,
3975
+ 188
3976
+ ],
3977
+ accounts: [
3978
+ {
3979
+ name: "stake_pool",
3980
+ docs: [
3981
+ "Stake Pool to Which Reward Pool is being added"
3982
+ ]
3983
+ },
3984
+ {
3985
+ name: "reward_pool",
3986
+ docs: [
3987
+ "Reward Pool to add"
3988
+ ],
3989
+ writable: true,
3990
+ pda: {
3991
+ seeds: [
3992
+ {
3993
+ kind: "const",
3994
+ value: [
3995
+ 114,
3996
+ 101,
3997
+ 119,
3998
+ 97,
3999
+ 114,
4000
+ 100,
4001
+ 45,
4002
+ 112,
4003
+ 111,
4004
+ 111,
4005
+ 108
4006
+ ]
4007
+ },
4008
+ {
4009
+ kind: "account",
4010
+ path: "stake_pool"
4011
+ },
4012
+ {
4013
+ kind: "account",
4014
+ path: "mint"
4015
+ },
4016
+ {
4017
+ kind: "arg",
4018
+ path: "nonce"
4019
+ }
4020
+ ]
4021
+ }
4022
+ },
4023
+ {
4024
+ name: "mint",
4025
+ docs: [
4026
+ "Mint used for rewards"
4027
+ ]
4028
+ },
4029
+ {
4030
+ name: "vault",
4031
+ docs: [
4032
+ "Escrow Account that will store the tokens"
4033
+ ],
4034
+ writable: true,
4035
+ pda: {
4036
+ seeds: [
4037
+ {
4038
+ kind: "const",
4039
+ value: [
4040
+ 114,
4041
+ 101,
4042
+ 119,
4043
+ 97,
4044
+ 114,
4045
+ 100,
4046
+ 45,
4047
+ 118,
4048
+ 97,
4049
+ 117,
4050
+ 108,
4051
+ 116
4052
+ ]
4053
+ },
4054
+ {
4055
+ kind: "account",
4056
+ path: "reward_pool"
4057
+ }
4058
+ ]
4059
+ }
4060
+ },
4061
+ {
4062
+ name: "governor",
4063
+ docs: [
4064
+ "Governor to be set for the RewardPool"
4065
+ ],
4066
+ optional: true
4067
+ },
4068
+ {
4069
+ name: "creator",
4070
+ docs: [
4071
+ "Reward Pool creator"
4072
+ ],
4073
+ writable: true,
4074
+ signer: true
4075
+ },
4076
+ {
4077
+ name: "token_program"
4078
+ },
4079
+ {
4080
+ name: "system_program",
4081
+ address: "11111111111111111111111111111111"
4082
+ }
4083
+ ],
4084
+ args: [
4085
+ {
4086
+ name: "nonce",
4087
+ type: "u8"
4088
+ },
4089
+ {
4090
+ name: "permissionless",
4091
+ type: "bool"
4092
+ },
4093
+ {
4094
+ name: "claim_period",
4095
+ type: "u64"
4096
+ },
4097
+ {
4098
+ name: "claim_start_ts",
4099
+ type: "u64"
4100
+ }
4101
+ ]
4102
+ },
4103
+ {
4104
+ name: "fund_as_delegate",
4105
+ discriminator: [
4106
+ 165,
4107
+ 90,
4108
+ 78,
4109
+ 137,
4110
+ 23,
4111
+ 155,
4112
+ 220,
4113
+ 116
4114
+ ],
4115
+ accounts: [
4116
+ {
4117
+ name: "caller",
4118
+ docs: [
4119
+ "Worker initiated the transaction"
4120
+ ],
4121
+ writable: true,
4122
+ signer: true
4123
+ },
4124
+ {
4125
+ name: "authority",
4126
+ writable: true,
4127
+ relations: [
4128
+ "reward_pool"
4129
+ ]
4130
+ },
4131
+ {
4132
+ name: "from",
4133
+ docs: [
4134
+ "Token Account from which tokens will be transferred"
4135
+ ],
4136
+ writable: true,
4137
+ pda: {
4138
+ seeds: [
4139
+ {
4140
+ kind: "account",
4141
+ path: "fund_delegate"
4142
+ },
4143
+ {
4144
+ kind: "account",
4145
+ path: "token_program"
4146
+ },
4147
+ {
4148
+ kind: "account",
4149
+ path: "mint"
4150
+ }
4151
+ ],
4152
+ program: {
4153
+ kind: "const",
4154
+ value: [
4155
+ 140,
4156
+ 151,
4157
+ 37,
4158
+ 143,
4159
+ 78,
4160
+ 36,
4161
+ 137,
4162
+ 241,
4163
+ 187,
4164
+ 61,
4165
+ 16,
4166
+ 41,
4167
+ 20,
4168
+ 142,
4169
+ 13,
4170
+ 131,
4171
+ 11,
4172
+ 90,
4173
+ 19,
4174
+ 153,
4175
+ 218,
4176
+ 255,
4177
+ 16,
4178
+ 132,
4179
+ 4,
4180
+ 142,
4181
+ 123,
4182
+ 216,
4183
+ 219,
4184
+ 233,
4185
+ 248,
4186
+ 89
4187
+ ]
4188
+ }
4189
+ }
4190
+ },
4191
+ {
4192
+ name: "vault",
4193
+ docs: [
4194
+ "Reward Pool Vault that stores tokens"
4195
+ ],
4196
+ writable: true,
4197
+ relations: [
4198
+ "reward_pool"
4199
+ ]
4200
+ },
4201
+ {
4202
+ name: "mint",
4203
+ docs: [
4204
+ "Mint of reward tokens"
4205
+ ],
4206
+ relations: [
4207
+ "reward_pool"
4208
+ ]
4209
+ },
4210
+ {
4211
+ name: "stake_pool",
4212
+ docs: [
4213
+ "Original Stake Pool"
4214
+ ],
4215
+ relations: [
4216
+ "reward_pool"
4217
+ ]
4218
+ },
4219
+ {
4220
+ name: "reward_pool",
4221
+ docs: [
4222
+ "Reward Pool"
4223
+ ],
4224
+ writable: true
4225
+ },
4226
+ {
4227
+ name: "fund_delegate",
4228
+ docs: [
4229
+ "Fund Delegate account that stores fund configuration"
4230
+ ],
4231
+ writable: true,
4232
+ pda: {
4233
+ seeds: [
4234
+ {
4235
+ kind: "const",
4236
+ value: [
4237
+ 102,
4238
+ 117,
4239
+ 110,
4240
+ 100,
4241
+ 45,
4242
+ 100,
4243
+ 101,
4244
+ 108,
4245
+ 101,
4246
+ 103,
4247
+ 97,
4248
+ 116,
4249
+ 101
4250
+ ]
4251
+ },
4252
+ {
4253
+ kind: "account",
4254
+ path: "reward_pool"
4255
+ }
4256
+ ]
4257
+ }
4258
+ },
4259
+ {
4260
+ name: "streamflow_treasury",
4261
+ writable: true,
4262
+ address: "5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw"
4263
+ },
4264
+ {
4265
+ name: "streamflow_treasury_tokens",
4266
+ writable: true,
4267
+ pda: {
4268
+ seeds: [
4269
+ {
4270
+ kind: "account",
4271
+ path: "streamflow_treasury"
4272
+ },
4273
+ {
4274
+ kind: "account",
4275
+ path: "token_program"
4276
+ },
4277
+ {
4278
+ kind: "account",
4279
+ path: "mint"
4280
+ }
4281
+ ],
4282
+ program: {
4283
+ kind: "const",
4284
+ value: [
4285
+ 140,
4286
+ 151,
4287
+ 37,
4288
+ 143,
4289
+ 78,
4290
+ 36,
4291
+ 137,
4292
+ 241,
4293
+ 187,
4294
+ 61,
4295
+ 16,
4296
+ 41,
4297
+ 20,
4298
+ 142,
4299
+ 13,
4300
+ 131,
4301
+ 11,
4302
+ 90,
4303
+ 19,
4304
+ 153,
4305
+ 218,
4306
+ 255,
4307
+ 16,
4308
+ 132,
4309
+ 4,
4310
+ 142,
4311
+ 123,
4312
+ 216,
4313
+ 219,
4314
+ 233,
4315
+ 248,
4316
+ 89
4317
+ ]
4318
+ }
4319
+ }
4320
+ },
4321
+ {
4322
+ name: "config",
3815
4323
  docs: [
3816
- "Reward Pool to add"
4324
+ "Fee Configuration"
3817
4325
  ],
3818
- writable: true,
3819
4326
  pda: {
3820
4327
  seeds: [
3821
4328
  {
3822
4329
  kind: "const",
3823
4330
  value: [
3824
- 114,
3825
- 101,
3826
- 119,
3827
- 97,
3828
- 114,
3829
- 100,
3830
- 45,
3831
- 112,
3832
- 111,
4331
+ 99,
3833
4332
  111,
3834
- 108
4333
+ 110,
4334
+ 102,
4335
+ 105,
4336
+ 103
3835
4337
  ]
3836
- },
3837
- {
3838
- kind: "account",
3839
- path: "stake_pool"
3840
- },
3841
- {
3842
- kind: "account",
3843
- path: "mint"
3844
- },
3845
- {
3846
- kind: "arg",
3847
- path: "nonce"
3848
4338
  }
3849
- ]
4339
+ ],
4340
+ program: {
4341
+ kind: "account",
4342
+ path: "fee_program"
4343
+ }
3850
4344
  }
3851
4345
  },
3852
4346
  {
3853
- name: "mint",
3854
- docs: [
3855
- "Mint used for rewards"
3856
- ]
3857
- },
3858
- {
3859
- name: "vault",
3860
- docs: [
3861
- "Escrow Account that will store the tokens"
3862
- ],
3863
- writable: true,
4347
+ name: "fee_value",
4348
+ optional: true,
3864
4349
  pda: {
3865
4350
  seeds: [
3866
4351
  {
3867
4352
  kind: "const",
3868
4353
  value: [
3869
- 114,
4354
+ 102,
4355
+ 101,
3870
4356
  101,
3871
- 119,
3872
- 97,
3873
- 114,
3874
- 100,
3875
4357
  45,
3876
4358
  118,
3877
4359
  97,
3878
- 117,
3879
4360
  108,
3880
- 116
4361
+ 117,
4362
+ 101
3881
4363
  ]
3882
4364
  },
3883
4365
  {
3884
4366
  kind: "account",
3885
- path: "reward_pool"
4367
+ path: "authority"
3886
4368
  }
3887
- ]
4369
+ ],
4370
+ program: {
4371
+ kind: "account",
4372
+ path: "fee_program"
4373
+ }
3888
4374
  }
3889
4375
  },
3890
4376
  {
3891
- name: "governor",
3892
- docs: [
3893
- "Governor to be set for the RewardPool"
3894
- ],
3895
- optional: true
3896
- },
3897
- {
3898
- name: "creator",
3899
- docs: [
3900
- "Reward Pool creator"
3901
- ],
3902
- writable: true,
3903
- signer: true
4377
+ name: "fee_program",
4378
+ address: "FEELzfBhsWXTNJX53zZcDVfRNoFYZQ6cZA3jLiGVL16V"
3904
4379
  },
3905
4380
  {
3906
4381
  name: "token_program"
3907
- },
3908
- {
3909
- name: "system_program",
3910
- address: "11111111111111111111111111111111"
3911
4382
  }
3912
4383
  ],
3913
- args: [
3914
- {
3915
- name: "nonce",
3916
- type: "u8"
3917
- },
3918
- {
3919
- name: "permissionless",
3920
- type: "bool"
3921
- },
3922
- {
3923
- name: "claim_period",
3924
- type: "u64"
3925
- },
3926
- {
3927
- name: "claim_start_ts",
3928
- type: "u64"
3929
- }
3930
- ]
4384
+ args: []
3931
4385
  },
3932
4386
  {
3933
4387
  name: "fund_pool",
@@ -4246,6 +4700,19 @@ var reward_pool_dynamic_default = {
4246
4700
  0
4247
4701
  ]
4248
4702
  },
4703
+ {
4704
+ name: "FundDelegate",
4705
+ discriminator: [
4706
+ 49,
4707
+ 154,
4708
+ 133,
4709
+ 22,
4710
+ 46,
4711
+ 68,
4712
+ 68,
4713
+ 44
4714
+ ]
4715
+ },
4249
4716
  {
4250
4717
  name: "Governor",
4251
4718
  discriminator: [
@@ -4410,6 +4877,26 @@ var reward_pool_dynamic_default = {
4410
4877
  code: 6016,
4411
4878
  name: "VoteRequired",
4412
4879
  msg: "Vote is required for claiming"
4880
+ },
4881
+ {
4882
+ code: 6017,
4883
+ name: "InvalidFundStart",
4884
+ msg: "Fund start can not be in the past"
4885
+ },
4886
+ {
4887
+ code: 6018,
4888
+ name: "InvalidFundPeriod",
4889
+ msg: "Fund period should be >= 1 day and less or equal than expiration"
4890
+ },
4891
+ {
4892
+ code: 6019,
4893
+ name: "InvalidFundExpiry",
4894
+ msg: "Fund expiration should be later than start time"
4895
+ },
4896
+ {
4897
+ code: 6020,
4898
+ name: "AlreadyFunded",
4899
+ msg: "Fund already happened for the current period"
4413
4900
  }
4414
4901
  ],
4415
4902
  types: [
@@ -4495,6 +4982,114 @@ var reward_pool_dynamic_default = {
4495
4982
  ]
4496
4983
  }
4497
4984
  },
4985
+ {
4986
+ name: "FundDelegate",
4987
+ type: {
4988
+ kind: "struct",
4989
+ fields: [
4990
+ {
4991
+ name: "bump",
4992
+ docs: [
4993
+ "Bump seed"
4994
+ ],
4995
+ type: "u8"
4996
+ },
4997
+ {
4998
+ name: "buffer",
4999
+ docs: [
5000
+ "Buffer to account for space"
5001
+ ],
5002
+ type: {
5003
+ array: [
5004
+ "u8",
5005
+ 7
5006
+ ]
5007
+ }
5008
+ },
5009
+ {
5010
+ name: "reward_pool",
5011
+ docs: [
5012
+ "Reward Pool"
5013
+ ],
5014
+ type: "pubkey"
5015
+ },
5016
+ {
5017
+ name: "start_ts",
5018
+ docs: [
5019
+ "Time when the first fund happens"
5020
+ ],
5021
+ type: "u64"
5022
+ },
5023
+ {
5024
+ name: "period",
5025
+ docs: [
5026
+ "Period of funds in seconds"
5027
+ ],
5028
+ type: "u64"
5029
+ },
5030
+ {
5031
+ name: "expiry_ts",
5032
+ docs: [
5033
+ "Time when vault expires and funds stop"
5034
+ ],
5035
+ type: "u64"
5036
+ },
5037
+ {
5038
+ name: "last_fund_ts",
5039
+ docs: [
5040
+ "Time when last fund happened"
5041
+ ],
5042
+ type: "u64"
5043
+ },
5044
+ {
5045
+ name: "mode",
5046
+ docs: [
5047
+ "Funding mode, may have its own configuration"
5048
+ ],
5049
+ type: {
5050
+ defined: {
5051
+ name: "FundMode"
5052
+ }
5053
+ }
5054
+ },
5055
+ {
5056
+ name: "buffer_1",
5057
+ docs: [
5058
+ "Buffer for additional fields"
5059
+ ],
5060
+ type: {
5061
+ array: [
5062
+ "u8",
5063
+ 64
5064
+ ]
5065
+ }
5066
+ },
5067
+ {
5068
+ name: "buffer_2",
5069
+ docs: [
5070
+ "Buffer for additional fields"
5071
+ ],
5072
+ type: {
5073
+ array: [
5074
+ "u8",
5075
+ 64
5076
+ ]
5077
+ }
5078
+ }
5079
+ ]
5080
+ }
5081
+ },
5082
+ {
5083
+ name: "FundMode",
5084
+ type: {
5085
+ kind: "enum",
5086
+ variants: [
5087
+ {
5088
+ name: "RevShare"
5089
+ }
5090
+ ]
5091
+ }
5092
+ },
4498
5093
  {
4499
5094
  name: "Governor",
4500
5095
  type: {
@@ -7080,6 +7675,9 @@ var deriveConfigPDA = (programId) => {
7080
7675
  var deriveFeeValuePDA = (programId, target) => {
7081
7676
  return PublicKey.findProgramAddressSync([FEE_VALUE_PREFIX, target.toBuffer()], programId)[0];
7082
7677
  };
7678
+ var deriveFundDelegatePDA = (programId, rewardPool) => {
7679
+ return PublicKey.findProgramAddressSync([FUND_DELEGATE_PREFIX, rewardPool.toBuffer()], programId)[0];
7680
+ };
7083
7681
 
7084
7682
  // solana/client.ts
7085
7683
  var SolanaStakingClient = class {
@@ -7571,6 +8169,30 @@ var SolanaStakingClient = class {
7571
8169
  }).instruction();
7572
8170
  return { ixs: [instruction] };
7573
8171
  }
8172
+ async createFundDelegate(data, extParams) {
8173
+ const { ixs, tokenAccount } = await this.prepareCreateFundDelegateInstructions(data, extParams);
8174
+ const { signature } = await this.execute(ixs, extParams);
8175
+ return {
8176
+ ixs,
8177
+ txId: signature,
8178
+ tokenAccount
8179
+ };
8180
+ }
8181
+ async prepareCreateFundDelegateInstructions({ rewardPool, startTs, period, expiryTs, tokenProgramId = TOKEN_PROGRAM_ID }, extParams) {
8182
+ const { rewardPoolDynamicProgram } = this.programs;
8183
+ const authority = extParams.invoker.publicKey;
8184
+ invariant(authority, "Undefined invoker publicKey");
8185
+ const rewardPoolPk = pk(rewardPool);
8186
+ const rewardPoolData = await rewardPoolDynamicProgram.account.rewardPool.fetch(rewardPoolPk);
8187
+ const mint = rewardPoolData.mint;
8188
+ const fundDelegate = deriveFundDelegatePDA(rewardPoolDynamicProgram.programId, rewardPoolPk);
8189
+ const tokenAccount = getAssociatedTokenAddressSync(mint, fundDelegate, true, pk(tokenProgramId));
8190
+ const instruction = await rewardPoolDynamicProgram.methods.createFundDelegate(startTs, period, expiryTs).accounts({
8191
+ rewardPool: rewardPoolPk,
8192
+ tokenProgram: tokenProgramId
8193
+ }).instruction();
8194
+ return { ixs: [instruction], tokenAccount };
8195
+ }
7574
8196
  async updateRewardPool(data, extParams) {
7575
8197
  const { ixs } = await this.prepareUpdateRewardPoolInstructions(data, extParams);
7576
8198
  const { signature } = await this.execute(ixs, extParams);
@@ -7865,6 +8487,6 @@ var calculateStakeWeight = (minDuration, maxDuration, maxWeight, duration) => {
7865
8487
  );
7866
8488
  };
7867
8489
 
7868
- export { RewardEntryAccumulator, SolanaStakingClient, calcRewards, calculateAmountWithTransferFees, calculateDecimalsShift, calculateFeeAmount, calculateRewardAmountFromRate, calculateRewardAmountFromValue, calculateRewardRateFromAmount, calculateStakeWeight, constants_exports as constants, deriveConfigPDA, deriveFeeValuePDA, deriveRewardEntryPDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, deriveStakeVaultPDA };
8490
+ export { RewardEntryAccumulator, SolanaStakingClient, calcRewards, calculateAmountWithTransferFees, calculateDecimalsShift, calculateFeeAmount, calculateRewardAmountFromRate, calculateRewardAmountFromValue, calculateRewardRateFromAmount, calculateStakeWeight, constants_exports as constants, deriveConfigPDA, deriveFeeValuePDA, deriveFundDelegatePDA, deriveRewardEntryPDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, deriveStakeVaultPDA };
7869
8491
  //# sourceMappingURL=index.js.map
7870
8492
  //# sourceMappingURL=index.js.map