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