@solana-mobile/guardian-client 0.0.0-stage → 0.1.0
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 +8 -2
- package/dist/src/index.js +4641 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.mjs +4282 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/types/generated/accounts/appAccount.d.ts +50 -0
- package/dist/types/generated/accounts/guardiansConfig.d.ts +54 -0
- package/dist/types/generated/accounts/index.d.ts +10 -0
- package/dist/types/generated/accounts/pendingRegistry.d.ts +35 -0
- package/dist/types/generated/constants/guardian.d.ts +8 -0
- package/dist/types/generated/constants/index.d.ts +8 -0
- package/dist/types/generated/errors/guardian.d.ts +95 -0
- package/dist/types/generated/errors/index.d.ts +8 -0
- package/dist/types/generated/events/appAuthorityAccepted.d.ts +42 -0
- package/dist/types/generated/events/appAuthorityProposed.d.ts +42 -0
- package/dist/types/generated/events/appDeveloperUpdated.d.ts +42 -0
- package/dist/types/generated/events/appRegistered.d.ts +42 -0
- package/dist/types/generated/events/configAuthorityAccepted.d.ts +38 -0
- package/dist/types/generated/events/configAuthorityProposed.d.ts +38 -0
- package/dist/types/generated/events/configInitialized.d.ts +46 -0
- package/dist/types/generated/events/configUpdated.d.ts +52 -0
- package/dist/types/generated/events/guardianAdded.d.ts +34 -0
- package/dist/types/generated/events/guardianRegistered.d.ts +46 -0
- package/dist/types/generated/events/guardianRemoved.d.ts +42 -0
- package/dist/types/generated/events/guardianVoteAuthorityRotated.d.ts +42 -0
- package/dist/types/generated/events/index.d.ts +25 -0
- package/dist/types/generated/events/releaseApproved.d.ts +27 -0
- package/dist/types/generated/events/releaseCancelled.d.ts +38 -0
- package/dist/types/generated/events/releaseExpired.d.ts +38 -0
- package/dist/types/generated/events/releaseProposed.d.ts +42 -0
- package/dist/types/generated/events/releaseRejected.d.ts +27 -0
- package/dist/types/generated/events/voteCast.d.ts +55 -0
- package/dist/types/generated/index.d.ts +15 -0
- package/dist/types/generated/instructions/acceptAppAuthority.d.ts +71 -0
- package/dist/types/generated/instructions/acceptConfigAuthority.d.ts +71 -0
- package/dist/types/generated/instructions/addGuardian.d.ts +90 -0
- package/dist/types/generated/instructions/cancelRelease.d.ts +78 -0
- package/dist/types/generated/instructions/expireRelease.d.ts +71 -0
- package/dist/types/generated/instructions/index.d.ts +24 -0
- package/dist/types/generated/instructions/initializeConfig.d.ts +135 -0
- package/dist/types/generated/instructions/proposeAppAuthority.d.ts +76 -0
- package/dist/types/generated/instructions/proposeConfigAuthority.d.ts +76 -0
- package/dist/types/generated/instructions/proposeRelease.d.ts +121 -0
- package/dist/types/generated/instructions/registerApp.d.ts +87 -0
- package/dist/types/generated/instructions/registerGuardian.d.ts +120 -0
- package/dist/types/generated/instructions/removeGuardian.d.ts +120 -0
- package/dist/types/generated/instructions/rotateVoteAuthority.d.ts +80 -0
- package/dist/types/generated/instructions/setAppDeveloper.d.ts +112 -0
- package/dist/types/generated/instructions/updateConfig.d.ts +88 -0
- package/dist/types/generated/instructions/vote.d.ts +116 -0
- package/dist/types/generated/instructions/writeReleaseManifest.d.ts +104 -0
- package/dist/types/generated/pdas/bondVault.d.ts +11 -0
- package/dist/types/generated/pdas/guardiansConfig.d.ts +11 -0
- package/dist/types/generated/pdas/index.d.ts +10 -0
- package/dist/types/generated/pdas/pendingRegistry.d.ts +11 -0
- package/dist/types/generated/programs/guardian.d.ts +179 -0
- package/dist/types/generated/programs/index.d.ts +8 -0
- package/dist/types/generated/types/bondInfo.d.ts +19 -0
- package/dist/types/generated/types/guardianInfo.d.ts +19 -0
- package/dist/types/generated/types/index.d.ts +14 -0
- package/dist/types/generated/types/pendingRelease.d.ts +29 -0
- package/dist/types/generated/types/publishedApp.d.ts +16 -0
- package/dist/types/generated/types/releaseManifest.d.ts +45 -0
- package/dist/types/generated/types/releaseResolution.d.ts +65 -0
- package/dist/types/generated/types/voteFinding.d.ts +24 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/manifest.d.ts +72 -0
- package/dist/types/proposal.d.ts +66 -0
- package/package.json +58 -3
|
@@ -0,0 +1,4282 @@
|
|
|
1
|
+
import { getStructEncoder, getAddressEncoder, getU64Encoder, getStructDecoder, getAddressDecoder, getU64Decoder, combineCodec, getDiscriminatedUnionEncoder, getUnitEncoder, getTupleEncoder, getDiscriminatedUnionDecoder, getUnitDecoder, getTupleDecoder, getU32Encoder, fixEncoderSize, getBytesEncoder, getU32Decoder, fixDecoderSize, getBytesDecoder, getBooleanEncoder, getI64Encoder, addEncoderSizePrefix, getMapEncoder, getBooleanDecoder, getI64Decoder, addDecoderSizePrefix, getMapDecoder, getU8Encoder, getArrayEncoder, getU8Decoder, getArrayDecoder, getU16Encoder, getUtf8Encoder, getU16Decoder, getUtf8Decoder, transformEncoder, getSetEncoder, getSetDecoder, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, getProgramDerivedAddress, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, getOptionEncoder, getOptionDecoder, containsBytes, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, assertIsInstructionWithAccounts, extendClient, isProgramError, getHiddenPrefixEncoder, getConstantEncoder, getHiddenPrefixDecoder, getConstantDecoder, getHiddenPrefixCodec, getStructCodec, getU32Codec, getArrayCodec, getNullableEncoder, getConstantCodec, transformCodec, fixCodecSize, getBytesCodec, createDecoder } from '@solana/kit';
|
|
2
|
+
import { getAccountMetaFactory, addSelfPlanAndSendFunctions, addSelfFetchFunctions } from '@solana/program-client-core';
|
|
3
|
+
|
|
4
|
+
// src/generated/accounts/appAccount.ts
|
|
5
|
+
function getBondInfoEncoder() {
|
|
6
|
+
return getStructEncoder([
|
|
7
|
+
["mint", getAddressEncoder()],
|
|
8
|
+
["amount", getU64Encoder()]
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
11
|
+
function getBondInfoDecoder() {
|
|
12
|
+
return getStructDecoder([
|
|
13
|
+
["mint", getAddressDecoder()],
|
|
14
|
+
["amount", getU64Decoder()]
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
function getBondInfoCodec() {
|
|
18
|
+
return combineCodec(getBondInfoEncoder(), getBondInfoDecoder());
|
|
19
|
+
}
|
|
20
|
+
function getGuardianInfoEncoder() {
|
|
21
|
+
return getStructEncoder([
|
|
22
|
+
["voteAuthority", getAddressEncoder()],
|
|
23
|
+
["bond", getU64Encoder()]
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
function getGuardianInfoDecoder() {
|
|
27
|
+
return getStructDecoder([
|
|
28
|
+
["voteAuthority", getAddressDecoder()],
|
|
29
|
+
["bond", getU64Decoder()]
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
function getGuardianInfoCodec() {
|
|
33
|
+
return combineCodec(getGuardianInfoEncoder(), getGuardianInfoDecoder());
|
|
34
|
+
}
|
|
35
|
+
function getPendingReleaseEncoder() {
|
|
36
|
+
return getDiscriminatedUnionEncoder([
|
|
37
|
+
["None", getUnitEncoder()],
|
|
38
|
+
["Pending", getStructEncoder([["fields", getTupleEncoder([getReleaseManifestEncoder()])]])]
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
function getPendingReleaseDecoder() {
|
|
42
|
+
return getDiscriminatedUnionDecoder([
|
|
43
|
+
["None", getUnitDecoder()],
|
|
44
|
+
["Pending", getStructDecoder([["fields", getTupleDecoder([getReleaseManifestDecoder()])]])]
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
function getPendingReleaseCodec() {
|
|
48
|
+
return combineCodec(getPendingReleaseEncoder(), getPendingReleaseDecoder());
|
|
49
|
+
}
|
|
50
|
+
function pendingRelease(kind, data) {
|
|
51
|
+
return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...data ?? {} };
|
|
52
|
+
}
|
|
53
|
+
function isPendingRelease(kind, value) {
|
|
54
|
+
return value.__kind === kind;
|
|
55
|
+
}
|
|
56
|
+
function getPublishedAppEncoder() {
|
|
57
|
+
return getStructEncoder([
|
|
58
|
+
["versionCode", getU32Encoder()],
|
|
59
|
+
["manifestHash", fixEncoderSize(getBytesEncoder(), 32)]
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
function getPublishedAppDecoder() {
|
|
63
|
+
return getStructDecoder([
|
|
64
|
+
["versionCode", getU32Decoder()],
|
|
65
|
+
["manifestHash", fixDecoderSize(getBytesDecoder(), 32)]
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
function getPublishedAppCodec() {
|
|
69
|
+
return combineCodec(getPublishedAppEncoder(), getPublishedAppDecoder());
|
|
70
|
+
}
|
|
71
|
+
function getReleaseManifestEncoder() {
|
|
72
|
+
return getStructEncoder([
|
|
73
|
+
["versionCode", getU32Encoder()],
|
|
74
|
+
["finalized", getBooleanEncoder()],
|
|
75
|
+
["guardianNonce", getU32Encoder()],
|
|
76
|
+
["manifestHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
77
|
+
["policyBundleHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
78
|
+
["resolved", getBooleanEncoder()],
|
|
79
|
+
["approved", getBooleanEncoder()],
|
|
80
|
+
["quorumTs", getI64Encoder()],
|
|
81
|
+
["votingDeadline", getI64Encoder()],
|
|
82
|
+
["finalizeTs", getI64Encoder()],
|
|
83
|
+
["finalizeSeq", getU64Encoder()],
|
|
84
|
+
["previousFinalizeTs", getI64Encoder()],
|
|
85
|
+
["certificateSha256", fixEncoderSize(getBytesEncoder(), 32)],
|
|
86
|
+
["data", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
87
|
+
["votes", getMapEncoder(getAddressEncoder(), getBooleanEncoder())]
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
function getReleaseManifestDecoder() {
|
|
91
|
+
return getStructDecoder([
|
|
92
|
+
["versionCode", getU32Decoder()],
|
|
93
|
+
["finalized", getBooleanDecoder()],
|
|
94
|
+
["guardianNonce", getU32Decoder()],
|
|
95
|
+
["manifestHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
96
|
+
["policyBundleHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
97
|
+
["resolved", getBooleanDecoder()],
|
|
98
|
+
["approved", getBooleanDecoder()],
|
|
99
|
+
["quorumTs", getI64Decoder()],
|
|
100
|
+
["votingDeadline", getI64Decoder()],
|
|
101
|
+
["finalizeTs", getI64Decoder()],
|
|
102
|
+
["finalizeSeq", getU64Decoder()],
|
|
103
|
+
["previousFinalizeTs", getI64Decoder()],
|
|
104
|
+
["certificateSha256", fixDecoderSize(getBytesDecoder(), 32)],
|
|
105
|
+
["data", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
106
|
+
["votes", getMapDecoder(getAddressDecoder(), getBooleanDecoder())]
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
function getReleaseManifestCodec() {
|
|
110
|
+
return combineCodec(getReleaseManifestEncoder(), getReleaseManifestDecoder());
|
|
111
|
+
}
|
|
112
|
+
function getReleaseResolutionEncoder() {
|
|
113
|
+
return getStructEncoder([
|
|
114
|
+
["version", getU8Encoder()],
|
|
115
|
+
["seq", getU64Encoder()],
|
|
116
|
+
["app", getAddressEncoder()],
|
|
117
|
+
["versionCode", getU32Encoder()],
|
|
118
|
+
["manifestHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
119
|
+
["certificateSha256", fixEncoderSize(getBytesEncoder(), 32)],
|
|
120
|
+
["guardianNonce", getU32Encoder()],
|
|
121
|
+
["approvals", getArrayEncoder(getAddressEncoder())],
|
|
122
|
+
["rejections", getArrayEncoder(getAddressEncoder())],
|
|
123
|
+
["manifest", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())]
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
function getReleaseResolutionDecoder() {
|
|
127
|
+
return getStructDecoder([
|
|
128
|
+
["version", getU8Decoder()],
|
|
129
|
+
["seq", getU64Decoder()],
|
|
130
|
+
["app", getAddressDecoder()],
|
|
131
|
+
["versionCode", getU32Decoder()],
|
|
132
|
+
["manifestHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
133
|
+
["certificateSha256", fixDecoderSize(getBytesDecoder(), 32)],
|
|
134
|
+
["guardianNonce", getU32Decoder()],
|
|
135
|
+
["approvals", getArrayDecoder(getAddressDecoder())],
|
|
136
|
+
["rejections", getArrayDecoder(getAddressDecoder())],
|
|
137
|
+
["manifest", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())]
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
function getReleaseResolutionCodec() {
|
|
141
|
+
return combineCodec(getReleaseResolutionEncoder(), getReleaseResolutionDecoder());
|
|
142
|
+
}
|
|
143
|
+
function getVoteFindingEncoder() {
|
|
144
|
+
return getStructEncoder([
|
|
145
|
+
["code", getU16Encoder()],
|
|
146
|
+
["status", getU8Encoder()],
|
|
147
|
+
["detail", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
148
|
+
]);
|
|
149
|
+
}
|
|
150
|
+
function getVoteFindingDecoder() {
|
|
151
|
+
return getStructDecoder([
|
|
152
|
+
["code", getU16Decoder()],
|
|
153
|
+
["status", getU8Decoder()],
|
|
154
|
+
["detail", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())]
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
function getVoteFindingCodec() {
|
|
158
|
+
return combineCodec(getVoteFindingEncoder(), getVoteFindingDecoder());
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/generated/accounts/appAccount.ts
|
|
162
|
+
var APP_ACCOUNT_DISCRIMINATOR = new Uint8Array([189, 192, 243, 151, 141, 78, 227, 17]);
|
|
163
|
+
function getAppAccountDiscriminatorBytes() {
|
|
164
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(APP_ACCOUNT_DISCRIMINATOR);
|
|
165
|
+
}
|
|
166
|
+
function getAppAccountEncoder() {
|
|
167
|
+
return transformEncoder(
|
|
168
|
+
getStructEncoder([
|
|
169
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
170
|
+
["version", getU8Encoder()],
|
|
171
|
+
["authority", getAddressEncoder()],
|
|
172
|
+
["pendingAuthority", getAddressEncoder()],
|
|
173
|
+
["eventSeq", getU64Encoder()],
|
|
174
|
+
["lastResolvedVersion", getU32Encoder()],
|
|
175
|
+
["lastFinalizeTs", getI64Encoder()],
|
|
176
|
+
["signingCertificate", fixEncoderSize(getBytesEncoder(), 32)],
|
|
177
|
+
["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
178
|
+
["developers", getSetEncoder(getAddressEncoder())],
|
|
179
|
+
["publishedVersions", getArrayEncoder(getPublishedAppEncoder())],
|
|
180
|
+
["pendingRelease", getPendingReleaseEncoder()]
|
|
181
|
+
]),
|
|
182
|
+
(value) => ({ ...value, discriminator: APP_ACCOUNT_DISCRIMINATOR })
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function getAppAccountDecoder() {
|
|
186
|
+
return getStructDecoder([
|
|
187
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
188
|
+
["version", getU8Decoder()],
|
|
189
|
+
["authority", getAddressDecoder()],
|
|
190
|
+
["pendingAuthority", getAddressDecoder()],
|
|
191
|
+
["eventSeq", getU64Decoder()],
|
|
192
|
+
["lastResolvedVersion", getU32Decoder()],
|
|
193
|
+
["lastFinalizeTs", getI64Decoder()],
|
|
194
|
+
["signingCertificate", fixDecoderSize(getBytesDecoder(), 32)],
|
|
195
|
+
["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
196
|
+
["developers", getSetDecoder(getAddressDecoder())],
|
|
197
|
+
["publishedVersions", getArrayDecoder(getPublishedAppDecoder())],
|
|
198
|
+
["pendingRelease", getPendingReleaseDecoder()]
|
|
199
|
+
]);
|
|
200
|
+
}
|
|
201
|
+
function getAppAccountCodec() {
|
|
202
|
+
return combineCodec(getAppAccountEncoder(), getAppAccountDecoder());
|
|
203
|
+
}
|
|
204
|
+
function decodeAppAccount(encodedAccount) {
|
|
205
|
+
return decodeAccount(encodedAccount, getAppAccountDecoder());
|
|
206
|
+
}
|
|
207
|
+
async function fetchAppAccount(rpc, address, config) {
|
|
208
|
+
const maybeAccount = await fetchMaybeAppAccount(rpc, address, config);
|
|
209
|
+
assertAccountExists(maybeAccount);
|
|
210
|
+
return maybeAccount;
|
|
211
|
+
}
|
|
212
|
+
async function fetchMaybeAppAccount(rpc, address, config) {
|
|
213
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
214
|
+
rpc,
|
|
215
|
+
typeof address === "string" ? address : address.address,
|
|
216
|
+
config
|
|
217
|
+
);
|
|
218
|
+
return decodeAppAccount(maybeAccount);
|
|
219
|
+
}
|
|
220
|
+
async function fetchAllAppAccount(rpc, addresses, config) {
|
|
221
|
+
const maybeAccounts = await fetchAllMaybeAppAccount(rpc, addresses, config);
|
|
222
|
+
assertAccountsExist(maybeAccounts);
|
|
223
|
+
return maybeAccounts;
|
|
224
|
+
}
|
|
225
|
+
async function fetchAllMaybeAppAccount(rpc, addresses, config) {
|
|
226
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
227
|
+
rpc,
|
|
228
|
+
addresses.map((a) => typeof a === "string" ? a : a.address),
|
|
229
|
+
config
|
|
230
|
+
);
|
|
231
|
+
return maybeAccounts.map((maybeAccount) => decodeAppAccount(maybeAccount));
|
|
232
|
+
}
|
|
233
|
+
var GUARDIANS_CONFIG_DISCRIMINATOR = new Uint8Array([96, 9, 56, 96, 215, 120, 26, 206]);
|
|
234
|
+
function getGuardiansConfigDiscriminatorBytes() {
|
|
235
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(GUARDIANS_CONFIG_DISCRIMINATOR);
|
|
236
|
+
}
|
|
237
|
+
function getGuardiansConfigEncoder() {
|
|
238
|
+
return transformEncoder(
|
|
239
|
+
getStructEncoder([
|
|
240
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
241
|
+
["version", getU8Encoder()],
|
|
242
|
+
["bump", getU8Encoder()],
|
|
243
|
+
["authority", getAddressEncoder()],
|
|
244
|
+
["pendingAuthority", getAddressEncoder()],
|
|
245
|
+
["bond", getBondInfoEncoder()],
|
|
246
|
+
["updateNonce", getU32Encoder()],
|
|
247
|
+
["eventSeq", getU64Encoder()],
|
|
248
|
+
["policyBundleHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
249
|
+
["voteWindow", getU32Encoder()],
|
|
250
|
+
["votingPeriod", getU32Encoder()],
|
|
251
|
+
["pendingGuardians", getSetEncoder(getAddressEncoder())],
|
|
252
|
+
["guardians", getMapEncoder(getAddressEncoder(), getGuardianInfoEncoder())],
|
|
253
|
+
["voters", getMapEncoder(getAddressEncoder(), getAddressEncoder())]
|
|
254
|
+
]),
|
|
255
|
+
(value) => ({ ...value, discriminator: GUARDIANS_CONFIG_DISCRIMINATOR })
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
function getGuardiansConfigDecoder() {
|
|
259
|
+
return getStructDecoder([
|
|
260
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
261
|
+
["version", getU8Decoder()],
|
|
262
|
+
["bump", getU8Decoder()],
|
|
263
|
+
["authority", getAddressDecoder()],
|
|
264
|
+
["pendingAuthority", getAddressDecoder()],
|
|
265
|
+
["bond", getBondInfoDecoder()],
|
|
266
|
+
["updateNonce", getU32Decoder()],
|
|
267
|
+
["eventSeq", getU64Decoder()],
|
|
268
|
+
["policyBundleHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
269
|
+
["voteWindow", getU32Decoder()],
|
|
270
|
+
["votingPeriod", getU32Decoder()],
|
|
271
|
+
["pendingGuardians", getSetDecoder(getAddressDecoder())],
|
|
272
|
+
["guardians", getMapDecoder(getAddressDecoder(), getGuardianInfoDecoder())],
|
|
273
|
+
["voters", getMapDecoder(getAddressDecoder(), getAddressDecoder())]
|
|
274
|
+
]);
|
|
275
|
+
}
|
|
276
|
+
function getGuardiansConfigCodec() {
|
|
277
|
+
return combineCodec(getGuardiansConfigEncoder(), getGuardiansConfigDecoder());
|
|
278
|
+
}
|
|
279
|
+
function decodeGuardiansConfig(encodedAccount) {
|
|
280
|
+
return decodeAccount(encodedAccount, getGuardiansConfigDecoder());
|
|
281
|
+
}
|
|
282
|
+
async function fetchGuardiansConfig(rpc, address, config) {
|
|
283
|
+
const maybeAccount = await fetchMaybeGuardiansConfig(rpc, address, config);
|
|
284
|
+
assertAccountExists(maybeAccount);
|
|
285
|
+
return maybeAccount;
|
|
286
|
+
}
|
|
287
|
+
async function fetchMaybeGuardiansConfig(rpc, address, config) {
|
|
288
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
289
|
+
rpc,
|
|
290
|
+
typeof address === "string" ? address : address.address,
|
|
291
|
+
config
|
|
292
|
+
);
|
|
293
|
+
return decodeGuardiansConfig(maybeAccount);
|
|
294
|
+
}
|
|
295
|
+
async function fetchAllGuardiansConfig(rpc, addresses, config) {
|
|
296
|
+
const maybeAccounts = await fetchAllMaybeGuardiansConfig(rpc, addresses, config);
|
|
297
|
+
assertAccountsExist(maybeAccounts);
|
|
298
|
+
return maybeAccounts;
|
|
299
|
+
}
|
|
300
|
+
async function fetchAllMaybeGuardiansConfig(rpc, addresses, config) {
|
|
301
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
302
|
+
rpc,
|
|
303
|
+
addresses.map((a) => typeof a === "string" ? a : a.address),
|
|
304
|
+
config
|
|
305
|
+
);
|
|
306
|
+
return maybeAccounts.map((maybeAccount) => decodeGuardiansConfig(maybeAccount));
|
|
307
|
+
}
|
|
308
|
+
var PENDING_REGISTRY_DISCRIMINATOR = new Uint8Array([190, 252, 14, 196, 56, 47, 120, 61]);
|
|
309
|
+
function getPendingRegistryDiscriminatorBytes() {
|
|
310
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(PENDING_REGISTRY_DISCRIMINATOR);
|
|
311
|
+
}
|
|
312
|
+
function getPendingRegistryEncoder() {
|
|
313
|
+
return transformEncoder(
|
|
314
|
+
getStructEncoder([
|
|
315
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
316
|
+
["version", getU8Encoder()],
|
|
317
|
+
["bump", getU8Encoder()],
|
|
318
|
+
["finalizeSeq", getU64Encoder()],
|
|
319
|
+
["pending", getSetEncoder(getAddressEncoder())]
|
|
320
|
+
]),
|
|
321
|
+
(value) => ({ ...value, discriminator: PENDING_REGISTRY_DISCRIMINATOR })
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
function getPendingRegistryDecoder() {
|
|
325
|
+
return getStructDecoder([
|
|
326
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
327
|
+
["version", getU8Decoder()],
|
|
328
|
+
["bump", getU8Decoder()],
|
|
329
|
+
["finalizeSeq", getU64Decoder()],
|
|
330
|
+
["pending", getSetDecoder(getAddressDecoder())]
|
|
331
|
+
]);
|
|
332
|
+
}
|
|
333
|
+
function getPendingRegistryCodec() {
|
|
334
|
+
return combineCodec(getPendingRegistryEncoder(), getPendingRegistryDecoder());
|
|
335
|
+
}
|
|
336
|
+
function decodePendingRegistry(encodedAccount) {
|
|
337
|
+
return decodeAccount(encodedAccount, getPendingRegistryDecoder());
|
|
338
|
+
}
|
|
339
|
+
async function fetchPendingRegistry(rpc, address, config) {
|
|
340
|
+
const maybeAccount = await fetchMaybePendingRegistry(rpc, address, config);
|
|
341
|
+
assertAccountExists(maybeAccount);
|
|
342
|
+
return maybeAccount;
|
|
343
|
+
}
|
|
344
|
+
async function fetchMaybePendingRegistry(rpc, address, config) {
|
|
345
|
+
const maybeAccount = await fetchEncodedAccount(
|
|
346
|
+
rpc,
|
|
347
|
+
typeof address === "string" ? address : address.address,
|
|
348
|
+
config
|
|
349
|
+
);
|
|
350
|
+
return decodePendingRegistry(maybeAccount);
|
|
351
|
+
}
|
|
352
|
+
async function fetchAllPendingRegistry(rpc, addresses, config) {
|
|
353
|
+
const maybeAccounts = await fetchAllMaybePendingRegistry(rpc, addresses, config);
|
|
354
|
+
assertAccountsExist(maybeAccounts);
|
|
355
|
+
return maybeAccounts;
|
|
356
|
+
}
|
|
357
|
+
async function fetchAllMaybePendingRegistry(rpc, addresses, config) {
|
|
358
|
+
const maybeAccounts = await fetchEncodedAccounts(
|
|
359
|
+
rpc,
|
|
360
|
+
addresses.map((a) => typeof a === "string" ? a : a.address),
|
|
361
|
+
config
|
|
362
|
+
);
|
|
363
|
+
return maybeAccounts.map((maybeAccount) => decodePendingRegistry(maybeAccount));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/generated/constants/guardian.ts
|
|
367
|
+
var MAX_MANIFEST_LEN = 8051;
|
|
368
|
+
var ACCEPT_APP_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
369
|
+
227,
|
|
370
|
+
109,
|
|
371
|
+
248,
|
|
372
|
+
178,
|
|
373
|
+
27,
|
|
374
|
+
2,
|
|
375
|
+
126,
|
|
376
|
+
21
|
|
377
|
+
]);
|
|
378
|
+
function getAcceptAppAuthorityDiscriminatorBytes() {
|
|
379
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(ACCEPT_APP_AUTHORITY_DISCRIMINATOR);
|
|
380
|
+
}
|
|
381
|
+
function getAcceptAppAuthorityInstructionDataEncoder() {
|
|
382
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
383
|
+
...value,
|
|
384
|
+
discriminator: ACCEPT_APP_AUTHORITY_DISCRIMINATOR
|
|
385
|
+
}));
|
|
386
|
+
}
|
|
387
|
+
function getAcceptAppAuthorityInstructionDataDecoder() {
|
|
388
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
389
|
+
}
|
|
390
|
+
function getAcceptAppAuthorityInstructionDataCodec() {
|
|
391
|
+
return combineCodec(getAcceptAppAuthorityInstructionDataEncoder(), getAcceptAppAuthorityInstructionDataDecoder());
|
|
392
|
+
}
|
|
393
|
+
async function getAcceptAppAuthorityInstructionAsync(input, config) {
|
|
394
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
395
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
396
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
397
|
+
const originalAccounts = {
|
|
398
|
+
newAuthority: { value: input.newAuthority ?? null, isSigner: true, isWritable: false },
|
|
399
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
400
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
401
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
402
|
+
};
|
|
403
|
+
const accounts = originalAccounts;
|
|
404
|
+
if (!accounts.eventAuthority.value) {
|
|
405
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
406
|
+
programAddress,
|
|
407
|
+
seeds: [
|
|
408
|
+
getBytesEncoder().encode(
|
|
409
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
410
|
+
)
|
|
411
|
+
]
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (!accounts.program.value) {
|
|
415
|
+
accounts.program.value = programAddress;
|
|
416
|
+
accounts.program.isWritable = false;
|
|
417
|
+
}
|
|
418
|
+
return Object.freeze({
|
|
419
|
+
accounts: [
|
|
420
|
+
getAccountMeta("newAuthority", accounts.newAuthority),
|
|
421
|
+
getAccountMeta("app", accounts.app),
|
|
422
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
423
|
+
getAccountMeta("program", accounts.program)
|
|
424
|
+
],
|
|
425
|
+
data: getAcceptAppAuthorityInstructionDataEncoder().encode({}),
|
|
426
|
+
programAddress
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
function getAcceptAppAuthorityInstruction(input, config) {
|
|
430
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
431
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
432
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
433
|
+
const originalAccounts = {
|
|
434
|
+
newAuthority: { value: input.newAuthority ?? null, isSigner: true, isWritable: false },
|
|
435
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
436
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
437
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
438
|
+
};
|
|
439
|
+
const accounts = originalAccounts;
|
|
440
|
+
if (!accounts.program.value) {
|
|
441
|
+
accounts.program.value = programAddress;
|
|
442
|
+
accounts.program.isWritable = false;
|
|
443
|
+
}
|
|
444
|
+
return Object.freeze({
|
|
445
|
+
accounts: [
|
|
446
|
+
getAccountMeta("newAuthority", accounts.newAuthority),
|
|
447
|
+
getAccountMeta("app", accounts.app),
|
|
448
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
449
|
+
getAccountMeta("program", accounts.program)
|
|
450
|
+
],
|
|
451
|
+
data: getAcceptAppAuthorityInstructionDataEncoder().encode({}),
|
|
452
|
+
programAddress
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function parseAcceptAppAuthorityInstruction(instruction) {
|
|
456
|
+
if (instruction.accounts.length < 4) {
|
|
457
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
458
|
+
actualAccountMetas: instruction.accounts.length,
|
|
459
|
+
expectedAccountMetas: 4
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
let accountIndex = 0;
|
|
463
|
+
const getNextAccount = () => {
|
|
464
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
465
|
+
accountIndex += 1;
|
|
466
|
+
return accountMeta;
|
|
467
|
+
};
|
|
468
|
+
return {
|
|
469
|
+
programAddress: instruction.programAddress,
|
|
470
|
+
accounts: {
|
|
471
|
+
newAuthority: getNextAccount(),
|
|
472
|
+
app: getNextAccount(),
|
|
473
|
+
eventAuthority: getNextAccount(),
|
|
474
|
+
program: getNextAccount()
|
|
475
|
+
},
|
|
476
|
+
data: getAcceptAppAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
var ACCEPT_CONFIG_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
480
|
+
138,
|
|
481
|
+
34,
|
|
482
|
+
130,
|
|
483
|
+
16,
|
|
484
|
+
252,
|
|
485
|
+
207,
|
|
486
|
+
24,
|
|
487
|
+
90
|
|
488
|
+
]);
|
|
489
|
+
function getAcceptConfigAuthorityDiscriminatorBytes() {
|
|
490
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(ACCEPT_CONFIG_AUTHORITY_DISCRIMINATOR);
|
|
491
|
+
}
|
|
492
|
+
function getAcceptConfigAuthorityInstructionDataEncoder() {
|
|
493
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
494
|
+
...value,
|
|
495
|
+
discriminator: ACCEPT_CONFIG_AUTHORITY_DISCRIMINATOR
|
|
496
|
+
}));
|
|
497
|
+
}
|
|
498
|
+
function getAcceptConfigAuthorityInstructionDataDecoder() {
|
|
499
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
500
|
+
}
|
|
501
|
+
function getAcceptConfigAuthorityInstructionDataCodec() {
|
|
502
|
+
return combineCodec(
|
|
503
|
+
getAcceptConfigAuthorityInstructionDataEncoder(),
|
|
504
|
+
getAcceptConfigAuthorityInstructionDataDecoder()
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
async function getAcceptConfigAuthorityInstructionAsync(input, config) {
|
|
508
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
509
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
510
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
511
|
+
const originalAccounts = {
|
|
512
|
+
newAuthority: { value: input.newAuthority ?? null, isSigner: true, isWritable: false },
|
|
513
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
514
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
515
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
516
|
+
};
|
|
517
|
+
const accounts = originalAccounts;
|
|
518
|
+
if (!accounts.config.value) {
|
|
519
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
520
|
+
programAddress,
|
|
521
|
+
seeds: [
|
|
522
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
523
|
+
]
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if (!accounts.eventAuthority.value) {
|
|
527
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
528
|
+
programAddress,
|
|
529
|
+
seeds: [
|
|
530
|
+
getBytesEncoder().encode(
|
|
531
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
532
|
+
)
|
|
533
|
+
]
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
if (!accounts.program.value) {
|
|
537
|
+
accounts.program.value = programAddress;
|
|
538
|
+
accounts.program.isWritable = false;
|
|
539
|
+
}
|
|
540
|
+
return Object.freeze({
|
|
541
|
+
accounts: [
|
|
542
|
+
getAccountMeta("newAuthority", accounts.newAuthority),
|
|
543
|
+
getAccountMeta("config", accounts.config),
|
|
544
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
545
|
+
getAccountMeta("program", accounts.program)
|
|
546
|
+
],
|
|
547
|
+
data: getAcceptConfigAuthorityInstructionDataEncoder().encode({}),
|
|
548
|
+
programAddress
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
function getAcceptConfigAuthorityInstruction(input, config) {
|
|
552
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
553
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
554
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
555
|
+
const originalAccounts = {
|
|
556
|
+
newAuthority: { value: input.newAuthority ?? null, isSigner: true, isWritable: false },
|
|
557
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
558
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
559
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
560
|
+
};
|
|
561
|
+
const accounts = originalAccounts;
|
|
562
|
+
if (!accounts.program.value) {
|
|
563
|
+
accounts.program.value = programAddress;
|
|
564
|
+
accounts.program.isWritable = false;
|
|
565
|
+
}
|
|
566
|
+
return Object.freeze({
|
|
567
|
+
accounts: [
|
|
568
|
+
getAccountMeta("newAuthority", accounts.newAuthority),
|
|
569
|
+
getAccountMeta("config", accounts.config),
|
|
570
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
571
|
+
getAccountMeta("program", accounts.program)
|
|
572
|
+
],
|
|
573
|
+
data: getAcceptConfigAuthorityInstructionDataEncoder().encode({}),
|
|
574
|
+
programAddress
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
function parseAcceptConfigAuthorityInstruction(instruction) {
|
|
578
|
+
if (instruction.accounts.length < 4) {
|
|
579
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
580
|
+
actualAccountMetas: instruction.accounts.length,
|
|
581
|
+
expectedAccountMetas: 4
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
let accountIndex = 0;
|
|
585
|
+
const getNextAccount = () => {
|
|
586
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
587
|
+
accountIndex += 1;
|
|
588
|
+
return accountMeta;
|
|
589
|
+
};
|
|
590
|
+
return {
|
|
591
|
+
programAddress: instruction.programAddress,
|
|
592
|
+
accounts: {
|
|
593
|
+
newAuthority: getNextAccount(),
|
|
594
|
+
config: getNextAccount(),
|
|
595
|
+
eventAuthority: getNextAccount(),
|
|
596
|
+
program: getNextAccount()
|
|
597
|
+
},
|
|
598
|
+
data: getAcceptConfigAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
var ADD_GUARDIAN_DISCRIMINATOR = new Uint8Array([167, 189, 170, 27, 74, 240, 201, 241]);
|
|
602
|
+
function getAddGuardianDiscriminatorBytes() {
|
|
603
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(ADD_GUARDIAN_DISCRIMINATOR);
|
|
604
|
+
}
|
|
605
|
+
function getAddGuardianInstructionDataEncoder() {
|
|
606
|
+
return transformEncoder(
|
|
607
|
+
getStructEncoder([
|
|
608
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
609
|
+
["guardian", getAddressEncoder()]
|
|
610
|
+
]),
|
|
611
|
+
(value) => ({ ...value, discriminator: ADD_GUARDIAN_DISCRIMINATOR })
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
function getAddGuardianInstructionDataDecoder() {
|
|
615
|
+
return getStructDecoder([
|
|
616
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
617
|
+
["guardian", getAddressDecoder()]
|
|
618
|
+
]);
|
|
619
|
+
}
|
|
620
|
+
function getAddGuardianInstructionDataCodec() {
|
|
621
|
+
return combineCodec(getAddGuardianInstructionDataEncoder(), getAddGuardianInstructionDataDecoder());
|
|
622
|
+
}
|
|
623
|
+
async function getAddGuardianInstructionAsync(input, config) {
|
|
624
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
625
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
626
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
627
|
+
const originalAccounts = {
|
|
628
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
629
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
630
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
631
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
632
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
633
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
634
|
+
};
|
|
635
|
+
const accounts = originalAccounts;
|
|
636
|
+
const args = { ...input };
|
|
637
|
+
if (!accounts.config.value) {
|
|
638
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
639
|
+
programAddress,
|
|
640
|
+
seeds: [
|
|
641
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
642
|
+
]
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
if (!accounts.systemProgram.value) {
|
|
646
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
647
|
+
}
|
|
648
|
+
if (!accounts.eventAuthority.value) {
|
|
649
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
650
|
+
programAddress,
|
|
651
|
+
seeds: [
|
|
652
|
+
getBytesEncoder().encode(
|
|
653
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
654
|
+
)
|
|
655
|
+
]
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
if (!accounts.program.value) {
|
|
659
|
+
accounts.program.value = programAddress;
|
|
660
|
+
accounts.program.isWritable = false;
|
|
661
|
+
}
|
|
662
|
+
return Object.freeze({
|
|
663
|
+
accounts: [
|
|
664
|
+
getAccountMeta("funder", accounts.funder),
|
|
665
|
+
getAccountMeta("authority", accounts.authority),
|
|
666
|
+
getAccountMeta("config", accounts.config),
|
|
667
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
668
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
669
|
+
getAccountMeta("program", accounts.program)
|
|
670
|
+
],
|
|
671
|
+
data: getAddGuardianInstructionDataEncoder().encode(args),
|
|
672
|
+
programAddress
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function getAddGuardianInstruction(input, config) {
|
|
676
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
677
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
678
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
679
|
+
const originalAccounts = {
|
|
680
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
681
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
682
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
683
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
684
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
685
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
686
|
+
};
|
|
687
|
+
const accounts = originalAccounts;
|
|
688
|
+
const args = { ...input };
|
|
689
|
+
if (!accounts.systemProgram.value) {
|
|
690
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
691
|
+
}
|
|
692
|
+
if (!accounts.program.value) {
|
|
693
|
+
accounts.program.value = programAddress;
|
|
694
|
+
accounts.program.isWritable = false;
|
|
695
|
+
}
|
|
696
|
+
return Object.freeze({
|
|
697
|
+
accounts: [
|
|
698
|
+
getAccountMeta("funder", accounts.funder),
|
|
699
|
+
getAccountMeta("authority", accounts.authority),
|
|
700
|
+
getAccountMeta("config", accounts.config),
|
|
701
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
702
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
703
|
+
getAccountMeta("program", accounts.program)
|
|
704
|
+
],
|
|
705
|
+
data: getAddGuardianInstructionDataEncoder().encode(args),
|
|
706
|
+
programAddress
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
function parseAddGuardianInstruction(instruction) {
|
|
710
|
+
if (instruction.accounts.length < 6) {
|
|
711
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
712
|
+
actualAccountMetas: instruction.accounts.length,
|
|
713
|
+
expectedAccountMetas: 6
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
let accountIndex = 0;
|
|
717
|
+
const getNextAccount = () => {
|
|
718
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
719
|
+
accountIndex += 1;
|
|
720
|
+
return accountMeta;
|
|
721
|
+
};
|
|
722
|
+
return {
|
|
723
|
+
programAddress: instruction.programAddress,
|
|
724
|
+
accounts: {
|
|
725
|
+
funder: getNextAccount(),
|
|
726
|
+
authority: getNextAccount(),
|
|
727
|
+
config: getNextAccount(),
|
|
728
|
+
systemProgram: getNextAccount(),
|
|
729
|
+
eventAuthority: getNextAccount(),
|
|
730
|
+
program: getNextAccount()
|
|
731
|
+
},
|
|
732
|
+
data: getAddGuardianInstructionDataDecoder().decode(instruction.data)
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
var CANCEL_RELEASE_DISCRIMINATOR = new Uint8Array([109, 170, 172, 190, 125, 251, 1, 66]);
|
|
736
|
+
function getCancelReleaseDiscriminatorBytes() {
|
|
737
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CANCEL_RELEASE_DISCRIMINATOR);
|
|
738
|
+
}
|
|
739
|
+
function getCancelReleaseInstructionDataEncoder() {
|
|
740
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
741
|
+
...value,
|
|
742
|
+
discriminator: CANCEL_RELEASE_DISCRIMINATOR
|
|
743
|
+
}));
|
|
744
|
+
}
|
|
745
|
+
function getCancelReleaseInstructionDataDecoder() {
|
|
746
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
747
|
+
}
|
|
748
|
+
function getCancelReleaseInstructionDataCodec() {
|
|
749
|
+
return combineCodec(getCancelReleaseInstructionDataEncoder(), getCancelReleaseInstructionDataDecoder());
|
|
750
|
+
}
|
|
751
|
+
async function getCancelReleaseInstructionAsync(input, config) {
|
|
752
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
753
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
754
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
755
|
+
const originalAccounts = {
|
|
756
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
757
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
758
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
759
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
760
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
761
|
+
};
|
|
762
|
+
const accounts = originalAccounts;
|
|
763
|
+
if (!accounts.registry.value) {
|
|
764
|
+
accounts.registry.value = await getProgramDerivedAddress({
|
|
765
|
+
programAddress,
|
|
766
|
+
seeds: [
|
|
767
|
+
getBytesEncoder().encode(
|
|
768
|
+
new Uint8Array([80, 69, 78, 68, 73, 78, 71, 95, 82, 69, 71, 73, 83, 84, 82, 89])
|
|
769
|
+
)
|
|
770
|
+
]
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
if (!accounts.eventAuthority.value) {
|
|
774
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
775
|
+
programAddress,
|
|
776
|
+
seeds: [
|
|
777
|
+
getBytesEncoder().encode(
|
|
778
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
779
|
+
)
|
|
780
|
+
]
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
if (!accounts.program.value) {
|
|
784
|
+
accounts.program.value = programAddress;
|
|
785
|
+
accounts.program.isWritable = false;
|
|
786
|
+
}
|
|
787
|
+
return Object.freeze({
|
|
788
|
+
accounts: [
|
|
789
|
+
getAccountMeta("authority", accounts.authority),
|
|
790
|
+
getAccountMeta("app", accounts.app),
|
|
791
|
+
getAccountMeta("registry", accounts.registry),
|
|
792
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
793
|
+
getAccountMeta("program", accounts.program)
|
|
794
|
+
],
|
|
795
|
+
data: getCancelReleaseInstructionDataEncoder().encode({}),
|
|
796
|
+
programAddress
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
function getCancelReleaseInstruction(input, config) {
|
|
800
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
801
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
802
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
803
|
+
const originalAccounts = {
|
|
804
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
805
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
806
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
807
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
808
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
809
|
+
};
|
|
810
|
+
const accounts = originalAccounts;
|
|
811
|
+
if (!accounts.program.value) {
|
|
812
|
+
accounts.program.value = programAddress;
|
|
813
|
+
accounts.program.isWritable = false;
|
|
814
|
+
}
|
|
815
|
+
return Object.freeze({
|
|
816
|
+
accounts: [
|
|
817
|
+
getAccountMeta("authority", accounts.authority),
|
|
818
|
+
getAccountMeta("app", accounts.app),
|
|
819
|
+
getAccountMeta("registry", accounts.registry),
|
|
820
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
821
|
+
getAccountMeta("program", accounts.program)
|
|
822
|
+
],
|
|
823
|
+
data: getCancelReleaseInstructionDataEncoder().encode({}),
|
|
824
|
+
programAddress
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
function parseCancelReleaseInstruction(instruction) {
|
|
828
|
+
if (instruction.accounts.length < 5) {
|
|
829
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
830
|
+
actualAccountMetas: instruction.accounts.length,
|
|
831
|
+
expectedAccountMetas: 5
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
let accountIndex = 0;
|
|
835
|
+
const getNextAccount = () => {
|
|
836
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
837
|
+
accountIndex += 1;
|
|
838
|
+
return accountMeta;
|
|
839
|
+
};
|
|
840
|
+
return {
|
|
841
|
+
programAddress: instruction.programAddress,
|
|
842
|
+
accounts: {
|
|
843
|
+
authority: getNextAccount(),
|
|
844
|
+
app: getNextAccount(),
|
|
845
|
+
registry: getNextAccount(),
|
|
846
|
+
eventAuthority: getNextAccount(),
|
|
847
|
+
program: getNextAccount()
|
|
848
|
+
},
|
|
849
|
+
data: getCancelReleaseInstructionDataDecoder().decode(instruction.data)
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
var EXPIRE_RELEASE_DISCRIMINATOR = new Uint8Array([174, 239, 151, 37, 202, 177, 207, 99]);
|
|
853
|
+
function getExpireReleaseDiscriminatorBytes() {
|
|
854
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(EXPIRE_RELEASE_DISCRIMINATOR);
|
|
855
|
+
}
|
|
856
|
+
function getExpireReleaseInstructionDataEncoder() {
|
|
857
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
858
|
+
...value,
|
|
859
|
+
discriminator: EXPIRE_RELEASE_DISCRIMINATOR
|
|
860
|
+
}));
|
|
861
|
+
}
|
|
862
|
+
function getExpireReleaseInstructionDataDecoder() {
|
|
863
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
864
|
+
}
|
|
865
|
+
function getExpireReleaseInstructionDataCodec() {
|
|
866
|
+
return combineCodec(getExpireReleaseInstructionDataEncoder(), getExpireReleaseInstructionDataDecoder());
|
|
867
|
+
}
|
|
868
|
+
async function getExpireReleaseInstructionAsync(input, config) {
|
|
869
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
870
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
871
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
872
|
+
const originalAccounts = {
|
|
873
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
874
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
875
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
876
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
877
|
+
};
|
|
878
|
+
const accounts = originalAccounts;
|
|
879
|
+
if (!accounts.registry.value) {
|
|
880
|
+
accounts.registry.value = await getProgramDerivedAddress({
|
|
881
|
+
programAddress,
|
|
882
|
+
seeds: [
|
|
883
|
+
getBytesEncoder().encode(
|
|
884
|
+
new Uint8Array([80, 69, 78, 68, 73, 78, 71, 95, 82, 69, 71, 73, 83, 84, 82, 89])
|
|
885
|
+
)
|
|
886
|
+
]
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
if (!accounts.eventAuthority.value) {
|
|
890
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
891
|
+
programAddress,
|
|
892
|
+
seeds: [
|
|
893
|
+
getBytesEncoder().encode(
|
|
894
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
895
|
+
)
|
|
896
|
+
]
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
if (!accounts.program.value) {
|
|
900
|
+
accounts.program.value = programAddress;
|
|
901
|
+
accounts.program.isWritable = false;
|
|
902
|
+
}
|
|
903
|
+
return Object.freeze({
|
|
904
|
+
accounts: [
|
|
905
|
+
getAccountMeta("app", accounts.app),
|
|
906
|
+
getAccountMeta("registry", accounts.registry),
|
|
907
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
908
|
+
getAccountMeta("program", accounts.program)
|
|
909
|
+
],
|
|
910
|
+
data: getExpireReleaseInstructionDataEncoder().encode({}),
|
|
911
|
+
programAddress
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
function getExpireReleaseInstruction(input, config) {
|
|
915
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
916
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
917
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
918
|
+
const originalAccounts = {
|
|
919
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
920
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
921
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
922
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
923
|
+
};
|
|
924
|
+
const accounts = originalAccounts;
|
|
925
|
+
if (!accounts.program.value) {
|
|
926
|
+
accounts.program.value = programAddress;
|
|
927
|
+
accounts.program.isWritable = false;
|
|
928
|
+
}
|
|
929
|
+
return Object.freeze({
|
|
930
|
+
accounts: [
|
|
931
|
+
getAccountMeta("app", accounts.app),
|
|
932
|
+
getAccountMeta("registry", accounts.registry),
|
|
933
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
934
|
+
getAccountMeta("program", accounts.program)
|
|
935
|
+
],
|
|
936
|
+
data: getExpireReleaseInstructionDataEncoder().encode({}),
|
|
937
|
+
programAddress
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
function parseExpireReleaseInstruction(instruction) {
|
|
941
|
+
if (instruction.accounts.length < 4) {
|
|
942
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
943
|
+
actualAccountMetas: instruction.accounts.length,
|
|
944
|
+
expectedAccountMetas: 4
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
let accountIndex = 0;
|
|
948
|
+
const getNextAccount = () => {
|
|
949
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
950
|
+
accountIndex += 1;
|
|
951
|
+
return accountMeta;
|
|
952
|
+
};
|
|
953
|
+
return {
|
|
954
|
+
programAddress: instruction.programAddress,
|
|
955
|
+
accounts: {
|
|
956
|
+
app: getNextAccount(),
|
|
957
|
+
registry: getNextAccount(),
|
|
958
|
+
eventAuthority: getNextAccount(),
|
|
959
|
+
program: getNextAccount()
|
|
960
|
+
},
|
|
961
|
+
data: getExpireReleaseInstructionDataDecoder().decode(instruction.data)
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
var INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70]);
|
|
965
|
+
function getInitializeConfigDiscriminatorBytes() {
|
|
966
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(INITIALIZE_CONFIG_DISCRIMINATOR);
|
|
967
|
+
}
|
|
968
|
+
function getInitializeConfigInstructionDataEncoder() {
|
|
969
|
+
return transformEncoder(
|
|
970
|
+
getStructEncoder([
|
|
971
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
972
|
+
["authority", getAddressEncoder()],
|
|
973
|
+
["voteWindow", getU32Encoder()],
|
|
974
|
+
["votingPeriod", getU32Encoder()]
|
|
975
|
+
]),
|
|
976
|
+
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
function getInitializeConfigInstructionDataDecoder() {
|
|
980
|
+
return getStructDecoder([
|
|
981
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
982
|
+
["authority", getAddressDecoder()],
|
|
983
|
+
["voteWindow", getU32Decoder()],
|
|
984
|
+
["votingPeriod", getU32Decoder()]
|
|
985
|
+
]);
|
|
986
|
+
}
|
|
987
|
+
function getInitializeConfigInstructionDataCodec() {
|
|
988
|
+
return combineCodec(getInitializeConfigInstructionDataEncoder(), getInitializeConfigInstructionDataDecoder());
|
|
989
|
+
}
|
|
990
|
+
async function getInitializeConfigInstructionAsync(input, config) {
|
|
991
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
992
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
993
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
994
|
+
const originalAccounts = {
|
|
995
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
996
|
+
setupAuthority: { value: input.setupAuthority ?? null, isSigner: "either", isWritable: false },
|
|
997
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
998
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
999
|
+
bondMint: { value: input.bondMint ?? null, isSigner: false, isWritable: false },
|
|
1000
|
+
bondVault: { value: input.bondVault ?? null, isSigner: false, isWritable: true },
|
|
1001
|
+
tokenProgram: { value: input.tokenProgram ?? null, isSigner: false, isWritable: false },
|
|
1002
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1003
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1004
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1005
|
+
};
|
|
1006
|
+
const accounts = originalAccounts;
|
|
1007
|
+
const args = { ...input };
|
|
1008
|
+
if (!accounts.setupAuthority.value) {
|
|
1009
|
+
accounts.setupAuthority.value = "setup9dEwHLaDMvUwEsigW9nkXYHVenLMPzToyx3cpj";
|
|
1010
|
+
}
|
|
1011
|
+
if (!accounts.config.value) {
|
|
1012
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
1013
|
+
programAddress,
|
|
1014
|
+
seeds: [
|
|
1015
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
1016
|
+
]
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
if (!accounts.registry.value) {
|
|
1020
|
+
accounts.registry.value = await getProgramDerivedAddress({
|
|
1021
|
+
programAddress,
|
|
1022
|
+
seeds: [
|
|
1023
|
+
getBytesEncoder().encode(
|
|
1024
|
+
new Uint8Array([80, 69, 78, 68, 73, 78, 71, 95, 82, 69, 71, 73, 83, 84, 82, 89])
|
|
1025
|
+
)
|
|
1026
|
+
]
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
if (!accounts.bondVault.value) {
|
|
1030
|
+
accounts.bondVault.value = await getProgramDerivedAddress({
|
|
1031
|
+
programAddress,
|
|
1032
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([66, 79, 78, 68, 95, 86, 65, 85, 76, 84]))]
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
if (!accounts.tokenProgram.value) {
|
|
1036
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1037
|
+
}
|
|
1038
|
+
if (!accounts.systemProgram.value) {
|
|
1039
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1040
|
+
}
|
|
1041
|
+
if (!accounts.eventAuthority.value) {
|
|
1042
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1043
|
+
programAddress,
|
|
1044
|
+
seeds: [
|
|
1045
|
+
getBytesEncoder().encode(
|
|
1046
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1047
|
+
)
|
|
1048
|
+
]
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
if (!accounts.program.value) {
|
|
1052
|
+
accounts.program.value = programAddress;
|
|
1053
|
+
accounts.program.isWritable = false;
|
|
1054
|
+
}
|
|
1055
|
+
return Object.freeze({
|
|
1056
|
+
accounts: [
|
|
1057
|
+
getAccountMeta("funder", accounts.funder),
|
|
1058
|
+
getAccountMeta("setupAuthority", accounts.setupAuthority),
|
|
1059
|
+
getAccountMeta("config", accounts.config),
|
|
1060
|
+
getAccountMeta("registry", accounts.registry),
|
|
1061
|
+
getAccountMeta("bondMint", accounts.bondMint),
|
|
1062
|
+
getAccountMeta("bondVault", accounts.bondVault),
|
|
1063
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1064
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1065
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1066
|
+
getAccountMeta("program", accounts.program)
|
|
1067
|
+
],
|
|
1068
|
+
data: getInitializeConfigInstructionDataEncoder().encode(args),
|
|
1069
|
+
programAddress
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
function getInitializeConfigInstruction(input, config) {
|
|
1073
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1074
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1075
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1076
|
+
const originalAccounts = {
|
|
1077
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1078
|
+
setupAuthority: { value: input.setupAuthority ?? null, isSigner: "either", isWritable: false },
|
|
1079
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1080
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
1081
|
+
bondMint: { value: input.bondMint ?? null, isSigner: false, isWritable: false },
|
|
1082
|
+
bondVault: { value: input.bondVault ?? null, isSigner: false, isWritable: true },
|
|
1083
|
+
tokenProgram: { value: input.tokenProgram ?? null, isSigner: false, isWritable: false },
|
|
1084
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1085
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1086
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1087
|
+
};
|
|
1088
|
+
const accounts = originalAccounts;
|
|
1089
|
+
const args = { ...input };
|
|
1090
|
+
if (!accounts.setupAuthority.value) {
|
|
1091
|
+
accounts.setupAuthority.value = "setup9dEwHLaDMvUwEsigW9nkXYHVenLMPzToyx3cpj";
|
|
1092
|
+
}
|
|
1093
|
+
if (!accounts.tokenProgram.value) {
|
|
1094
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1095
|
+
}
|
|
1096
|
+
if (!accounts.systemProgram.value) {
|
|
1097
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1098
|
+
}
|
|
1099
|
+
if (!accounts.program.value) {
|
|
1100
|
+
accounts.program.value = programAddress;
|
|
1101
|
+
accounts.program.isWritable = false;
|
|
1102
|
+
}
|
|
1103
|
+
return Object.freeze({
|
|
1104
|
+
accounts: [
|
|
1105
|
+
getAccountMeta("funder", accounts.funder),
|
|
1106
|
+
getAccountMeta("setupAuthority", accounts.setupAuthority),
|
|
1107
|
+
getAccountMeta("config", accounts.config),
|
|
1108
|
+
getAccountMeta("registry", accounts.registry),
|
|
1109
|
+
getAccountMeta("bondMint", accounts.bondMint),
|
|
1110
|
+
getAccountMeta("bondVault", accounts.bondVault),
|
|
1111
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1112
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1113
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1114
|
+
getAccountMeta("program", accounts.program)
|
|
1115
|
+
],
|
|
1116
|
+
data: getInitializeConfigInstructionDataEncoder().encode(args),
|
|
1117
|
+
programAddress
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
function parseInitializeConfigInstruction(instruction) {
|
|
1121
|
+
if (instruction.accounts.length < 10) {
|
|
1122
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1123
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1124
|
+
expectedAccountMetas: 10
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
let accountIndex = 0;
|
|
1128
|
+
const getNextAccount = () => {
|
|
1129
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1130
|
+
accountIndex += 1;
|
|
1131
|
+
return accountMeta;
|
|
1132
|
+
};
|
|
1133
|
+
return {
|
|
1134
|
+
programAddress: instruction.programAddress,
|
|
1135
|
+
accounts: {
|
|
1136
|
+
funder: getNextAccount(),
|
|
1137
|
+
setupAuthority: getNextAccount(),
|
|
1138
|
+
config: getNextAccount(),
|
|
1139
|
+
registry: getNextAccount(),
|
|
1140
|
+
bondMint: getNextAccount(),
|
|
1141
|
+
bondVault: getNextAccount(),
|
|
1142
|
+
tokenProgram: getNextAccount(),
|
|
1143
|
+
systemProgram: getNextAccount(),
|
|
1144
|
+
eventAuthority: getNextAccount(),
|
|
1145
|
+
program: getNextAccount()
|
|
1146
|
+
},
|
|
1147
|
+
data: getInitializeConfigInstructionDataDecoder().decode(instruction.data)
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
var PROPOSE_APP_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
1151
|
+
147,
|
|
1152
|
+
62,
|
|
1153
|
+
16,
|
|
1154
|
+
95,
|
|
1155
|
+
39,
|
|
1156
|
+
187,
|
|
1157
|
+
25,
|
|
1158
|
+
15
|
|
1159
|
+
]);
|
|
1160
|
+
function getProposeAppAuthorityDiscriminatorBytes() {
|
|
1161
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(PROPOSE_APP_AUTHORITY_DISCRIMINATOR);
|
|
1162
|
+
}
|
|
1163
|
+
function getProposeAppAuthorityInstructionDataEncoder() {
|
|
1164
|
+
return transformEncoder(
|
|
1165
|
+
getStructEncoder([
|
|
1166
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1167
|
+
["newAuthority", getAddressEncoder()]
|
|
1168
|
+
]),
|
|
1169
|
+
(value) => ({ ...value, discriminator: PROPOSE_APP_AUTHORITY_DISCRIMINATOR })
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
function getProposeAppAuthorityInstructionDataDecoder() {
|
|
1173
|
+
return getStructDecoder([
|
|
1174
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1175
|
+
["newAuthority", getAddressDecoder()]
|
|
1176
|
+
]);
|
|
1177
|
+
}
|
|
1178
|
+
function getProposeAppAuthorityInstructionDataCodec() {
|
|
1179
|
+
return combineCodec(getProposeAppAuthorityInstructionDataEncoder(), getProposeAppAuthorityInstructionDataDecoder());
|
|
1180
|
+
}
|
|
1181
|
+
async function getProposeAppAuthorityInstructionAsync(input, config) {
|
|
1182
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1183
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1184
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1185
|
+
const originalAccounts = {
|
|
1186
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1187
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
1188
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1189
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1190
|
+
};
|
|
1191
|
+
const accounts = originalAccounts;
|
|
1192
|
+
const args = { ...input };
|
|
1193
|
+
if (!accounts.eventAuthority.value) {
|
|
1194
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1195
|
+
programAddress,
|
|
1196
|
+
seeds: [
|
|
1197
|
+
getBytesEncoder().encode(
|
|
1198
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1199
|
+
)
|
|
1200
|
+
]
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
if (!accounts.program.value) {
|
|
1204
|
+
accounts.program.value = programAddress;
|
|
1205
|
+
accounts.program.isWritable = false;
|
|
1206
|
+
}
|
|
1207
|
+
return Object.freeze({
|
|
1208
|
+
accounts: [
|
|
1209
|
+
getAccountMeta("authority", accounts.authority),
|
|
1210
|
+
getAccountMeta("app", accounts.app),
|
|
1211
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1212
|
+
getAccountMeta("program", accounts.program)
|
|
1213
|
+
],
|
|
1214
|
+
data: getProposeAppAuthorityInstructionDataEncoder().encode(args),
|
|
1215
|
+
programAddress
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
function getProposeAppAuthorityInstruction(input, config) {
|
|
1219
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1220
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1221
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1222
|
+
const originalAccounts = {
|
|
1223
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1224
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
1225
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1226
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1227
|
+
};
|
|
1228
|
+
const accounts = originalAccounts;
|
|
1229
|
+
const args = { ...input };
|
|
1230
|
+
if (!accounts.program.value) {
|
|
1231
|
+
accounts.program.value = programAddress;
|
|
1232
|
+
accounts.program.isWritable = false;
|
|
1233
|
+
}
|
|
1234
|
+
return Object.freeze({
|
|
1235
|
+
accounts: [
|
|
1236
|
+
getAccountMeta("authority", accounts.authority),
|
|
1237
|
+
getAccountMeta("app", accounts.app),
|
|
1238
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1239
|
+
getAccountMeta("program", accounts.program)
|
|
1240
|
+
],
|
|
1241
|
+
data: getProposeAppAuthorityInstructionDataEncoder().encode(args),
|
|
1242
|
+
programAddress
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
function parseProposeAppAuthorityInstruction(instruction) {
|
|
1246
|
+
if (instruction.accounts.length < 4) {
|
|
1247
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1248
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1249
|
+
expectedAccountMetas: 4
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
let accountIndex = 0;
|
|
1253
|
+
const getNextAccount = () => {
|
|
1254
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1255
|
+
accountIndex += 1;
|
|
1256
|
+
return accountMeta;
|
|
1257
|
+
};
|
|
1258
|
+
return {
|
|
1259
|
+
programAddress: instruction.programAddress,
|
|
1260
|
+
accounts: {
|
|
1261
|
+
authority: getNextAccount(),
|
|
1262
|
+
app: getNextAccount(),
|
|
1263
|
+
eventAuthority: getNextAccount(),
|
|
1264
|
+
program: getNextAccount()
|
|
1265
|
+
},
|
|
1266
|
+
data: getProposeAppAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
var PROPOSE_CONFIG_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
1270
|
+
31,
|
|
1271
|
+
229,
|
|
1272
|
+
9,
|
|
1273
|
+
231,
|
|
1274
|
+
45,
|
|
1275
|
+
153,
|
|
1276
|
+
123,
|
|
1277
|
+
235
|
|
1278
|
+
]);
|
|
1279
|
+
function getProposeConfigAuthorityDiscriminatorBytes() {
|
|
1280
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(PROPOSE_CONFIG_AUTHORITY_DISCRIMINATOR);
|
|
1281
|
+
}
|
|
1282
|
+
function getProposeConfigAuthorityInstructionDataEncoder() {
|
|
1283
|
+
return transformEncoder(
|
|
1284
|
+
getStructEncoder([
|
|
1285
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1286
|
+
["newAuthority", getAddressEncoder()]
|
|
1287
|
+
]),
|
|
1288
|
+
(value) => ({ ...value, discriminator: PROPOSE_CONFIG_AUTHORITY_DISCRIMINATOR })
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
function getProposeConfigAuthorityInstructionDataDecoder() {
|
|
1292
|
+
return getStructDecoder([
|
|
1293
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1294
|
+
["newAuthority", getAddressDecoder()]
|
|
1295
|
+
]);
|
|
1296
|
+
}
|
|
1297
|
+
function getProposeConfigAuthorityInstructionDataCodec() {
|
|
1298
|
+
return combineCodec(
|
|
1299
|
+
getProposeConfigAuthorityInstructionDataEncoder(),
|
|
1300
|
+
getProposeConfigAuthorityInstructionDataDecoder()
|
|
1301
|
+
);
|
|
1302
|
+
}
|
|
1303
|
+
async function getProposeConfigAuthorityInstructionAsync(input, config) {
|
|
1304
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1305
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1306
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1307
|
+
const originalAccounts = {
|
|
1308
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1309
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1310
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1311
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1312
|
+
};
|
|
1313
|
+
const accounts = originalAccounts;
|
|
1314
|
+
const args = { ...input };
|
|
1315
|
+
if (!accounts.config.value) {
|
|
1316
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
1317
|
+
programAddress,
|
|
1318
|
+
seeds: [
|
|
1319
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
1320
|
+
]
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
if (!accounts.eventAuthority.value) {
|
|
1324
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1325
|
+
programAddress,
|
|
1326
|
+
seeds: [
|
|
1327
|
+
getBytesEncoder().encode(
|
|
1328
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1329
|
+
)
|
|
1330
|
+
]
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
if (!accounts.program.value) {
|
|
1334
|
+
accounts.program.value = programAddress;
|
|
1335
|
+
accounts.program.isWritable = false;
|
|
1336
|
+
}
|
|
1337
|
+
return Object.freeze({
|
|
1338
|
+
accounts: [
|
|
1339
|
+
getAccountMeta("authority", accounts.authority),
|
|
1340
|
+
getAccountMeta("config", accounts.config),
|
|
1341
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1342
|
+
getAccountMeta("program", accounts.program)
|
|
1343
|
+
],
|
|
1344
|
+
data: getProposeConfigAuthorityInstructionDataEncoder().encode(
|
|
1345
|
+
args
|
|
1346
|
+
),
|
|
1347
|
+
programAddress
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
function getProposeConfigAuthorityInstruction(input, config) {
|
|
1351
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1352
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1353
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1354
|
+
const originalAccounts = {
|
|
1355
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1356
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1357
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1358
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1359
|
+
};
|
|
1360
|
+
const accounts = originalAccounts;
|
|
1361
|
+
const args = { ...input };
|
|
1362
|
+
if (!accounts.program.value) {
|
|
1363
|
+
accounts.program.value = programAddress;
|
|
1364
|
+
accounts.program.isWritable = false;
|
|
1365
|
+
}
|
|
1366
|
+
return Object.freeze({
|
|
1367
|
+
accounts: [
|
|
1368
|
+
getAccountMeta("authority", accounts.authority),
|
|
1369
|
+
getAccountMeta("config", accounts.config),
|
|
1370
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1371
|
+
getAccountMeta("program", accounts.program)
|
|
1372
|
+
],
|
|
1373
|
+
data: getProposeConfigAuthorityInstructionDataEncoder().encode(
|
|
1374
|
+
args
|
|
1375
|
+
),
|
|
1376
|
+
programAddress
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
function parseProposeConfigAuthorityInstruction(instruction) {
|
|
1380
|
+
if (instruction.accounts.length < 4) {
|
|
1381
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1382
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1383
|
+
expectedAccountMetas: 4
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
let accountIndex = 0;
|
|
1387
|
+
const getNextAccount = () => {
|
|
1388
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1389
|
+
accountIndex += 1;
|
|
1390
|
+
return accountMeta;
|
|
1391
|
+
};
|
|
1392
|
+
return {
|
|
1393
|
+
programAddress: instruction.programAddress,
|
|
1394
|
+
accounts: {
|
|
1395
|
+
authority: getNextAccount(),
|
|
1396
|
+
config: getNextAccount(),
|
|
1397
|
+
eventAuthority: getNextAccount(),
|
|
1398
|
+
program: getNextAccount()
|
|
1399
|
+
},
|
|
1400
|
+
data: getProposeConfigAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
var PROPOSE_RELEASE_DISCRIMINATOR = new Uint8Array([156, 43, 186, 24, 116, 44, 17, 71]);
|
|
1404
|
+
function getProposeReleaseDiscriminatorBytes() {
|
|
1405
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(PROPOSE_RELEASE_DISCRIMINATOR);
|
|
1406
|
+
}
|
|
1407
|
+
function getProposeReleaseInstructionDataEncoder() {
|
|
1408
|
+
return transformEncoder(
|
|
1409
|
+
getStructEncoder([
|
|
1410
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1411
|
+
["versionCode", getU32Encoder()],
|
|
1412
|
+
["manifestHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
1413
|
+
["certificateSha256", fixEncoderSize(getBytesEncoder(), 32)]
|
|
1414
|
+
]),
|
|
1415
|
+
(value) => ({ ...value, discriminator: PROPOSE_RELEASE_DISCRIMINATOR })
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1418
|
+
function getProposeReleaseInstructionDataDecoder() {
|
|
1419
|
+
return getStructDecoder([
|
|
1420
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1421
|
+
["versionCode", getU32Decoder()],
|
|
1422
|
+
["manifestHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
1423
|
+
["certificateSha256", fixDecoderSize(getBytesDecoder(), 32)]
|
|
1424
|
+
]);
|
|
1425
|
+
}
|
|
1426
|
+
function getProposeReleaseInstructionDataCodec() {
|
|
1427
|
+
return combineCodec(getProposeReleaseInstructionDataEncoder(), getProposeReleaseInstructionDataDecoder());
|
|
1428
|
+
}
|
|
1429
|
+
async function getProposeReleaseInstructionAsync(input, config) {
|
|
1430
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1431
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1432
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1433
|
+
const originalAccounts = {
|
|
1434
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1435
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1436
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
1437
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
1438
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
1439
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1440
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1441
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1442
|
+
};
|
|
1443
|
+
const accounts = originalAccounts;
|
|
1444
|
+
const args = { ...input };
|
|
1445
|
+
if (!accounts.config.value) {
|
|
1446
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
1447
|
+
programAddress,
|
|
1448
|
+
seeds: [
|
|
1449
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
1450
|
+
]
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
if (!accounts.registry.value) {
|
|
1454
|
+
accounts.registry.value = await getProgramDerivedAddress({
|
|
1455
|
+
programAddress,
|
|
1456
|
+
seeds: [
|
|
1457
|
+
getBytesEncoder().encode(
|
|
1458
|
+
new Uint8Array([80, 69, 78, 68, 73, 78, 71, 95, 82, 69, 71, 73, 83, 84, 82, 89])
|
|
1459
|
+
)
|
|
1460
|
+
]
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
if (!accounts.systemProgram.value) {
|
|
1464
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1465
|
+
}
|
|
1466
|
+
if (!accounts.eventAuthority.value) {
|
|
1467
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1468
|
+
programAddress,
|
|
1469
|
+
seeds: [
|
|
1470
|
+
getBytesEncoder().encode(
|
|
1471
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1472
|
+
)
|
|
1473
|
+
]
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
if (!accounts.program.value) {
|
|
1477
|
+
accounts.program.value = programAddress;
|
|
1478
|
+
accounts.program.isWritable = false;
|
|
1479
|
+
}
|
|
1480
|
+
return Object.freeze({
|
|
1481
|
+
accounts: [
|
|
1482
|
+
getAccountMeta("funder", accounts.funder),
|
|
1483
|
+
getAccountMeta("authority", accounts.authority),
|
|
1484
|
+
getAccountMeta("app", accounts.app),
|
|
1485
|
+
getAccountMeta("config", accounts.config),
|
|
1486
|
+
getAccountMeta("registry", accounts.registry),
|
|
1487
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1488
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1489
|
+
getAccountMeta("program", accounts.program)
|
|
1490
|
+
],
|
|
1491
|
+
data: getProposeReleaseInstructionDataEncoder().encode(args),
|
|
1492
|
+
programAddress
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
function getProposeReleaseInstruction(input, config) {
|
|
1496
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1497
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1498
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1499
|
+
const originalAccounts = {
|
|
1500
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1501
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1502
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
1503
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
1504
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
1505
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1506
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1507
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1508
|
+
};
|
|
1509
|
+
const accounts = originalAccounts;
|
|
1510
|
+
const args = { ...input };
|
|
1511
|
+
if (!accounts.systemProgram.value) {
|
|
1512
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1513
|
+
}
|
|
1514
|
+
if (!accounts.program.value) {
|
|
1515
|
+
accounts.program.value = programAddress;
|
|
1516
|
+
accounts.program.isWritable = false;
|
|
1517
|
+
}
|
|
1518
|
+
return Object.freeze({
|
|
1519
|
+
accounts: [
|
|
1520
|
+
getAccountMeta("funder", accounts.funder),
|
|
1521
|
+
getAccountMeta("authority", accounts.authority),
|
|
1522
|
+
getAccountMeta("app", accounts.app),
|
|
1523
|
+
getAccountMeta("config", accounts.config),
|
|
1524
|
+
getAccountMeta("registry", accounts.registry),
|
|
1525
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1526
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1527
|
+
getAccountMeta("program", accounts.program)
|
|
1528
|
+
],
|
|
1529
|
+
data: getProposeReleaseInstructionDataEncoder().encode(args),
|
|
1530
|
+
programAddress
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
function parseProposeReleaseInstruction(instruction) {
|
|
1534
|
+
if (instruction.accounts.length < 8) {
|
|
1535
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1536
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1537
|
+
expectedAccountMetas: 8
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
let accountIndex = 0;
|
|
1541
|
+
const getNextAccount = () => {
|
|
1542
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1543
|
+
accountIndex += 1;
|
|
1544
|
+
return accountMeta;
|
|
1545
|
+
};
|
|
1546
|
+
return {
|
|
1547
|
+
programAddress: instruction.programAddress,
|
|
1548
|
+
accounts: {
|
|
1549
|
+
funder: getNextAccount(),
|
|
1550
|
+
authority: getNextAccount(),
|
|
1551
|
+
app: getNextAccount(),
|
|
1552
|
+
config: getNextAccount(),
|
|
1553
|
+
registry: getNextAccount(),
|
|
1554
|
+
systemProgram: getNextAccount(),
|
|
1555
|
+
eventAuthority: getNextAccount(),
|
|
1556
|
+
program: getNextAccount()
|
|
1557
|
+
},
|
|
1558
|
+
data: getProposeReleaseInstructionDataDecoder().decode(instruction.data)
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
var REGISTER_APP_DISCRIMINATOR = new Uint8Array([5, 248, 20, 126, 12, 159, 9, 242]);
|
|
1562
|
+
function getRegisterAppDiscriminatorBytes() {
|
|
1563
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(REGISTER_APP_DISCRIMINATOR);
|
|
1564
|
+
}
|
|
1565
|
+
function getRegisterAppInstructionDataEncoder() {
|
|
1566
|
+
return transformEncoder(
|
|
1567
|
+
getStructEncoder([
|
|
1568
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1569
|
+
["authority", getAddressEncoder()],
|
|
1570
|
+
["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
1571
|
+
]),
|
|
1572
|
+
(value) => ({ ...value, discriminator: REGISTER_APP_DISCRIMINATOR })
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
function getRegisterAppInstructionDataDecoder() {
|
|
1576
|
+
return getStructDecoder([
|
|
1577
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1578
|
+
["authority", getAddressDecoder()],
|
|
1579
|
+
["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())]
|
|
1580
|
+
]);
|
|
1581
|
+
}
|
|
1582
|
+
function getRegisterAppInstructionDataCodec() {
|
|
1583
|
+
return combineCodec(getRegisterAppInstructionDataEncoder(), getRegisterAppInstructionDataDecoder());
|
|
1584
|
+
}
|
|
1585
|
+
async function getRegisterAppInstructionAsync(input, config) {
|
|
1586
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1587
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1588
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1589
|
+
const originalAccounts = {
|
|
1590
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1591
|
+
app: { value: input.app ?? null, isSigner: true, isWritable: true },
|
|
1592
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1593
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1594
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1595
|
+
};
|
|
1596
|
+
const accounts = originalAccounts;
|
|
1597
|
+
const args = { ...input };
|
|
1598
|
+
if (!accounts.systemProgram.value) {
|
|
1599
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1600
|
+
}
|
|
1601
|
+
if (!accounts.eventAuthority.value) {
|
|
1602
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1603
|
+
programAddress,
|
|
1604
|
+
seeds: [
|
|
1605
|
+
getBytesEncoder().encode(
|
|
1606
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1607
|
+
)
|
|
1608
|
+
]
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
if (!accounts.program.value) {
|
|
1612
|
+
accounts.program.value = programAddress;
|
|
1613
|
+
accounts.program.isWritable = false;
|
|
1614
|
+
}
|
|
1615
|
+
return Object.freeze({
|
|
1616
|
+
accounts: [
|
|
1617
|
+
getAccountMeta("funder", accounts.funder),
|
|
1618
|
+
getAccountMeta("app", accounts.app),
|
|
1619
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1620
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1621
|
+
getAccountMeta("program", accounts.program)
|
|
1622
|
+
],
|
|
1623
|
+
data: getRegisterAppInstructionDataEncoder().encode(args),
|
|
1624
|
+
programAddress
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
function getRegisterAppInstruction(input, config) {
|
|
1628
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1629
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1630
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1631
|
+
const originalAccounts = {
|
|
1632
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1633
|
+
app: { value: input.app ?? null, isSigner: true, isWritable: true },
|
|
1634
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1635
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1636
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1637
|
+
};
|
|
1638
|
+
const accounts = originalAccounts;
|
|
1639
|
+
const args = { ...input };
|
|
1640
|
+
if (!accounts.systemProgram.value) {
|
|
1641
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1642
|
+
}
|
|
1643
|
+
if (!accounts.program.value) {
|
|
1644
|
+
accounts.program.value = programAddress;
|
|
1645
|
+
accounts.program.isWritable = false;
|
|
1646
|
+
}
|
|
1647
|
+
return Object.freeze({
|
|
1648
|
+
accounts: [
|
|
1649
|
+
getAccountMeta("funder", accounts.funder),
|
|
1650
|
+
getAccountMeta("app", accounts.app),
|
|
1651
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1652
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1653
|
+
getAccountMeta("program", accounts.program)
|
|
1654
|
+
],
|
|
1655
|
+
data: getRegisterAppInstructionDataEncoder().encode(args),
|
|
1656
|
+
programAddress
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
function parseRegisterAppInstruction(instruction) {
|
|
1660
|
+
if (instruction.accounts.length < 5) {
|
|
1661
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1662
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1663
|
+
expectedAccountMetas: 5
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
let accountIndex = 0;
|
|
1667
|
+
const getNextAccount = () => {
|
|
1668
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1669
|
+
accountIndex += 1;
|
|
1670
|
+
return accountMeta;
|
|
1671
|
+
};
|
|
1672
|
+
return {
|
|
1673
|
+
programAddress: instruction.programAddress,
|
|
1674
|
+
accounts: {
|
|
1675
|
+
funder: getNextAccount(),
|
|
1676
|
+
app: getNextAccount(),
|
|
1677
|
+
systemProgram: getNextAccount(),
|
|
1678
|
+
eventAuthority: getNextAccount(),
|
|
1679
|
+
program: getNextAccount()
|
|
1680
|
+
},
|
|
1681
|
+
data: getRegisterAppInstructionDataDecoder().decode(instruction.data)
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
var REGISTER_GUARDIAN_DISCRIMINATOR = new Uint8Array([
|
|
1685
|
+
21,
|
|
1686
|
+
206,
|
|
1687
|
+
243,
|
|
1688
|
+
116,
|
|
1689
|
+
97,
|
|
1690
|
+
100,
|
|
1691
|
+
230,
|
|
1692
|
+
59
|
|
1693
|
+
]);
|
|
1694
|
+
function getRegisterGuardianDiscriminatorBytes() {
|
|
1695
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(REGISTER_GUARDIAN_DISCRIMINATOR);
|
|
1696
|
+
}
|
|
1697
|
+
function getRegisterGuardianInstructionDataEncoder() {
|
|
1698
|
+
return transformEncoder(
|
|
1699
|
+
getStructEncoder([
|
|
1700
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1701
|
+
["voteAuthority", getAddressEncoder()]
|
|
1702
|
+
]),
|
|
1703
|
+
(value) => ({ ...value, discriminator: REGISTER_GUARDIAN_DISCRIMINATOR })
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
function getRegisterGuardianInstructionDataDecoder() {
|
|
1707
|
+
return getStructDecoder([
|
|
1708
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1709
|
+
["voteAuthority", getAddressDecoder()]
|
|
1710
|
+
]);
|
|
1711
|
+
}
|
|
1712
|
+
function getRegisterGuardianInstructionDataCodec() {
|
|
1713
|
+
return combineCodec(getRegisterGuardianInstructionDataEncoder(), getRegisterGuardianInstructionDataDecoder());
|
|
1714
|
+
}
|
|
1715
|
+
async function getRegisterGuardianInstructionAsync(input, config) {
|
|
1716
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1717
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1718
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1719
|
+
const originalAccounts = {
|
|
1720
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1721
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1722
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1723
|
+
bondSource: { value: input.bondSource ?? null, isSigner: false, isWritable: true },
|
|
1724
|
+
bondVault: { value: input.bondVault ?? null, isSigner: false, isWritable: true },
|
|
1725
|
+
tokenProgram: { value: input.tokenProgram ?? null, isSigner: false, isWritable: false },
|
|
1726
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1727
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1728
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1729
|
+
};
|
|
1730
|
+
const accounts = originalAccounts;
|
|
1731
|
+
const args = { ...input };
|
|
1732
|
+
if (!accounts.config.value) {
|
|
1733
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
1734
|
+
programAddress,
|
|
1735
|
+
seeds: [
|
|
1736
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
1737
|
+
]
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
if (!accounts.bondVault.value) {
|
|
1741
|
+
accounts.bondVault.value = await getProgramDerivedAddress({
|
|
1742
|
+
programAddress,
|
|
1743
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([66, 79, 78, 68, 95, 86, 65, 85, 76, 84]))]
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
if (!accounts.tokenProgram.value) {
|
|
1747
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1748
|
+
}
|
|
1749
|
+
if (!accounts.systemProgram.value) {
|
|
1750
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1751
|
+
}
|
|
1752
|
+
if (!accounts.eventAuthority.value) {
|
|
1753
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1754
|
+
programAddress,
|
|
1755
|
+
seeds: [
|
|
1756
|
+
getBytesEncoder().encode(
|
|
1757
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1758
|
+
)
|
|
1759
|
+
]
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
if (!accounts.program.value) {
|
|
1763
|
+
accounts.program.value = programAddress;
|
|
1764
|
+
accounts.program.isWritable = false;
|
|
1765
|
+
}
|
|
1766
|
+
return Object.freeze({
|
|
1767
|
+
accounts: [
|
|
1768
|
+
getAccountMeta("funder", accounts.funder),
|
|
1769
|
+
getAccountMeta("authority", accounts.authority),
|
|
1770
|
+
getAccountMeta("config", accounts.config),
|
|
1771
|
+
getAccountMeta("bondSource", accounts.bondSource),
|
|
1772
|
+
getAccountMeta("bondVault", accounts.bondVault),
|
|
1773
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1774
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1775
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1776
|
+
getAccountMeta("program", accounts.program)
|
|
1777
|
+
],
|
|
1778
|
+
data: getRegisterGuardianInstructionDataEncoder().encode(args),
|
|
1779
|
+
programAddress
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
function getRegisterGuardianInstruction(input, config) {
|
|
1783
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1784
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1785
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1786
|
+
const originalAccounts = {
|
|
1787
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1788
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1789
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1790
|
+
bondSource: { value: input.bondSource ?? null, isSigner: false, isWritable: true },
|
|
1791
|
+
bondVault: { value: input.bondVault ?? null, isSigner: false, isWritable: true },
|
|
1792
|
+
tokenProgram: { value: input.tokenProgram ?? null, isSigner: false, isWritable: false },
|
|
1793
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1794
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1795
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1796
|
+
};
|
|
1797
|
+
const accounts = originalAccounts;
|
|
1798
|
+
const args = { ...input };
|
|
1799
|
+
if (!accounts.tokenProgram.value) {
|
|
1800
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1801
|
+
}
|
|
1802
|
+
if (!accounts.systemProgram.value) {
|
|
1803
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1804
|
+
}
|
|
1805
|
+
if (!accounts.program.value) {
|
|
1806
|
+
accounts.program.value = programAddress;
|
|
1807
|
+
accounts.program.isWritable = false;
|
|
1808
|
+
}
|
|
1809
|
+
return Object.freeze({
|
|
1810
|
+
accounts: [
|
|
1811
|
+
getAccountMeta("funder", accounts.funder),
|
|
1812
|
+
getAccountMeta("authority", accounts.authority),
|
|
1813
|
+
getAccountMeta("config", accounts.config),
|
|
1814
|
+
getAccountMeta("bondSource", accounts.bondSource),
|
|
1815
|
+
getAccountMeta("bondVault", accounts.bondVault),
|
|
1816
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1817
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1818
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1819
|
+
getAccountMeta("program", accounts.program)
|
|
1820
|
+
],
|
|
1821
|
+
data: getRegisterGuardianInstructionDataEncoder().encode(args),
|
|
1822
|
+
programAddress
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
function parseRegisterGuardianInstruction(instruction) {
|
|
1826
|
+
if (instruction.accounts.length < 9) {
|
|
1827
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1828
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1829
|
+
expectedAccountMetas: 9
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
let accountIndex = 0;
|
|
1833
|
+
const getNextAccount = () => {
|
|
1834
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1835
|
+
accountIndex += 1;
|
|
1836
|
+
return accountMeta;
|
|
1837
|
+
};
|
|
1838
|
+
return {
|
|
1839
|
+
programAddress: instruction.programAddress,
|
|
1840
|
+
accounts: {
|
|
1841
|
+
funder: getNextAccount(),
|
|
1842
|
+
authority: getNextAccount(),
|
|
1843
|
+
config: getNextAccount(),
|
|
1844
|
+
bondSource: getNextAccount(),
|
|
1845
|
+
bondVault: getNextAccount(),
|
|
1846
|
+
tokenProgram: getNextAccount(),
|
|
1847
|
+
systemProgram: getNextAccount(),
|
|
1848
|
+
eventAuthority: getNextAccount(),
|
|
1849
|
+
program: getNextAccount()
|
|
1850
|
+
},
|
|
1851
|
+
data: getRegisterGuardianInstructionDataDecoder().decode(instruction.data)
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
var REMOVE_GUARDIAN_DISCRIMINATOR = new Uint8Array([72, 117, 160, 244, 155, 185, 71, 18]);
|
|
1855
|
+
function getRemoveGuardianDiscriminatorBytes() {
|
|
1856
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(REMOVE_GUARDIAN_DISCRIMINATOR);
|
|
1857
|
+
}
|
|
1858
|
+
function getRemoveGuardianInstructionDataEncoder() {
|
|
1859
|
+
return transformEncoder(
|
|
1860
|
+
getStructEncoder([
|
|
1861
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1862
|
+
["guardian", getAddressEncoder()]
|
|
1863
|
+
]),
|
|
1864
|
+
(value) => ({ ...value, discriminator: REMOVE_GUARDIAN_DISCRIMINATOR })
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
function getRemoveGuardianInstructionDataDecoder() {
|
|
1868
|
+
return getStructDecoder([
|
|
1869
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1870
|
+
["guardian", getAddressDecoder()]
|
|
1871
|
+
]);
|
|
1872
|
+
}
|
|
1873
|
+
function getRemoveGuardianInstructionDataCodec() {
|
|
1874
|
+
return combineCodec(getRemoveGuardianInstructionDataEncoder(), getRemoveGuardianInstructionDataDecoder());
|
|
1875
|
+
}
|
|
1876
|
+
async function getRemoveGuardianInstructionAsync(input, config) {
|
|
1877
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1878
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1879
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1880
|
+
const originalAccounts = {
|
|
1881
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1882
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1883
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1884
|
+
bondVault: { value: input.bondVault ?? null, isSigner: false, isWritable: true },
|
|
1885
|
+
destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
|
|
1886
|
+
tokenProgram: { value: input.tokenProgram ?? null, isSigner: false, isWritable: false },
|
|
1887
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1888
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1889
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1890
|
+
};
|
|
1891
|
+
const accounts = originalAccounts;
|
|
1892
|
+
const args = { ...input };
|
|
1893
|
+
if (!accounts.config.value) {
|
|
1894
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
1895
|
+
programAddress,
|
|
1896
|
+
seeds: [
|
|
1897
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
1898
|
+
]
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
if (!accounts.bondVault.value) {
|
|
1902
|
+
accounts.bondVault.value = await getProgramDerivedAddress({
|
|
1903
|
+
programAddress,
|
|
1904
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([66, 79, 78, 68, 95, 86, 65, 85, 76, 84]))]
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
if (!accounts.tokenProgram.value) {
|
|
1908
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1909
|
+
}
|
|
1910
|
+
if (!accounts.systemProgram.value) {
|
|
1911
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1912
|
+
}
|
|
1913
|
+
if (!accounts.eventAuthority.value) {
|
|
1914
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
1915
|
+
programAddress,
|
|
1916
|
+
seeds: [
|
|
1917
|
+
getBytesEncoder().encode(
|
|
1918
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1919
|
+
)
|
|
1920
|
+
]
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
if (!accounts.program.value) {
|
|
1924
|
+
accounts.program.value = programAddress;
|
|
1925
|
+
accounts.program.isWritable = false;
|
|
1926
|
+
}
|
|
1927
|
+
return Object.freeze({
|
|
1928
|
+
accounts: [
|
|
1929
|
+
getAccountMeta("funder", accounts.funder),
|
|
1930
|
+
getAccountMeta("authority", accounts.authority),
|
|
1931
|
+
getAccountMeta("config", accounts.config),
|
|
1932
|
+
getAccountMeta("bondVault", accounts.bondVault),
|
|
1933
|
+
getAccountMeta("destination", accounts.destination),
|
|
1934
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1935
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1936
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1937
|
+
getAccountMeta("program", accounts.program)
|
|
1938
|
+
],
|
|
1939
|
+
data: getRemoveGuardianInstructionDataEncoder().encode(args),
|
|
1940
|
+
programAddress
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
function getRemoveGuardianInstruction(input, config) {
|
|
1944
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
1945
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
1946
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1947
|
+
const originalAccounts = {
|
|
1948
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
1949
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
1950
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
1951
|
+
bondVault: { value: input.bondVault ?? null, isSigner: false, isWritable: true },
|
|
1952
|
+
destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
|
|
1953
|
+
tokenProgram: { value: input.tokenProgram ?? null, isSigner: false, isWritable: false },
|
|
1954
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
1955
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
1956
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
1957
|
+
};
|
|
1958
|
+
const accounts = originalAccounts;
|
|
1959
|
+
const args = { ...input };
|
|
1960
|
+
if (!accounts.tokenProgram.value) {
|
|
1961
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1962
|
+
}
|
|
1963
|
+
if (!accounts.systemProgram.value) {
|
|
1964
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1965
|
+
}
|
|
1966
|
+
if (!accounts.program.value) {
|
|
1967
|
+
accounts.program.value = programAddress;
|
|
1968
|
+
accounts.program.isWritable = false;
|
|
1969
|
+
}
|
|
1970
|
+
return Object.freeze({
|
|
1971
|
+
accounts: [
|
|
1972
|
+
getAccountMeta("funder", accounts.funder),
|
|
1973
|
+
getAccountMeta("authority", accounts.authority),
|
|
1974
|
+
getAccountMeta("config", accounts.config),
|
|
1975
|
+
getAccountMeta("bondVault", accounts.bondVault),
|
|
1976
|
+
getAccountMeta("destination", accounts.destination),
|
|
1977
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1978
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1979
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1980
|
+
getAccountMeta("program", accounts.program)
|
|
1981
|
+
],
|
|
1982
|
+
data: getRemoveGuardianInstructionDataEncoder().encode(args),
|
|
1983
|
+
programAddress
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
function parseRemoveGuardianInstruction(instruction) {
|
|
1987
|
+
if (instruction.accounts.length < 9) {
|
|
1988
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1989
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1990
|
+
expectedAccountMetas: 9
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
let accountIndex = 0;
|
|
1994
|
+
const getNextAccount = () => {
|
|
1995
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1996
|
+
accountIndex += 1;
|
|
1997
|
+
return accountMeta;
|
|
1998
|
+
};
|
|
1999
|
+
const getNextOptionalAccount = () => {
|
|
2000
|
+
const accountMeta = getNextAccount();
|
|
2001
|
+
return accountMeta.address === GUARDIAN_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
2002
|
+
};
|
|
2003
|
+
return {
|
|
2004
|
+
programAddress: instruction.programAddress,
|
|
2005
|
+
accounts: {
|
|
2006
|
+
funder: getNextAccount(),
|
|
2007
|
+
authority: getNextAccount(),
|
|
2008
|
+
config: getNextAccount(),
|
|
2009
|
+
bondVault: getNextAccount(),
|
|
2010
|
+
destination: getNextOptionalAccount(),
|
|
2011
|
+
tokenProgram: getNextAccount(),
|
|
2012
|
+
systemProgram: getNextAccount(),
|
|
2013
|
+
eventAuthority: getNextAccount(),
|
|
2014
|
+
program: getNextAccount()
|
|
2015
|
+
},
|
|
2016
|
+
data: getRemoveGuardianInstructionDataDecoder().decode(instruction.data)
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
var ROTATE_VOTE_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
2020
|
+
153,
|
|
2021
|
+
199,
|
|
2022
|
+
84,
|
|
2023
|
+
126,
|
|
2024
|
+
148,
|
|
2025
|
+
220,
|
|
2026
|
+
80,
|
|
2027
|
+
34
|
|
2028
|
+
]);
|
|
2029
|
+
function getRotateVoteAuthorityDiscriminatorBytes() {
|
|
2030
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(ROTATE_VOTE_AUTHORITY_DISCRIMINATOR);
|
|
2031
|
+
}
|
|
2032
|
+
function getRotateVoteAuthorityInstructionDataEncoder() {
|
|
2033
|
+
return transformEncoder(
|
|
2034
|
+
getStructEncoder([
|
|
2035
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2036
|
+
["guardian", getAddressEncoder()],
|
|
2037
|
+
["newVoteAuthority", getAddressEncoder()]
|
|
2038
|
+
]),
|
|
2039
|
+
(value) => ({ ...value, discriminator: ROTATE_VOTE_AUTHORITY_DISCRIMINATOR })
|
|
2040
|
+
);
|
|
2041
|
+
}
|
|
2042
|
+
function getRotateVoteAuthorityInstructionDataDecoder() {
|
|
2043
|
+
return getStructDecoder([
|
|
2044
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2045
|
+
["guardian", getAddressDecoder()],
|
|
2046
|
+
["newVoteAuthority", getAddressDecoder()]
|
|
2047
|
+
]);
|
|
2048
|
+
}
|
|
2049
|
+
function getRotateVoteAuthorityInstructionDataCodec() {
|
|
2050
|
+
return combineCodec(getRotateVoteAuthorityInstructionDataEncoder(), getRotateVoteAuthorityInstructionDataDecoder());
|
|
2051
|
+
}
|
|
2052
|
+
async function getRotateVoteAuthorityInstructionAsync(input, config) {
|
|
2053
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2054
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2055
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2056
|
+
const originalAccounts = {
|
|
2057
|
+
signer: { value: input.signer ?? null, isSigner: true, isWritable: false },
|
|
2058
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
2059
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2060
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2061
|
+
};
|
|
2062
|
+
const accounts = originalAccounts;
|
|
2063
|
+
const args = { ...input };
|
|
2064
|
+
if (!accounts.config.value) {
|
|
2065
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
2066
|
+
programAddress,
|
|
2067
|
+
seeds: [
|
|
2068
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
2069
|
+
]
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
if (!accounts.eventAuthority.value) {
|
|
2073
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
2074
|
+
programAddress,
|
|
2075
|
+
seeds: [
|
|
2076
|
+
getBytesEncoder().encode(
|
|
2077
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2078
|
+
)
|
|
2079
|
+
]
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
if (!accounts.program.value) {
|
|
2083
|
+
accounts.program.value = programAddress;
|
|
2084
|
+
accounts.program.isWritable = false;
|
|
2085
|
+
}
|
|
2086
|
+
return Object.freeze({
|
|
2087
|
+
accounts: [
|
|
2088
|
+
getAccountMeta("signer", accounts.signer),
|
|
2089
|
+
getAccountMeta("config", accounts.config),
|
|
2090
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2091
|
+
getAccountMeta("program", accounts.program)
|
|
2092
|
+
],
|
|
2093
|
+
data: getRotateVoteAuthorityInstructionDataEncoder().encode(args),
|
|
2094
|
+
programAddress
|
|
2095
|
+
});
|
|
2096
|
+
}
|
|
2097
|
+
function getRotateVoteAuthorityInstruction(input, config) {
|
|
2098
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2099
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2100
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2101
|
+
const originalAccounts = {
|
|
2102
|
+
signer: { value: input.signer ?? null, isSigner: true, isWritable: false },
|
|
2103
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
2104
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2105
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2106
|
+
};
|
|
2107
|
+
const accounts = originalAccounts;
|
|
2108
|
+
const args = { ...input };
|
|
2109
|
+
if (!accounts.program.value) {
|
|
2110
|
+
accounts.program.value = programAddress;
|
|
2111
|
+
accounts.program.isWritable = false;
|
|
2112
|
+
}
|
|
2113
|
+
return Object.freeze({
|
|
2114
|
+
accounts: [
|
|
2115
|
+
getAccountMeta("signer", accounts.signer),
|
|
2116
|
+
getAccountMeta("config", accounts.config),
|
|
2117
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2118
|
+
getAccountMeta("program", accounts.program)
|
|
2119
|
+
],
|
|
2120
|
+
data: getRotateVoteAuthorityInstructionDataEncoder().encode(args),
|
|
2121
|
+
programAddress
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
function parseRotateVoteAuthorityInstruction(instruction) {
|
|
2125
|
+
if (instruction.accounts.length < 4) {
|
|
2126
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2127
|
+
actualAccountMetas: instruction.accounts.length,
|
|
2128
|
+
expectedAccountMetas: 4
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
let accountIndex = 0;
|
|
2132
|
+
const getNextAccount = () => {
|
|
2133
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2134
|
+
accountIndex += 1;
|
|
2135
|
+
return accountMeta;
|
|
2136
|
+
};
|
|
2137
|
+
return {
|
|
2138
|
+
programAddress: instruction.programAddress,
|
|
2139
|
+
accounts: {
|
|
2140
|
+
signer: getNextAccount(),
|
|
2141
|
+
config: getNextAccount(),
|
|
2142
|
+
eventAuthority: getNextAccount(),
|
|
2143
|
+
program: getNextAccount()
|
|
2144
|
+
},
|
|
2145
|
+
data: getRotateVoteAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
var SET_APP_DEVELOPER_DISCRIMINATOR = new Uint8Array([53, 1, 26, 238, 175, 84, 152, 48]);
|
|
2149
|
+
function getSetAppDeveloperDiscriminatorBytes() {
|
|
2150
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(SET_APP_DEVELOPER_DISCRIMINATOR);
|
|
2151
|
+
}
|
|
2152
|
+
function getSetAppDeveloperInstructionDataEncoder() {
|
|
2153
|
+
return transformEncoder(
|
|
2154
|
+
getStructEncoder([
|
|
2155
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2156
|
+
["developer", getAddressEncoder()],
|
|
2157
|
+
["allowed", getBooleanEncoder()]
|
|
2158
|
+
]),
|
|
2159
|
+
(value) => ({ ...value, discriminator: SET_APP_DEVELOPER_DISCRIMINATOR })
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
function getSetAppDeveloperInstructionDataDecoder() {
|
|
2163
|
+
return getStructDecoder([
|
|
2164
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2165
|
+
["developer", getAddressDecoder()],
|
|
2166
|
+
["allowed", getBooleanDecoder()]
|
|
2167
|
+
]);
|
|
2168
|
+
}
|
|
2169
|
+
function getSetAppDeveloperInstructionDataCodec() {
|
|
2170
|
+
return combineCodec(getSetAppDeveloperInstructionDataEncoder(), getSetAppDeveloperInstructionDataDecoder());
|
|
2171
|
+
}
|
|
2172
|
+
async function getSetAppDeveloperInstructionAsync(input, config) {
|
|
2173
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2174
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2175
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2176
|
+
const originalAccounts = {
|
|
2177
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
2178
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
2179
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
2180
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
2181
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2182
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2183
|
+
};
|
|
2184
|
+
const accounts = originalAccounts;
|
|
2185
|
+
const args = { ...input };
|
|
2186
|
+
if (!accounts.systemProgram.value) {
|
|
2187
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2188
|
+
}
|
|
2189
|
+
if (!accounts.eventAuthority.value) {
|
|
2190
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
2191
|
+
programAddress,
|
|
2192
|
+
seeds: [
|
|
2193
|
+
getBytesEncoder().encode(
|
|
2194
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2195
|
+
)
|
|
2196
|
+
]
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
if (!accounts.program.value) {
|
|
2200
|
+
accounts.program.value = programAddress;
|
|
2201
|
+
accounts.program.isWritable = false;
|
|
2202
|
+
}
|
|
2203
|
+
return Object.freeze({
|
|
2204
|
+
accounts: [
|
|
2205
|
+
getAccountMeta("funder", accounts.funder),
|
|
2206
|
+
getAccountMeta("authority", accounts.authority),
|
|
2207
|
+
getAccountMeta("app", accounts.app),
|
|
2208
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2209
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2210
|
+
getAccountMeta("program", accounts.program)
|
|
2211
|
+
],
|
|
2212
|
+
data: getSetAppDeveloperInstructionDataEncoder().encode(args),
|
|
2213
|
+
programAddress
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
function getSetAppDeveloperInstruction(input, config) {
|
|
2217
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2218
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2219
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2220
|
+
const originalAccounts = {
|
|
2221
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
2222
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
2223
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
2224
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false },
|
|
2225
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2226
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2227
|
+
};
|
|
2228
|
+
const accounts = originalAccounts;
|
|
2229
|
+
const args = { ...input };
|
|
2230
|
+
if (!accounts.systemProgram.value) {
|
|
2231
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2232
|
+
}
|
|
2233
|
+
if (!accounts.program.value) {
|
|
2234
|
+
accounts.program.value = programAddress;
|
|
2235
|
+
accounts.program.isWritable = false;
|
|
2236
|
+
}
|
|
2237
|
+
return Object.freeze({
|
|
2238
|
+
accounts: [
|
|
2239
|
+
getAccountMeta("funder", accounts.funder),
|
|
2240
|
+
getAccountMeta("authority", accounts.authority),
|
|
2241
|
+
getAccountMeta("app", accounts.app),
|
|
2242
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2243
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2244
|
+
getAccountMeta("program", accounts.program)
|
|
2245
|
+
],
|
|
2246
|
+
data: getSetAppDeveloperInstructionDataEncoder().encode(args),
|
|
2247
|
+
programAddress
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
function parseSetAppDeveloperInstruction(instruction) {
|
|
2251
|
+
if (instruction.accounts.length < 6) {
|
|
2252
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2253
|
+
actualAccountMetas: instruction.accounts.length,
|
|
2254
|
+
expectedAccountMetas: 6
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
let accountIndex = 0;
|
|
2258
|
+
const getNextAccount = () => {
|
|
2259
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2260
|
+
accountIndex += 1;
|
|
2261
|
+
return accountMeta;
|
|
2262
|
+
};
|
|
2263
|
+
return {
|
|
2264
|
+
programAddress: instruction.programAddress,
|
|
2265
|
+
accounts: {
|
|
2266
|
+
funder: getNextAccount(),
|
|
2267
|
+
authority: getNextAccount(),
|
|
2268
|
+
app: getNextAccount(),
|
|
2269
|
+
systemProgram: getNextAccount(),
|
|
2270
|
+
eventAuthority: getNextAccount(),
|
|
2271
|
+
program: getNextAccount()
|
|
2272
|
+
},
|
|
2273
|
+
data: getSetAppDeveloperInstructionDataDecoder().decode(instruction.data)
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
var UPDATE_CONFIG_DISCRIMINATOR = new Uint8Array([29, 158, 252, 191, 10, 83, 219, 99]);
|
|
2277
|
+
function getUpdateConfigDiscriminatorBytes() {
|
|
2278
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(UPDATE_CONFIG_DISCRIMINATOR);
|
|
2279
|
+
}
|
|
2280
|
+
function getUpdateConfigInstructionDataEncoder() {
|
|
2281
|
+
return transformEncoder(
|
|
2282
|
+
getStructEncoder([
|
|
2283
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2284
|
+
["bondAmount", getOptionEncoder(getU64Encoder())],
|
|
2285
|
+
["policyBundleHash", getOptionEncoder(fixEncoderSize(getBytesEncoder(), 32))],
|
|
2286
|
+
["voteWindow", getOptionEncoder(getU32Encoder())],
|
|
2287
|
+
["votingPeriod", getOptionEncoder(getU32Encoder())]
|
|
2288
|
+
]),
|
|
2289
|
+
(value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR })
|
|
2290
|
+
);
|
|
2291
|
+
}
|
|
2292
|
+
function getUpdateConfigInstructionDataDecoder() {
|
|
2293
|
+
return getStructDecoder([
|
|
2294
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2295
|
+
["bondAmount", getOptionDecoder(getU64Decoder())],
|
|
2296
|
+
["policyBundleHash", getOptionDecoder(fixDecoderSize(getBytesDecoder(), 32))],
|
|
2297
|
+
["voteWindow", getOptionDecoder(getU32Decoder())],
|
|
2298
|
+
["votingPeriod", getOptionDecoder(getU32Decoder())]
|
|
2299
|
+
]);
|
|
2300
|
+
}
|
|
2301
|
+
function getUpdateConfigInstructionDataCodec() {
|
|
2302
|
+
return combineCodec(getUpdateConfigInstructionDataEncoder(), getUpdateConfigInstructionDataDecoder());
|
|
2303
|
+
}
|
|
2304
|
+
async function getUpdateConfigInstructionAsync(input, config) {
|
|
2305
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2306
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2307
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2308
|
+
const originalAccounts = {
|
|
2309
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
2310
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
2311
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2312
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2313
|
+
};
|
|
2314
|
+
const accounts = originalAccounts;
|
|
2315
|
+
const args = { ...input };
|
|
2316
|
+
if (!accounts.config.value) {
|
|
2317
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
2318
|
+
programAddress,
|
|
2319
|
+
seeds: [
|
|
2320
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
2321
|
+
]
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
if (!accounts.eventAuthority.value) {
|
|
2325
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
2326
|
+
programAddress,
|
|
2327
|
+
seeds: [
|
|
2328
|
+
getBytesEncoder().encode(
|
|
2329
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2330
|
+
)
|
|
2331
|
+
]
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
if (!accounts.program.value) {
|
|
2335
|
+
accounts.program.value = programAddress;
|
|
2336
|
+
accounts.program.isWritable = false;
|
|
2337
|
+
}
|
|
2338
|
+
return Object.freeze({
|
|
2339
|
+
accounts: [
|
|
2340
|
+
getAccountMeta("authority", accounts.authority),
|
|
2341
|
+
getAccountMeta("config", accounts.config),
|
|
2342
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2343
|
+
getAccountMeta("program", accounts.program)
|
|
2344
|
+
],
|
|
2345
|
+
data: getUpdateConfigInstructionDataEncoder().encode(args),
|
|
2346
|
+
programAddress
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
function getUpdateConfigInstruction(input, config) {
|
|
2350
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2351
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2352
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2353
|
+
const originalAccounts = {
|
|
2354
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
2355
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: true },
|
|
2356
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2357
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2358
|
+
};
|
|
2359
|
+
const accounts = originalAccounts;
|
|
2360
|
+
const args = { ...input };
|
|
2361
|
+
if (!accounts.program.value) {
|
|
2362
|
+
accounts.program.value = programAddress;
|
|
2363
|
+
accounts.program.isWritable = false;
|
|
2364
|
+
}
|
|
2365
|
+
return Object.freeze({
|
|
2366
|
+
accounts: [
|
|
2367
|
+
getAccountMeta("authority", accounts.authority),
|
|
2368
|
+
getAccountMeta("config", accounts.config),
|
|
2369
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2370
|
+
getAccountMeta("program", accounts.program)
|
|
2371
|
+
],
|
|
2372
|
+
data: getUpdateConfigInstructionDataEncoder().encode(args),
|
|
2373
|
+
programAddress
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
function parseUpdateConfigInstruction(instruction) {
|
|
2377
|
+
if (instruction.accounts.length < 4) {
|
|
2378
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2379
|
+
actualAccountMetas: instruction.accounts.length,
|
|
2380
|
+
expectedAccountMetas: 4
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
let accountIndex = 0;
|
|
2384
|
+
const getNextAccount = () => {
|
|
2385
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2386
|
+
accountIndex += 1;
|
|
2387
|
+
return accountMeta;
|
|
2388
|
+
};
|
|
2389
|
+
return {
|
|
2390
|
+
programAddress: instruction.programAddress,
|
|
2391
|
+
accounts: {
|
|
2392
|
+
authority: getNextAccount(),
|
|
2393
|
+
config: getNextAccount(),
|
|
2394
|
+
eventAuthority: getNextAccount(),
|
|
2395
|
+
program: getNextAccount()
|
|
2396
|
+
},
|
|
2397
|
+
data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
|
|
2398
|
+
};
|
|
2399
|
+
}
|
|
2400
|
+
var VOTE_DISCRIMINATOR = new Uint8Array([227, 110, 155, 23, 136, 126, 172, 25]);
|
|
2401
|
+
function getVoteDiscriminatorBytes() {
|
|
2402
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(VOTE_DISCRIMINATOR);
|
|
2403
|
+
}
|
|
2404
|
+
function getVoteInstructionDataEncoder() {
|
|
2405
|
+
return transformEncoder(
|
|
2406
|
+
getStructEncoder([
|
|
2407
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2408
|
+
["approve", getBooleanEncoder()],
|
|
2409
|
+
["versionCode", getU32Encoder()],
|
|
2410
|
+
["manifestHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
2411
|
+
["policyBundleHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
2412
|
+
["findings", getArrayEncoder(getVoteFindingEncoder())]
|
|
2413
|
+
]),
|
|
2414
|
+
(value) => ({ ...value, discriminator: VOTE_DISCRIMINATOR })
|
|
2415
|
+
);
|
|
2416
|
+
}
|
|
2417
|
+
function getVoteInstructionDataDecoder() {
|
|
2418
|
+
return getStructDecoder([
|
|
2419
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2420
|
+
["approve", getBooleanDecoder()],
|
|
2421
|
+
["versionCode", getU32Decoder()],
|
|
2422
|
+
["manifestHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
2423
|
+
["policyBundleHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
2424
|
+
["findings", getArrayDecoder(getVoteFindingDecoder())]
|
|
2425
|
+
]);
|
|
2426
|
+
}
|
|
2427
|
+
function getVoteInstructionDataCodec() {
|
|
2428
|
+
return combineCodec(getVoteInstructionDataEncoder(), getVoteInstructionDataDecoder());
|
|
2429
|
+
}
|
|
2430
|
+
async function getVoteInstructionAsync(input, config) {
|
|
2431
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2432
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2433
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2434
|
+
const originalAccounts = {
|
|
2435
|
+
voteAuthority: { value: input.voteAuthority ?? null, isSigner: true, isWritable: false },
|
|
2436
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
2437
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
2438
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
2439
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2440
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2441
|
+
};
|
|
2442
|
+
const accounts = originalAccounts;
|
|
2443
|
+
const args = { ...input };
|
|
2444
|
+
if (!accounts.config.value) {
|
|
2445
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
2446
|
+
programAddress,
|
|
2447
|
+
seeds: [
|
|
2448
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
2449
|
+
]
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
if (!accounts.registry.value) {
|
|
2453
|
+
accounts.registry.value = await getProgramDerivedAddress({
|
|
2454
|
+
programAddress,
|
|
2455
|
+
seeds: [
|
|
2456
|
+
getBytesEncoder().encode(
|
|
2457
|
+
new Uint8Array([80, 69, 78, 68, 73, 78, 71, 95, 82, 69, 71, 73, 83, 84, 82, 89])
|
|
2458
|
+
)
|
|
2459
|
+
]
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2462
|
+
if (!accounts.eventAuthority.value) {
|
|
2463
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress({
|
|
2464
|
+
programAddress,
|
|
2465
|
+
seeds: [
|
|
2466
|
+
getBytesEncoder().encode(
|
|
2467
|
+
new Uint8Array([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2468
|
+
)
|
|
2469
|
+
]
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2472
|
+
if (!accounts.program.value) {
|
|
2473
|
+
accounts.program.value = programAddress;
|
|
2474
|
+
accounts.program.isWritable = false;
|
|
2475
|
+
}
|
|
2476
|
+
return Object.freeze({
|
|
2477
|
+
accounts: [
|
|
2478
|
+
getAccountMeta("voteAuthority", accounts.voteAuthority),
|
|
2479
|
+
getAccountMeta("config", accounts.config),
|
|
2480
|
+
getAccountMeta("app", accounts.app),
|
|
2481
|
+
getAccountMeta("registry", accounts.registry),
|
|
2482
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2483
|
+
getAccountMeta("program", accounts.program)
|
|
2484
|
+
],
|
|
2485
|
+
data: getVoteInstructionDataEncoder().encode(args),
|
|
2486
|
+
programAddress
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2489
|
+
function getVoteInstruction(input, config) {
|
|
2490
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2491
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2492
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2493
|
+
const originalAccounts = {
|
|
2494
|
+
voteAuthority: { value: input.voteAuthority ?? null, isSigner: true, isWritable: false },
|
|
2495
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
2496
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
2497
|
+
registry: { value: input.registry ?? null, isSigner: false, isWritable: true },
|
|
2498
|
+
eventAuthority: { value: input.eventAuthority ?? null, isSigner: false, isWritable: false },
|
|
2499
|
+
program: { value: input.program ?? null, isSigner: false, isWritable: false }
|
|
2500
|
+
};
|
|
2501
|
+
const accounts = originalAccounts;
|
|
2502
|
+
const args = { ...input };
|
|
2503
|
+
if (!accounts.program.value) {
|
|
2504
|
+
accounts.program.value = programAddress;
|
|
2505
|
+
accounts.program.isWritable = false;
|
|
2506
|
+
}
|
|
2507
|
+
return Object.freeze({
|
|
2508
|
+
accounts: [
|
|
2509
|
+
getAccountMeta("voteAuthority", accounts.voteAuthority),
|
|
2510
|
+
getAccountMeta("config", accounts.config),
|
|
2511
|
+
getAccountMeta("app", accounts.app),
|
|
2512
|
+
getAccountMeta("registry", accounts.registry),
|
|
2513
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2514
|
+
getAccountMeta("program", accounts.program)
|
|
2515
|
+
],
|
|
2516
|
+
data: getVoteInstructionDataEncoder().encode(args),
|
|
2517
|
+
programAddress
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
function parseVoteInstruction(instruction) {
|
|
2521
|
+
if (instruction.accounts.length < 6) {
|
|
2522
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2523
|
+
actualAccountMetas: instruction.accounts.length,
|
|
2524
|
+
expectedAccountMetas: 6
|
|
2525
|
+
});
|
|
2526
|
+
}
|
|
2527
|
+
let accountIndex = 0;
|
|
2528
|
+
const getNextAccount = () => {
|
|
2529
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2530
|
+
accountIndex += 1;
|
|
2531
|
+
return accountMeta;
|
|
2532
|
+
};
|
|
2533
|
+
return {
|
|
2534
|
+
programAddress: instruction.programAddress,
|
|
2535
|
+
accounts: {
|
|
2536
|
+
voteAuthority: getNextAccount(),
|
|
2537
|
+
config: getNextAccount(),
|
|
2538
|
+
app: getNextAccount(),
|
|
2539
|
+
registry: getNextAccount(),
|
|
2540
|
+
eventAuthority: getNextAccount(),
|
|
2541
|
+
program: getNextAccount()
|
|
2542
|
+
},
|
|
2543
|
+
data: getVoteInstructionDataDecoder().decode(instruction.data)
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
var WRITE_RELEASE_MANIFEST_DISCRIMINATOR = new Uint8Array([
|
|
2547
|
+
98,
|
|
2548
|
+
30,
|
|
2549
|
+
102,
|
|
2550
|
+
216,
|
|
2551
|
+
54,
|
|
2552
|
+
58,
|
|
2553
|
+
138,
|
|
2554
|
+
114
|
|
2555
|
+
]);
|
|
2556
|
+
function getWriteReleaseManifestDiscriminatorBytes() {
|
|
2557
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(WRITE_RELEASE_MANIFEST_DISCRIMINATOR);
|
|
2558
|
+
}
|
|
2559
|
+
function getWriteReleaseManifestInstructionDataEncoder() {
|
|
2560
|
+
return transformEncoder(
|
|
2561
|
+
getStructEncoder([
|
|
2562
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2563
|
+
["versionCode", getU32Encoder()],
|
|
2564
|
+
["manifestLen", getU32Encoder()],
|
|
2565
|
+
["offset", getU32Encoder()],
|
|
2566
|
+
["bytes", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())]
|
|
2567
|
+
]),
|
|
2568
|
+
(value) => ({ ...value, discriminator: WRITE_RELEASE_MANIFEST_DISCRIMINATOR })
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2571
|
+
function getWriteReleaseManifestInstructionDataDecoder() {
|
|
2572
|
+
return getStructDecoder([
|
|
2573
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2574
|
+
["versionCode", getU32Decoder()],
|
|
2575
|
+
["manifestLen", getU32Decoder()],
|
|
2576
|
+
["offset", getU32Decoder()],
|
|
2577
|
+
["bytes", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())]
|
|
2578
|
+
]);
|
|
2579
|
+
}
|
|
2580
|
+
function getWriteReleaseManifestInstructionDataCodec() {
|
|
2581
|
+
return combineCodec(
|
|
2582
|
+
getWriteReleaseManifestInstructionDataEncoder(),
|
|
2583
|
+
getWriteReleaseManifestInstructionDataDecoder()
|
|
2584
|
+
);
|
|
2585
|
+
}
|
|
2586
|
+
async function getWriteReleaseManifestInstructionAsync(input, config) {
|
|
2587
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2588
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2589
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2590
|
+
const originalAccounts = {
|
|
2591
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
2592
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
2593
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
2594
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
2595
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false }
|
|
2596
|
+
};
|
|
2597
|
+
const accounts = originalAccounts;
|
|
2598
|
+
const args = { ...input };
|
|
2599
|
+
if (!accounts.config.value) {
|
|
2600
|
+
accounts.config.value = await getProgramDerivedAddress({
|
|
2601
|
+
programAddress,
|
|
2602
|
+
seeds: [
|
|
2603
|
+
getBytesEncoder().encode(new Uint8Array([71, 85, 65, 82, 68, 73, 65, 78, 95, 67, 79, 78, 70, 73, 71]))
|
|
2604
|
+
]
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
if (!accounts.systemProgram.value) {
|
|
2608
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2609
|
+
}
|
|
2610
|
+
return Object.freeze({
|
|
2611
|
+
accounts: [
|
|
2612
|
+
getAccountMeta("funder", accounts.funder),
|
|
2613
|
+
getAccountMeta("authority", accounts.authority),
|
|
2614
|
+
getAccountMeta("app", accounts.app),
|
|
2615
|
+
getAccountMeta("config", accounts.config),
|
|
2616
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2617
|
+
],
|
|
2618
|
+
data: getWriteReleaseManifestInstructionDataEncoder().encode(args),
|
|
2619
|
+
programAddress
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
function getWriteReleaseManifestInstruction(input, config) {
|
|
2623
|
+
const programAddressInput = config?.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
2624
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2625
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2626
|
+
const originalAccounts = {
|
|
2627
|
+
funder: { value: input.funder ?? null, isSigner: true, isWritable: true },
|
|
2628
|
+
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
|
|
2629
|
+
app: { value: input.app ?? null, isSigner: false, isWritable: true },
|
|
2630
|
+
config: { value: input.config ?? null, isSigner: false, isWritable: false },
|
|
2631
|
+
systemProgram: { value: input.systemProgram ?? null, isSigner: false, isWritable: false }
|
|
2632
|
+
};
|
|
2633
|
+
const accounts = originalAccounts;
|
|
2634
|
+
const args = { ...input };
|
|
2635
|
+
if (!accounts.systemProgram.value) {
|
|
2636
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2637
|
+
}
|
|
2638
|
+
return Object.freeze({
|
|
2639
|
+
accounts: [
|
|
2640
|
+
getAccountMeta("funder", accounts.funder),
|
|
2641
|
+
getAccountMeta("authority", accounts.authority),
|
|
2642
|
+
getAccountMeta("app", accounts.app),
|
|
2643
|
+
getAccountMeta("config", accounts.config),
|
|
2644
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2645
|
+
],
|
|
2646
|
+
data: getWriteReleaseManifestInstructionDataEncoder().encode(args),
|
|
2647
|
+
programAddress
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
function parseWriteReleaseManifestInstruction(instruction) {
|
|
2651
|
+
if (instruction.accounts.length < 5) {
|
|
2652
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2653
|
+
actualAccountMetas: instruction.accounts.length,
|
|
2654
|
+
expectedAccountMetas: 5
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
let accountIndex = 0;
|
|
2658
|
+
const getNextAccount = () => {
|
|
2659
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2660
|
+
accountIndex += 1;
|
|
2661
|
+
return accountMeta;
|
|
2662
|
+
};
|
|
2663
|
+
return {
|
|
2664
|
+
programAddress: instruction.programAddress,
|
|
2665
|
+
accounts: {
|
|
2666
|
+
funder: getNextAccount(),
|
|
2667
|
+
authority: getNextAccount(),
|
|
2668
|
+
app: getNextAccount(),
|
|
2669
|
+
config: getNextAccount(),
|
|
2670
|
+
systemProgram: getNextAccount()
|
|
2671
|
+
},
|
|
2672
|
+
data: getWriteReleaseManifestInstructionDataDecoder().decode(instruction.data)
|
|
2673
|
+
};
|
|
2674
|
+
}
|
|
2675
|
+
async function findBondVaultPda(config = {}) {
|
|
2676
|
+
const {
|
|
2677
|
+
programAddress: programAddressInput = "GUARDsVUfAaydbPU6QGcpWRLUkExaULtaygwEtkdhZAD"
|
|
2678
|
+
} = config;
|
|
2679
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2680
|
+
return await getProgramDerivedAddress({ programAddress, seeds: [getUtf8Encoder().encode("BOND_VAULT")] });
|
|
2681
|
+
}
|
|
2682
|
+
async function findGuardiansConfigPda(config = {}) {
|
|
2683
|
+
const {
|
|
2684
|
+
programAddress: programAddressInput = "GUARDsVUfAaydbPU6QGcpWRLUkExaULtaygwEtkdhZAD"
|
|
2685
|
+
} = config;
|
|
2686
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2687
|
+
return await getProgramDerivedAddress({ programAddress, seeds: [getUtf8Encoder().encode("GUARDIAN_CONFIG")] });
|
|
2688
|
+
}
|
|
2689
|
+
async function findPendingRegistryPda(config = {}) {
|
|
2690
|
+
const {
|
|
2691
|
+
programAddress: programAddressInput = "GUARDsVUfAaydbPU6QGcpWRLUkExaULtaygwEtkdhZAD"
|
|
2692
|
+
} = config;
|
|
2693
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
2694
|
+
return await getProgramDerivedAddress({ programAddress, seeds: [getUtf8Encoder().encode("PENDING_REGISTRY")] });
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
// src/generated/programs/guardian.ts
|
|
2698
|
+
var GUARDIAN_PROGRAM_ADDRESS = "GUARDsVUfAaydbPU6QGcpWRLUkExaULtaygwEtkdhZAD";
|
|
2699
|
+
var GuardianAccount = /* @__PURE__ */ ((GuardianAccount2) => {
|
|
2700
|
+
GuardianAccount2[GuardianAccount2["AppAccount"] = 0] = "AppAccount";
|
|
2701
|
+
GuardianAccount2[GuardianAccount2["GuardiansConfig"] = 1] = "GuardiansConfig";
|
|
2702
|
+
GuardianAccount2[GuardianAccount2["PendingRegistry"] = 2] = "PendingRegistry";
|
|
2703
|
+
return GuardianAccount2;
|
|
2704
|
+
})(GuardianAccount || {});
|
|
2705
|
+
function identifyGuardianAccount(account) {
|
|
2706
|
+
const data = "data" in account ? account.data : account;
|
|
2707
|
+
if (containsBytes(
|
|
2708
|
+
data,
|
|
2709
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([189, 192, 243, 151, 141, 78, 227, 17])),
|
|
2710
|
+
0
|
|
2711
|
+
)) {
|
|
2712
|
+
return 0 /* AppAccount */;
|
|
2713
|
+
}
|
|
2714
|
+
if (containsBytes(
|
|
2715
|
+
data,
|
|
2716
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([96, 9, 56, 96, 215, 120, 26, 206])),
|
|
2717
|
+
0
|
|
2718
|
+
)) {
|
|
2719
|
+
return 1 /* GuardiansConfig */;
|
|
2720
|
+
}
|
|
2721
|
+
if (containsBytes(
|
|
2722
|
+
data,
|
|
2723
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([190, 252, 14, 196, 56, 47, 120, 61])),
|
|
2724
|
+
0
|
|
2725
|
+
)) {
|
|
2726
|
+
return 2 /* PendingRegistry */;
|
|
2727
|
+
}
|
|
2728
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, {
|
|
2729
|
+
accountData: data,
|
|
2730
|
+
programName: "guardian"
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
var GuardianEvent = /* @__PURE__ */ ((GuardianEvent2) => {
|
|
2734
|
+
GuardianEvent2[GuardianEvent2["AppAuthorityAccepted"] = 0] = "AppAuthorityAccepted";
|
|
2735
|
+
GuardianEvent2[GuardianEvent2["AppAuthorityProposed"] = 1] = "AppAuthorityProposed";
|
|
2736
|
+
GuardianEvent2[GuardianEvent2["AppDeveloperUpdated"] = 2] = "AppDeveloperUpdated";
|
|
2737
|
+
GuardianEvent2[GuardianEvent2["AppRegistered"] = 3] = "AppRegistered";
|
|
2738
|
+
GuardianEvent2[GuardianEvent2["ConfigAuthorityAccepted"] = 4] = "ConfigAuthorityAccepted";
|
|
2739
|
+
GuardianEvent2[GuardianEvent2["ConfigAuthorityProposed"] = 5] = "ConfigAuthorityProposed";
|
|
2740
|
+
GuardianEvent2[GuardianEvent2["ConfigInitialized"] = 6] = "ConfigInitialized";
|
|
2741
|
+
GuardianEvent2[GuardianEvent2["ConfigUpdated"] = 7] = "ConfigUpdated";
|
|
2742
|
+
GuardianEvent2[GuardianEvent2["GuardianAdded"] = 8] = "GuardianAdded";
|
|
2743
|
+
GuardianEvent2[GuardianEvent2["GuardianRegistered"] = 9] = "GuardianRegistered";
|
|
2744
|
+
GuardianEvent2[GuardianEvent2["GuardianRemoved"] = 10] = "GuardianRemoved";
|
|
2745
|
+
GuardianEvent2[GuardianEvent2["GuardianVoteAuthorityRotated"] = 11] = "GuardianVoteAuthorityRotated";
|
|
2746
|
+
GuardianEvent2[GuardianEvent2["ReleaseApproved"] = 12] = "ReleaseApproved";
|
|
2747
|
+
GuardianEvent2[GuardianEvent2["ReleaseCancelled"] = 13] = "ReleaseCancelled";
|
|
2748
|
+
GuardianEvent2[GuardianEvent2["ReleaseExpired"] = 14] = "ReleaseExpired";
|
|
2749
|
+
GuardianEvent2[GuardianEvent2["ReleaseProposed"] = 15] = "ReleaseProposed";
|
|
2750
|
+
GuardianEvent2[GuardianEvent2["ReleaseRejected"] = 16] = "ReleaseRejected";
|
|
2751
|
+
GuardianEvent2[GuardianEvent2["VoteCast"] = 17] = "VoteCast";
|
|
2752
|
+
return GuardianEvent2;
|
|
2753
|
+
})(GuardianEvent || {});
|
|
2754
|
+
function identifyGuardianEvent(event) {
|
|
2755
|
+
const data = "data" in event ? event.data : event;
|
|
2756
|
+
if (containsBytes(
|
|
2757
|
+
data,
|
|
2758
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([216, 100, 38, 168, 184, 157, 141, 247])),
|
|
2759
|
+
0
|
|
2760
|
+
)) {
|
|
2761
|
+
return 0 /* AppAuthorityAccepted */;
|
|
2762
|
+
}
|
|
2763
|
+
if (containsBytes(
|
|
2764
|
+
data,
|
|
2765
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([17, 143, 174, 4, 147, 110, 126, 84])),
|
|
2766
|
+
0
|
|
2767
|
+
)) {
|
|
2768
|
+
return 1 /* AppAuthorityProposed */;
|
|
2769
|
+
}
|
|
2770
|
+
if (containsBytes(
|
|
2771
|
+
data,
|
|
2772
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([132, 135, 205, 60, 48, 208, 44, 171])),
|
|
2773
|
+
0
|
|
2774
|
+
)) {
|
|
2775
|
+
return 2 /* AppDeveloperUpdated */;
|
|
2776
|
+
}
|
|
2777
|
+
if (containsBytes(
|
|
2778
|
+
data,
|
|
2779
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([99, 12, 19, 34, 85, 60, 170, 229])),
|
|
2780
|
+
0
|
|
2781
|
+
)) {
|
|
2782
|
+
return 3 /* AppRegistered */;
|
|
2783
|
+
}
|
|
2784
|
+
if (containsBytes(
|
|
2785
|
+
data,
|
|
2786
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([166, 249, 198, 239, 64, 193, 191, 242])),
|
|
2787
|
+
0
|
|
2788
|
+
)) {
|
|
2789
|
+
return 4 /* ConfigAuthorityAccepted */;
|
|
2790
|
+
}
|
|
2791
|
+
if (containsBytes(
|
|
2792
|
+
data,
|
|
2793
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([125, 29, 33, 186, 153, 16, 155, 229])),
|
|
2794
|
+
0
|
|
2795
|
+
)) {
|
|
2796
|
+
return 5 /* ConfigAuthorityProposed */;
|
|
2797
|
+
}
|
|
2798
|
+
if (containsBytes(
|
|
2799
|
+
data,
|
|
2800
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([181, 49, 200, 156, 19, 167, 178, 91])),
|
|
2801
|
+
0
|
|
2802
|
+
)) {
|
|
2803
|
+
return 6 /* ConfigInitialized */;
|
|
2804
|
+
}
|
|
2805
|
+
if (containsBytes(
|
|
2806
|
+
data,
|
|
2807
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([40, 241, 230, 122, 11, 19, 198, 194])),
|
|
2808
|
+
0
|
|
2809
|
+
)) {
|
|
2810
|
+
return 7 /* ConfigUpdated */;
|
|
2811
|
+
}
|
|
2812
|
+
if (containsBytes(
|
|
2813
|
+
data,
|
|
2814
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([151, 0, 228, 5, 239, 58, 162, 18])),
|
|
2815
|
+
0
|
|
2816
|
+
)) {
|
|
2817
|
+
return 8 /* GuardianAdded */;
|
|
2818
|
+
}
|
|
2819
|
+
if (containsBytes(
|
|
2820
|
+
data,
|
|
2821
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([255, 23, 109, 119, 11, 122, 209, 103])),
|
|
2822
|
+
0
|
|
2823
|
+
)) {
|
|
2824
|
+
return 9 /* GuardianRegistered */;
|
|
2825
|
+
}
|
|
2826
|
+
if (containsBytes(
|
|
2827
|
+
data,
|
|
2828
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([225, 27, 117, 56, 241, 196, 5, 56])),
|
|
2829
|
+
0
|
|
2830
|
+
)) {
|
|
2831
|
+
return 10 /* GuardianRemoved */;
|
|
2832
|
+
}
|
|
2833
|
+
if (containsBytes(
|
|
2834
|
+
data,
|
|
2835
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([182, 81, 245, 184, 174, 85, 224, 213])),
|
|
2836
|
+
0
|
|
2837
|
+
)) {
|
|
2838
|
+
return 11 /* GuardianVoteAuthorityRotated */;
|
|
2839
|
+
}
|
|
2840
|
+
if (containsBytes(
|
|
2841
|
+
data,
|
|
2842
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([246, 7, 17, 99, 160, 10, 151, 253])),
|
|
2843
|
+
0
|
|
2844
|
+
)) {
|
|
2845
|
+
return 12 /* ReleaseApproved */;
|
|
2846
|
+
}
|
|
2847
|
+
if (containsBytes(
|
|
2848
|
+
data,
|
|
2849
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([107, 100, 38, 206, 48, 27, 92, 178])),
|
|
2850
|
+
0
|
|
2851
|
+
)) {
|
|
2852
|
+
return 13 /* ReleaseCancelled */;
|
|
2853
|
+
}
|
|
2854
|
+
if (containsBytes(
|
|
2855
|
+
data,
|
|
2856
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([185, 185, 92, 34, 95, 198, 124, 51])),
|
|
2857
|
+
0
|
|
2858
|
+
)) {
|
|
2859
|
+
return 14 /* ReleaseExpired */;
|
|
2860
|
+
}
|
|
2861
|
+
if (containsBytes(
|
|
2862
|
+
data,
|
|
2863
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([245, 225, 27, 20, 64, 160, 146, 183])),
|
|
2864
|
+
0
|
|
2865
|
+
)) {
|
|
2866
|
+
return 15 /* ReleaseProposed */;
|
|
2867
|
+
}
|
|
2868
|
+
if (containsBytes(
|
|
2869
|
+
data,
|
|
2870
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([144, 93, 149, 105, 200, 85, 92, 126])),
|
|
2871
|
+
0
|
|
2872
|
+
)) {
|
|
2873
|
+
return 16 /* ReleaseRejected */;
|
|
2874
|
+
}
|
|
2875
|
+
if (containsBytes(
|
|
2876
|
+
data,
|
|
2877
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([39, 53, 195, 104, 188, 17, 225, 213])),
|
|
2878
|
+
0
|
|
2879
|
+
)) {
|
|
2880
|
+
return 17 /* VoteCast */;
|
|
2881
|
+
}
|
|
2882
|
+
throw new Error("The provided event could not be identified as a guardian event.");
|
|
2883
|
+
}
|
|
2884
|
+
var GuardianInstruction = /* @__PURE__ */ ((GuardianInstruction2) => {
|
|
2885
|
+
GuardianInstruction2[GuardianInstruction2["AcceptAppAuthority"] = 0] = "AcceptAppAuthority";
|
|
2886
|
+
GuardianInstruction2[GuardianInstruction2["AcceptConfigAuthority"] = 1] = "AcceptConfigAuthority";
|
|
2887
|
+
GuardianInstruction2[GuardianInstruction2["AddGuardian"] = 2] = "AddGuardian";
|
|
2888
|
+
GuardianInstruction2[GuardianInstruction2["CancelRelease"] = 3] = "CancelRelease";
|
|
2889
|
+
GuardianInstruction2[GuardianInstruction2["ExpireRelease"] = 4] = "ExpireRelease";
|
|
2890
|
+
GuardianInstruction2[GuardianInstruction2["InitializeConfig"] = 5] = "InitializeConfig";
|
|
2891
|
+
GuardianInstruction2[GuardianInstruction2["ProposeAppAuthority"] = 6] = "ProposeAppAuthority";
|
|
2892
|
+
GuardianInstruction2[GuardianInstruction2["ProposeConfigAuthority"] = 7] = "ProposeConfigAuthority";
|
|
2893
|
+
GuardianInstruction2[GuardianInstruction2["ProposeRelease"] = 8] = "ProposeRelease";
|
|
2894
|
+
GuardianInstruction2[GuardianInstruction2["RegisterApp"] = 9] = "RegisterApp";
|
|
2895
|
+
GuardianInstruction2[GuardianInstruction2["RegisterGuardian"] = 10] = "RegisterGuardian";
|
|
2896
|
+
GuardianInstruction2[GuardianInstruction2["RemoveGuardian"] = 11] = "RemoveGuardian";
|
|
2897
|
+
GuardianInstruction2[GuardianInstruction2["RotateVoteAuthority"] = 12] = "RotateVoteAuthority";
|
|
2898
|
+
GuardianInstruction2[GuardianInstruction2["SetAppDeveloper"] = 13] = "SetAppDeveloper";
|
|
2899
|
+
GuardianInstruction2[GuardianInstruction2["UpdateConfig"] = 14] = "UpdateConfig";
|
|
2900
|
+
GuardianInstruction2[GuardianInstruction2["Vote"] = 15] = "Vote";
|
|
2901
|
+
GuardianInstruction2[GuardianInstruction2["WriteReleaseManifest"] = 16] = "WriteReleaseManifest";
|
|
2902
|
+
return GuardianInstruction2;
|
|
2903
|
+
})(GuardianInstruction || {});
|
|
2904
|
+
function identifyGuardianInstruction(instruction) {
|
|
2905
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
2906
|
+
if (containsBytes(
|
|
2907
|
+
data,
|
|
2908
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([227, 109, 248, 178, 27, 2, 126, 21])),
|
|
2909
|
+
0
|
|
2910
|
+
)) {
|
|
2911
|
+
return 0 /* AcceptAppAuthority */;
|
|
2912
|
+
}
|
|
2913
|
+
if (containsBytes(
|
|
2914
|
+
data,
|
|
2915
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([138, 34, 130, 16, 252, 207, 24, 90])),
|
|
2916
|
+
0
|
|
2917
|
+
)) {
|
|
2918
|
+
return 1 /* AcceptConfigAuthority */;
|
|
2919
|
+
}
|
|
2920
|
+
if (containsBytes(
|
|
2921
|
+
data,
|
|
2922
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([167, 189, 170, 27, 74, 240, 201, 241])),
|
|
2923
|
+
0
|
|
2924
|
+
)) {
|
|
2925
|
+
return 2 /* AddGuardian */;
|
|
2926
|
+
}
|
|
2927
|
+
if (containsBytes(
|
|
2928
|
+
data,
|
|
2929
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([109, 170, 172, 190, 125, 251, 1, 66])),
|
|
2930
|
+
0
|
|
2931
|
+
)) {
|
|
2932
|
+
return 3 /* CancelRelease */;
|
|
2933
|
+
}
|
|
2934
|
+
if (containsBytes(
|
|
2935
|
+
data,
|
|
2936
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([174, 239, 151, 37, 202, 177, 207, 99])),
|
|
2937
|
+
0
|
|
2938
|
+
)) {
|
|
2939
|
+
return 4 /* ExpireRelease */;
|
|
2940
|
+
}
|
|
2941
|
+
if (containsBytes(
|
|
2942
|
+
data,
|
|
2943
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70])),
|
|
2944
|
+
0
|
|
2945
|
+
)) {
|
|
2946
|
+
return 5 /* InitializeConfig */;
|
|
2947
|
+
}
|
|
2948
|
+
if (containsBytes(
|
|
2949
|
+
data,
|
|
2950
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([147, 62, 16, 95, 39, 187, 25, 15])),
|
|
2951
|
+
0
|
|
2952
|
+
)) {
|
|
2953
|
+
return 6 /* ProposeAppAuthority */;
|
|
2954
|
+
}
|
|
2955
|
+
if (containsBytes(
|
|
2956
|
+
data,
|
|
2957
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([31, 229, 9, 231, 45, 153, 123, 235])),
|
|
2958
|
+
0
|
|
2959
|
+
)) {
|
|
2960
|
+
return 7 /* ProposeConfigAuthority */;
|
|
2961
|
+
}
|
|
2962
|
+
if (containsBytes(
|
|
2963
|
+
data,
|
|
2964
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([156, 43, 186, 24, 116, 44, 17, 71])),
|
|
2965
|
+
0
|
|
2966
|
+
)) {
|
|
2967
|
+
return 8 /* ProposeRelease */;
|
|
2968
|
+
}
|
|
2969
|
+
if (containsBytes(
|
|
2970
|
+
data,
|
|
2971
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([5, 248, 20, 126, 12, 159, 9, 242])),
|
|
2972
|
+
0
|
|
2973
|
+
)) {
|
|
2974
|
+
return 9 /* RegisterApp */;
|
|
2975
|
+
}
|
|
2976
|
+
if (containsBytes(
|
|
2977
|
+
data,
|
|
2978
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([21, 206, 243, 116, 97, 100, 230, 59])),
|
|
2979
|
+
0
|
|
2980
|
+
)) {
|
|
2981
|
+
return 10 /* RegisterGuardian */;
|
|
2982
|
+
}
|
|
2983
|
+
if (containsBytes(
|
|
2984
|
+
data,
|
|
2985
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([72, 117, 160, 244, 155, 185, 71, 18])),
|
|
2986
|
+
0
|
|
2987
|
+
)) {
|
|
2988
|
+
return 11 /* RemoveGuardian */;
|
|
2989
|
+
}
|
|
2990
|
+
if (containsBytes(
|
|
2991
|
+
data,
|
|
2992
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([153, 199, 84, 126, 148, 220, 80, 34])),
|
|
2993
|
+
0
|
|
2994
|
+
)) {
|
|
2995
|
+
return 12 /* RotateVoteAuthority */;
|
|
2996
|
+
}
|
|
2997
|
+
if (containsBytes(
|
|
2998
|
+
data,
|
|
2999
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([53, 1, 26, 238, 175, 84, 152, 48])),
|
|
3000
|
+
0
|
|
3001
|
+
)) {
|
|
3002
|
+
return 13 /* SetAppDeveloper */;
|
|
3003
|
+
}
|
|
3004
|
+
if (containsBytes(
|
|
3005
|
+
data,
|
|
3006
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([29, 158, 252, 191, 10, 83, 219, 99])),
|
|
3007
|
+
0
|
|
3008
|
+
)) {
|
|
3009
|
+
return 14 /* UpdateConfig */;
|
|
3010
|
+
}
|
|
3011
|
+
if (containsBytes(
|
|
3012
|
+
data,
|
|
3013
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([227, 110, 155, 23, 136, 126, 172, 25])),
|
|
3014
|
+
0
|
|
3015
|
+
)) {
|
|
3016
|
+
return 15 /* Vote */;
|
|
3017
|
+
}
|
|
3018
|
+
if (containsBytes(
|
|
3019
|
+
data,
|
|
3020
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([98, 30, 102, 216, 54, 58, 138, 114])),
|
|
3021
|
+
0
|
|
3022
|
+
)) {
|
|
3023
|
+
return 16 /* WriteReleaseManifest */;
|
|
3024
|
+
}
|
|
3025
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
3026
|
+
instructionData: data,
|
|
3027
|
+
programName: "guardian"
|
|
3028
|
+
});
|
|
3029
|
+
}
|
|
3030
|
+
function parseGuardianInstruction(instruction) {
|
|
3031
|
+
const instructionType = identifyGuardianInstruction(instruction);
|
|
3032
|
+
switch (instructionType) {
|
|
3033
|
+
case 0 /* AcceptAppAuthority */: {
|
|
3034
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3035
|
+
return {
|
|
3036
|
+
instructionType: 0 /* AcceptAppAuthority */,
|
|
3037
|
+
...parseAcceptAppAuthorityInstruction(instruction)
|
|
3038
|
+
};
|
|
3039
|
+
}
|
|
3040
|
+
case 1 /* AcceptConfigAuthority */: {
|
|
3041
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3042
|
+
return {
|
|
3043
|
+
instructionType: 1 /* AcceptConfigAuthority */,
|
|
3044
|
+
...parseAcceptConfigAuthorityInstruction(instruction)
|
|
3045
|
+
};
|
|
3046
|
+
}
|
|
3047
|
+
case 2 /* AddGuardian */: {
|
|
3048
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3049
|
+
return { instructionType: 2 /* AddGuardian */, ...parseAddGuardianInstruction(instruction) };
|
|
3050
|
+
}
|
|
3051
|
+
case 3 /* CancelRelease */: {
|
|
3052
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3053
|
+
return {
|
|
3054
|
+
instructionType: 3 /* CancelRelease */,
|
|
3055
|
+
...parseCancelReleaseInstruction(instruction)
|
|
3056
|
+
};
|
|
3057
|
+
}
|
|
3058
|
+
case 4 /* ExpireRelease */: {
|
|
3059
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3060
|
+
return {
|
|
3061
|
+
instructionType: 4 /* ExpireRelease */,
|
|
3062
|
+
...parseExpireReleaseInstruction(instruction)
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
case 5 /* InitializeConfig */: {
|
|
3066
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3067
|
+
return {
|
|
3068
|
+
instructionType: 5 /* InitializeConfig */,
|
|
3069
|
+
...parseInitializeConfigInstruction(instruction)
|
|
3070
|
+
};
|
|
3071
|
+
}
|
|
3072
|
+
case 6 /* ProposeAppAuthority */: {
|
|
3073
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3074
|
+
return {
|
|
3075
|
+
instructionType: 6 /* ProposeAppAuthority */,
|
|
3076
|
+
...parseProposeAppAuthorityInstruction(instruction)
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3079
|
+
case 7 /* ProposeConfigAuthority */: {
|
|
3080
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3081
|
+
return {
|
|
3082
|
+
instructionType: 7 /* ProposeConfigAuthority */,
|
|
3083
|
+
...parseProposeConfigAuthorityInstruction(instruction)
|
|
3084
|
+
};
|
|
3085
|
+
}
|
|
3086
|
+
case 8 /* ProposeRelease */: {
|
|
3087
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3088
|
+
return {
|
|
3089
|
+
instructionType: 8 /* ProposeRelease */,
|
|
3090
|
+
...parseProposeReleaseInstruction(instruction)
|
|
3091
|
+
};
|
|
3092
|
+
}
|
|
3093
|
+
case 9 /* RegisterApp */: {
|
|
3094
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3095
|
+
return { instructionType: 9 /* RegisterApp */, ...parseRegisterAppInstruction(instruction) };
|
|
3096
|
+
}
|
|
3097
|
+
case 10 /* RegisterGuardian */: {
|
|
3098
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3099
|
+
return {
|
|
3100
|
+
instructionType: 10 /* RegisterGuardian */,
|
|
3101
|
+
...parseRegisterGuardianInstruction(instruction)
|
|
3102
|
+
};
|
|
3103
|
+
}
|
|
3104
|
+
case 11 /* RemoveGuardian */: {
|
|
3105
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3106
|
+
return {
|
|
3107
|
+
instructionType: 11 /* RemoveGuardian */,
|
|
3108
|
+
...parseRemoveGuardianInstruction(instruction)
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
case 12 /* RotateVoteAuthority */: {
|
|
3112
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3113
|
+
return {
|
|
3114
|
+
instructionType: 12 /* RotateVoteAuthority */,
|
|
3115
|
+
...parseRotateVoteAuthorityInstruction(instruction)
|
|
3116
|
+
};
|
|
3117
|
+
}
|
|
3118
|
+
case 13 /* SetAppDeveloper */: {
|
|
3119
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3120
|
+
return {
|
|
3121
|
+
instructionType: 13 /* SetAppDeveloper */,
|
|
3122
|
+
...parseSetAppDeveloperInstruction(instruction)
|
|
3123
|
+
};
|
|
3124
|
+
}
|
|
3125
|
+
case 14 /* UpdateConfig */: {
|
|
3126
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3127
|
+
return { instructionType: 14 /* UpdateConfig */, ...parseUpdateConfigInstruction(instruction) };
|
|
3128
|
+
}
|
|
3129
|
+
case 15 /* Vote */: {
|
|
3130
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3131
|
+
return { instructionType: 15 /* Vote */, ...parseVoteInstruction(instruction) };
|
|
3132
|
+
}
|
|
3133
|
+
case 16 /* WriteReleaseManifest */: {
|
|
3134
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3135
|
+
return {
|
|
3136
|
+
instructionType: 16 /* WriteReleaseManifest */,
|
|
3137
|
+
...parseWriteReleaseManifestInstruction(instruction)
|
|
3138
|
+
};
|
|
3139
|
+
}
|
|
3140
|
+
default:
|
|
3141
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
3142
|
+
instructionType,
|
|
3143
|
+
programName: "guardian"
|
|
3144
|
+
});
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
function guardianProgram(config = {}) {
|
|
3148
|
+
return (client) => {
|
|
3149
|
+
return extendClient(client, {
|
|
3150
|
+
guardian: {
|
|
3151
|
+
accounts: {
|
|
3152
|
+
appAccount: addSelfFetchFunctions(client, getAppAccountCodec()),
|
|
3153
|
+
guardiansConfig: addSelfFetchFunctions(client, getGuardiansConfigCodec()),
|
|
3154
|
+
pendingRegistry: addSelfFetchFunctions(client, getPendingRegistryCodec())
|
|
3155
|
+
},
|
|
3156
|
+
instructions: {
|
|
3157
|
+
acceptAppAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3158
|
+
client,
|
|
3159
|
+
getAcceptAppAuthorityInstructionAsync(input, {
|
|
3160
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3161
|
+
})
|
|
3162
|
+
),
|
|
3163
|
+
acceptConfigAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3164
|
+
client,
|
|
3165
|
+
getAcceptConfigAuthorityInstructionAsync(input, {
|
|
3166
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3167
|
+
})
|
|
3168
|
+
),
|
|
3169
|
+
addGuardian: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3170
|
+
client,
|
|
3171
|
+
getAddGuardianInstructionAsync(input, {
|
|
3172
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3173
|
+
})
|
|
3174
|
+
),
|
|
3175
|
+
cancelRelease: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3176
|
+
client,
|
|
3177
|
+
getCancelReleaseInstructionAsync(input, {
|
|
3178
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3179
|
+
})
|
|
3180
|
+
),
|
|
3181
|
+
expireRelease: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3182
|
+
client,
|
|
3183
|
+
getExpireReleaseInstructionAsync(input, {
|
|
3184
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3185
|
+
})
|
|
3186
|
+
),
|
|
3187
|
+
initializeConfig: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3188
|
+
client,
|
|
3189
|
+
getInitializeConfigInstructionAsync(input, {
|
|
3190
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3191
|
+
})
|
|
3192
|
+
),
|
|
3193
|
+
proposeAppAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3194
|
+
client,
|
|
3195
|
+
getProposeAppAuthorityInstructionAsync(input, {
|
|
3196
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3197
|
+
})
|
|
3198
|
+
),
|
|
3199
|
+
proposeConfigAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3200
|
+
client,
|
|
3201
|
+
getProposeConfigAuthorityInstructionAsync(input, {
|
|
3202
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3203
|
+
})
|
|
3204
|
+
),
|
|
3205
|
+
proposeRelease: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3206
|
+
client,
|
|
3207
|
+
getProposeReleaseInstructionAsync(input, {
|
|
3208
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3209
|
+
})
|
|
3210
|
+
),
|
|
3211
|
+
registerApp: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3212
|
+
client,
|
|
3213
|
+
getRegisterAppInstructionAsync(input, {
|
|
3214
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3215
|
+
})
|
|
3216
|
+
),
|
|
3217
|
+
registerGuardian: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3218
|
+
client,
|
|
3219
|
+
getRegisterGuardianInstructionAsync(input, {
|
|
3220
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3221
|
+
})
|
|
3222
|
+
),
|
|
3223
|
+
removeGuardian: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3224
|
+
client,
|
|
3225
|
+
getRemoveGuardianInstructionAsync(input, {
|
|
3226
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3227
|
+
})
|
|
3228
|
+
),
|
|
3229
|
+
rotateVoteAuthority: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3230
|
+
client,
|
|
3231
|
+
getRotateVoteAuthorityInstructionAsync(input, {
|
|
3232
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3233
|
+
})
|
|
3234
|
+
),
|
|
3235
|
+
setAppDeveloper: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3236
|
+
client,
|
|
3237
|
+
getSetAppDeveloperInstructionAsync(input, {
|
|
3238
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3239
|
+
})
|
|
3240
|
+
),
|
|
3241
|
+
updateConfig: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3242
|
+
client,
|
|
3243
|
+
getUpdateConfigInstructionAsync(input, {
|
|
3244
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3245
|
+
})
|
|
3246
|
+
),
|
|
3247
|
+
vote: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3248
|
+
client,
|
|
3249
|
+
getVoteInstructionAsync(input, {
|
|
3250
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3251
|
+
})
|
|
3252
|
+
),
|
|
3253
|
+
writeReleaseManifest: (input, instructionConfig) => addSelfPlanAndSendFunctions(
|
|
3254
|
+
client,
|
|
3255
|
+
getWriteReleaseManifestInstructionAsync(input, {
|
|
3256
|
+
programAddress: instructionConfig?.programAddress ?? config.programAddress
|
|
3257
|
+
})
|
|
3258
|
+
)
|
|
3259
|
+
},
|
|
3260
|
+
pdas: {
|
|
3261
|
+
guardiansConfig: (pdaConfig) => findGuardiansConfigPda({ programAddress: pdaConfig?.programAddress ?? config.programAddress }),
|
|
3262
|
+
pendingRegistry: (pdaConfig) => findPendingRegistryPda({ programAddress: pdaConfig?.programAddress ?? config.programAddress }),
|
|
3263
|
+
bondVault: (pdaConfig) => findBondVaultPda({ programAddress: pdaConfig?.programAddress ?? config.programAddress })
|
|
3264
|
+
},
|
|
3265
|
+
identifyAccount: identifyGuardianAccount,
|
|
3266
|
+
identifyInstruction: identifyGuardianInstruction,
|
|
3267
|
+
parseInstruction: parseGuardianInstruction
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
// src/generated/errors/guardian.ts
|
|
3274
|
+
var GUARDIAN_ERROR__INCORRECT_AUTHORITY = 6e3;
|
|
3275
|
+
var GUARDIAN_ERROR__INVALID_GUARDIAN = 6001;
|
|
3276
|
+
var GUARDIAN_ERROR__UNAUTHORIZED_VOTE_AUTHORITY = 6002;
|
|
3277
|
+
var GUARDIAN_ERROR__GUARDIAN_NOT_PENDING = 6003;
|
|
3278
|
+
var GUARDIAN_ERROR__KEY_IN_USE = 6004;
|
|
3279
|
+
var GUARDIAN_ERROR__INCORRECT_BOND_DESTINATION = 6005;
|
|
3280
|
+
var GUARDIAN_ERROR__RELEASE_ALREADY_PENDING = 6006;
|
|
3281
|
+
var GUARDIAN_ERROR__NO_PENDING_RELEASE = 6007;
|
|
3282
|
+
var GUARDIAN_ERROR__RELEASE_NOT_FINALIZED = 6008;
|
|
3283
|
+
var GUARDIAN_ERROR__CANNOT_CANCEL_RESOLVED_RELEASE = 6009;
|
|
3284
|
+
var GUARDIAN_ERROR__VERSION_CODE_MISMATCH = 6010;
|
|
3285
|
+
var GUARDIAN_ERROR__VERSION_CODE_NOT_INCREASING = 6011;
|
|
3286
|
+
var GUARDIAN_ERROR__MANIFEST_HASH_MISMATCH = 6012;
|
|
3287
|
+
var GUARDIAN_ERROR__MANIFEST_TOO_LARGE = 6013;
|
|
3288
|
+
var GUARDIAN_ERROR__VOTE_FINDINGS_TOO_LARGE = 6014;
|
|
3289
|
+
var GUARDIAN_ERROR__POLICY_BUNDLE_NOT_ATTESTED = 6015;
|
|
3290
|
+
var GUARDIAN_ERROR__POLICY_BUNDLE_MISMATCH = 6016;
|
|
3291
|
+
var GUARDIAN_ERROR__INVALID_POLICY_BUNDLE_HASH = 6017;
|
|
3292
|
+
var GUARDIAN_ERROR__VOTE_WINDOW_OPEN = 6018;
|
|
3293
|
+
var GUARDIAN_ERROR__VOTE_WINDOW_CLOSED = 6019;
|
|
3294
|
+
var GUARDIAN_ERROR__ALREADY_VOTED = 6020;
|
|
3295
|
+
var GUARDIAN_ERROR__GUARDIAN_SET_CHANGED_SINCE_QUORUM = 6021;
|
|
3296
|
+
var GUARDIAN_ERROR__TOO_MANY_GUARDIANS = 6022;
|
|
3297
|
+
var GUARDIAN_ERROR__OVERFLOW = 6023;
|
|
3298
|
+
var GUARDIAN_ERROR__INVALID_VOTING_PERIOD = 6024;
|
|
3299
|
+
var GUARDIAN_ERROR__NO_PENDING_CONFIG_AUTHORITY = 6025;
|
|
3300
|
+
var GUARDIAN_ERROR__INCORRECT_PENDING_CONFIG_AUTHORITY = 6026;
|
|
3301
|
+
var GUARDIAN_ERROR__VOTING_DEADLINE_PASSED = 6027;
|
|
3302
|
+
var GUARDIAN_ERROR__RELEASE_NOT_EXPIRED = 6028;
|
|
3303
|
+
var GUARDIAN_ERROR__VERSION_CODE_TOO_LARGE = 6029;
|
|
3304
|
+
var GUARDIAN_ERROR__FUNDER_NOT_WALLET = 6030;
|
|
3305
|
+
var GUARDIAN_ERROR__TOO_MANY_DEVELOPERS = 6031;
|
|
3306
|
+
var GUARDIAN_ERROR__CERTIFICATE_NOT_SET = 6032;
|
|
3307
|
+
var GUARDIAN_ERROR__MANIFEST_LENGTH_MISMATCH = 6033;
|
|
3308
|
+
var GUARDIAN_ERROR__MANIFEST_WRITE_OUT_OF_BOUNDS = 6034;
|
|
3309
|
+
var GUARDIAN_ERROR__NO_PENDING_APP_AUTHORITY = 6035;
|
|
3310
|
+
var GUARDIAN_ERROR__INCORRECT_PENDING_APP_AUTHORITY = 6036;
|
|
3311
|
+
var guardianErrorMessages;
|
|
3312
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
3313
|
+
guardianErrorMessages = {
|
|
3314
|
+
[GUARDIAN_ERROR__ALREADY_VOTED]: `This guardian already voted on the resolved release`,
|
|
3315
|
+
[GUARDIAN_ERROR__CANNOT_CANCEL_RESOLVED_RELEASE]: `The release has resolved and can no longer be cancelled`,
|
|
3316
|
+
[GUARDIAN_ERROR__CERTIFICATE_NOT_SET]: `The release has no signing certificate, so it cannot be finalized`,
|
|
3317
|
+
[GUARDIAN_ERROR__FUNDER_NOT_WALLET]: `The funder must be a wallet owned by the System Program`,
|
|
3318
|
+
[GUARDIAN_ERROR__GUARDIAN_NOT_PENDING]: `Guardian has not been admitted as pending`,
|
|
3319
|
+
[GUARDIAN_ERROR__GUARDIAN_SET_CHANGED_SINCE_QUORUM]: `The guardian set changed after this release resolved, so it takes no late votes`,
|
|
3320
|
+
[GUARDIAN_ERROR__INCORRECT_AUTHORITY]: `Incorrect authority`,
|
|
3321
|
+
[GUARDIAN_ERROR__INCORRECT_BOND_DESTINATION]: `Bond refund destination is not owned by the guardian`,
|
|
3322
|
+
[GUARDIAN_ERROR__INCORRECT_PENDING_APP_AUTHORITY]: `Signer is not the pending app authority`,
|
|
3323
|
+
[GUARDIAN_ERROR__INCORRECT_PENDING_CONFIG_AUTHORITY]: `Signer is not the pending config authority`,
|
|
3324
|
+
[GUARDIAN_ERROR__INVALID_GUARDIAN]: `Provided guardian is not in the guardian set`,
|
|
3325
|
+
[GUARDIAN_ERROR__INVALID_POLICY_BUNDLE_HASH]: `Policy bundle hash must be non-zero`,
|
|
3326
|
+
[GUARDIAN_ERROR__INVALID_VOTING_PERIOD]: `The voting period must be at least one second`,
|
|
3327
|
+
[GUARDIAN_ERROR__KEY_IN_USE]: `Key already belongs to a guardian, a pending guardian, or a vote authority`,
|
|
3328
|
+
[GUARDIAN_ERROR__MANIFEST_HASH_MISMATCH]: `The manifest hash does not match the pending release`,
|
|
3329
|
+
[GUARDIAN_ERROR__MANIFEST_LENGTH_MISMATCH]: `The manifest length differs from the upload in progress`,
|
|
3330
|
+
[GUARDIAN_ERROR__MANIFEST_TOO_LARGE]: `Manifest exceeds the maximum length`,
|
|
3331
|
+
[GUARDIAN_ERROR__MANIFEST_WRITE_OUT_OF_BOUNDS]: `The chunk ends past the manifest buffer`,
|
|
3332
|
+
[GUARDIAN_ERROR__NO_PENDING_APP_AUTHORITY]: `No app authority transfer is pending`,
|
|
3333
|
+
[GUARDIAN_ERROR__NO_PENDING_CONFIG_AUTHORITY]: `No config authority transfer is pending`,
|
|
3334
|
+
[GUARDIAN_ERROR__NO_PENDING_RELEASE]: `No release is pending for this app`,
|
|
3335
|
+
[GUARDIAN_ERROR__OVERFLOW]: `Arithmetic overflow`,
|
|
3336
|
+
[GUARDIAN_ERROR__POLICY_BUNDLE_MISMATCH]: `Vote names a different policy bundle than the pending release was finalized under`,
|
|
3337
|
+
[GUARDIAN_ERROR__POLICY_BUNDLE_NOT_ATTESTED]: `The config has no policy bundle hash set, so a release cannot be finalized`,
|
|
3338
|
+
[GUARDIAN_ERROR__RELEASE_ALREADY_PENDING]: `A finalized release is already pending for this app`,
|
|
3339
|
+
[GUARDIAN_ERROR__RELEASE_NOT_EXPIRED]: `The release has not expired`,
|
|
3340
|
+
[GUARDIAN_ERROR__RELEASE_NOT_FINALIZED]: `The pending release upload is not finalized yet`,
|
|
3341
|
+
[GUARDIAN_ERROR__TOO_MANY_DEVELOPERS]: `The app already lists the most developer keys allowed`,
|
|
3342
|
+
[GUARDIAN_ERROR__TOO_MANY_GUARDIANS]: `The guardian set is full`,
|
|
3343
|
+
[GUARDIAN_ERROR__UNAUTHORIZED_VOTE_AUTHORITY]: `Signer is not a registered vote authority`,
|
|
3344
|
+
[GUARDIAN_ERROR__VERSION_CODE_MISMATCH]: `Uploaded chunk or vote targets a different version code than the pending one`,
|
|
3345
|
+
[GUARDIAN_ERROR__VERSION_CODE_NOT_INCREASING]: `Version code must exceed the app's last resolved version code`,
|
|
3346
|
+
[GUARDIAN_ERROR__VERSION_CODE_TOO_LARGE]: `The version code is above Android's maximum`,
|
|
3347
|
+
[GUARDIAN_ERROR__VOTE_FINDINGS_TOO_LARGE]: `Vote findings exceed the maximum encoded length`,
|
|
3348
|
+
[GUARDIAN_ERROR__VOTE_WINDOW_CLOSED]: `The vote window of this resolved release has closed`,
|
|
3349
|
+
[GUARDIAN_ERROR__VOTE_WINDOW_OPEN]: `The last resolved release is still taking late votes; propose once its vote window closes, every guardian has voted, or the guardian set changes`,
|
|
3350
|
+
[GUARDIAN_ERROR__VOTING_DEADLINE_PASSED]: `The release's voting deadline has passed`
|
|
3351
|
+
};
|
|
3352
|
+
}
|
|
3353
|
+
function getGuardianErrorMessage(code) {
|
|
3354
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
3355
|
+
return guardianErrorMessages[code];
|
|
3356
|
+
}
|
|
3357
|
+
return "Error message not available in production bundles.";
|
|
3358
|
+
}
|
|
3359
|
+
function isGuardianError(error, transactionMessage, code, config = {}) {
|
|
3360
|
+
const programAddressInput = config.programAddress ?? GUARDIAN_PROGRAM_ADDRESS;
|
|
3361
|
+
const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
|
|
3362
|
+
return isProgramError(error, transactionMessage, programAddress, code);
|
|
3363
|
+
}
|
|
3364
|
+
var APP_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3365
|
+
216,
|
|
3366
|
+
100,
|
|
3367
|
+
38,
|
|
3368
|
+
168,
|
|
3369
|
+
184,
|
|
3370
|
+
157,
|
|
3371
|
+
141,
|
|
3372
|
+
247
|
|
3373
|
+
]);
|
|
3374
|
+
function getAppAuthorityAcceptedEventDiscriminatorBytes() {
|
|
3375
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(APP_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR);
|
|
3376
|
+
}
|
|
3377
|
+
function getAppAuthorityAcceptedEventEncoder() {
|
|
3378
|
+
return getHiddenPrefixEncoder(
|
|
3379
|
+
getStructEncoder([
|
|
3380
|
+
["version", getU8Encoder()],
|
|
3381
|
+
["seq", getU64Encoder()],
|
|
3382
|
+
["app", getAddressEncoder()],
|
|
3383
|
+
["oldAuthority", getAddressEncoder()],
|
|
3384
|
+
["newAuthority", getAddressEncoder()]
|
|
3385
|
+
]),
|
|
3386
|
+
[getConstantEncoder(APP_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR)]
|
|
3387
|
+
);
|
|
3388
|
+
}
|
|
3389
|
+
function getAppAuthorityAcceptedEventDecoder() {
|
|
3390
|
+
return getHiddenPrefixDecoder(
|
|
3391
|
+
getStructDecoder([
|
|
3392
|
+
["version", getU8Decoder()],
|
|
3393
|
+
["seq", getU64Decoder()],
|
|
3394
|
+
["app", getAddressDecoder()],
|
|
3395
|
+
["oldAuthority", getAddressDecoder()],
|
|
3396
|
+
["newAuthority", getAddressDecoder()]
|
|
3397
|
+
]),
|
|
3398
|
+
[getConstantDecoder(APP_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR)]
|
|
3399
|
+
);
|
|
3400
|
+
}
|
|
3401
|
+
function getAppAuthorityAcceptedEventCodec() {
|
|
3402
|
+
return combineCodec(getAppAuthorityAcceptedEventEncoder(), getAppAuthorityAcceptedEventDecoder());
|
|
3403
|
+
}
|
|
3404
|
+
function parseAppAuthorityAcceptedEvent(data) {
|
|
3405
|
+
if (containsBytes(data, APP_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR, 0)) {
|
|
3406
|
+
return getAppAuthorityAcceptedEventDecoder().decode(data);
|
|
3407
|
+
}
|
|
3408
|
+
throw new Error('The provided data does not match the "AppAuthorityAcceptedEvent" event discriminators.');
|
|
3409
|
+
}
|
|
3410
|
+
var APP_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3411
|
+
17,
|
|
3412
|
+
143,
|
|
3413
|
+
174,
|
|
3414
|
+
4,
|
|
3415
|
+
147,
|
|
3416
|
+
110,
|
|
3417
|
+
126,
|
|
3418
|
+
84
|
|
3419
|
+
]);
|
|
3420
|
+
function getAppAuthorityProposedEventDiscriminatorBytes() {
|
|
3421
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(APP_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR);
|
|
3422
|
+
}
|
|
3423
|
+
function getAppAuthorityProposedEventEncoder() {
|
|
3424
|
+
return getHiddenPrefixEncoder(
|
|
3425
|
+
getStructEncoder([
|
|
3426
|
+
["version", getU8Encoder()],
|
|
3427
|
+
["seq", getU64Encoder()],
|
|
3428
|
+
["app", getAddressEncoder()],
|
|
3429
|
+
["authority", getAddressEncoder()],
|
|
3430
|
+
["proposed", getAddressEncoder()]
|
|
3431
|
+
]),
|
|
3432
|
+
[getConstantEncoder(APP_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR)]
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3435
|
+
function getAppAuthorityProposedEventDecoder() {
|
|
3436
|
+
return getHiddenPrefixDecoder(
|
|
3437
|
+
getStructDecoder([
|
|
3438
|
+
["version", getU8Decoder()],
|
|
3439
|
+
["seq", getU64Decoder()],
|
|
3440
|
+
["app", getAddressDecoder()],
|
|
3441
|
+
["authority", getAddressDecoder()],
|
|
3442
|
+
["proposed", getAddressDecoder()]
|
|
3443
|
+
]),
|
|
3444
|
+
[getConstantDecoder(APP_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR)]
|
|
3445
|
+
);
|
|
3446
|
+
}
|
|
3447
|
+
function getAppAuthorityProposedEventCodec() {
|
|
3448
|
+
return combineCodec(getAppAuthorityProposedEventEncoder(), getAppAuthorityProposedEventDecoder());
|
|
3449
|
+
}
|
|
3450
|
+
function parseAppAuthorityProposedEvent(data) {
|
|
3451
|
+
if (containsBytes(data, APP_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR, 0)) {
|
|
3452
|
+
return getAppAuthorityProposedEventDecoder().decode(data);
|
|
3453
|
+
}
|
|
3454
|
+
throw new Error('The provided data does not match the "AppAuthorityProposedEvent" event discriminators.');
|
|
3455
|
+
}
|
|
3456
|
+
var APP_DEVELOPER_UPDATED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3457
|
+
132,
|
|
3458
|
+
135,
|
|
3459
|
+
205,
|
|
3460
|
+
60,
|
|
3461
|
+
48,
|
|
3462
|
+
208,
|
|
3463
|
+
44,
|
|
3464
|
+
171
|
|
3465
|
+
]);
|
|
3466
|
+
function getAppDeveloperUpdatedEventDiscriminatorBytes() {
|
|
3467
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(APP_DEVELOPER_UPDATED_EVENT_DISCRIMINATOR);
|
|
3468
|
+
}
|
|
3469
|
+
function getAppDeveloperUpdatedEventEncoder() {
|
|
3470
|
+
return getHiddenPrefixEncoder(
|
|
3471
|
+
getStructEncoder([
|
|
3472
|
+
["version", getU8Encoder()],
|
|
3473
|
+
["seq", getU64Encoder()],
|
|
3474
|
+
["app", getAddressEncoder()],
|
|
3475
|
+
["developer", getAddressEncoder()],
|
|
3476
|
+
["allowed", getBooleanEncoder()]
|
|
3477
|
+
]),
|
|
3478
|
+
[getConstantEncoder(APP_DEVELOPER_UPDATED_EVENT_DISCRIMINATOR)]
|
|
3479
|
+
);
|
|
3480
|
+
}
|
|
3481
|
+
function getAppDeveloperUpdatedEventDecoder() {
|
|
3482
|
+
return getHiddenPrefixDecoder(
|
|
3483
|
+
getStructDecoder([
|
|
3484
|
+
["version", getU8Decoder()],
|
|
3485
|
+
["seq", getU64Decoder()],
|
|
3486
|
+
["app", getAddressDecoder()],
|
|
3487
|
+
["developer", getAddressDecoder()],
|
|
3488
|
+
["allowed", getBooleanDecoder()]
|
|
3489
|
+
]),
|
|
3490
|
+
[getConstantDecoder(APP_DEVELOPER_UPDATED_EVENT_DISCRIMINATOR)]
|
|
3491
|
+
);
|
|
3492
|
+
}
|
|
3493
|
+
function getAppDeveloperUpdatedEventCodec() {
|
|
3494
|
+
return combineCodec(getAppDeveloperUpdatedEventEncoder(), getAppDeveloperUpdatedEventDecoder());
|
|
3495
|
+
}
|
|
3496
|
+
function parseAppDeveloperUpdatedEvent(data) {
|
|
3497
|
+
if (containsBytes(data, APP_DEVELOPER_UPDATED_EVENT_DISCRIMINATOR, 0)) {
|
|
3498
|
+
return getAppDeveloperUpdatedEventDecoder().decode(data);
|
|
3499
|
+
}
|
|
3500
|
+
throw new Error('The provided data does not match the "AppDeveloperUpdatedEvent" event discriminators.');
|
|
3501
|
+
}
|
|
3502
|
+
var APP_REGISTERED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3503
|
+
99,
|
|
3504
|
+
12,
|
|
3505
|
+
19,
|
|
3506
|
+
34,
|
|
3507
|
+
85,
|
|
3508
|
+
60,
|
|
3509
|
+
170,
|
|
3510
|
+
229
|
|
3511
|
+
]);
|
|
3512
|
+
function getAppRegisteredEventDiscriminatorBytes() {
|
|
3513
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(APP_REGISTERED_EVENT_DISCRIMINATOR);
|
|
3514
|
+
}
|
|
3515
|
+
function getAppRegisteredEventEncoder() {
|
|
3516
|
+
return getHiddenPrefixEncoder(
|
|
3517
|
+
getStructEncoder([
|
|
3518
|
+
["version", getU8Encoder()],
|
|
3519
|
+
["seq", getU64Encoder()],
|
|
3520
|
+
["app", getAddressEncoder()],
|
|
3521
|
+
["authority", getAddressEncoder()],
|
|
3522
|
+
["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
3523
|
+
]),
|
|
3524
|
+
[getConstantEncoder(APP_REGISTERED_EVENT_DISCRIMINATOR)]
|
|
3525
|
+
);
|
|
3526
|
+
}
|
|
3527
|
+
function getAppRegisteredEventDecoder() {
|
|
3528
|
+
return getHiddenPrefixDecoder(
|
|
3529
|
+
getStructDecoder([
|
|
3530
|
+
["version", getU8Decoder()],
|
|
3531
|
+
["seq", getU64Decoder()],
|
|
3532
|
+
["app", getAddressDecoder()],
|
|
3533
|
+
["authority", getAddressDecoder()],
|
|
3534
|
+
["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())]
|
|
3535
|
+
]),
|
|
3536
|
+
[getConstantDecoder(APP_REGISTERED_EVENT_DISCRIMINATOR)]
|
|
3537
|
+
);
|
|
3538
|
+
}
|
|
3539
|
+
function getAppRegisteredEventCodec() {
|
|
3540
|
+
return combineCodec(getAppRegisteredEventEncoder(), getAppRegisteredEventDecoder());
|
|
3541
|
+
}
|
|
3542
|
+
function parseAppRegisteredEvent(data) {
|
|
3543
|
+
if (containsBytes(data, APP_REGISTERED_EVENT_DISCRIMINATOR, 0)) {
|
|
3544
|
+
return getAppRegisteredEventDecoder().decode(data);
|
|
3545
|
+
}
|
|
3546
|
+
throw new Error('The provided data does not match the "AppRegisteredEvent" event discriminators.');
|
|
3547
|
+
}
|
|
3548
|
+
var CONFIG_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3549
|
+
166,
|
|
3550
|
+
249,
|
|
3551
|
+
198,
|
|
3552
|
+
239,
|
|
3553
|
+
64,
|
|
3554
|
+
193,
|
|
3555
|
+
191,
|
|
3556
|
+
242
|
|
3557
|
+
]);
|
|
3558
|
+
function getConfigAuthorityAcceptedEventDiscriminatorBytes() {
|
|
3559
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CONFIG_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR);
|
|
3560
|
+
}
|
|
3561
|
+
function getConfigAuthorityAcceptedEventEncoder() {
|
|
3562
|
+
return getHiddenPrefixEncoder(
|
|
3563
|
+
getStructEncoder([
|
|
3564
|
+
["version", getU8Encoder()],
|
|
3565
|
+
["seq", getU64Encoder()],
|
|
3566
|
+
["oldAuthority", getAddressEncoder()],
|
|
3567
|
+
["newAuthority", getAddressEncoder()]
|
|
3568
|
+
]),
|
|
3569
|
+
[getConstantEncoder(CONFIG_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR)]
|
|
3570
|
+
);
|
|
3571
|
+
}
|
|
3572
|
+
function getConfigAuthorityAcceptedEventDecoder() {
|
|
3573
|
+
return getHiddenPrefixDecoder(
|
|
3574
|
+
getStructDecoder([
|
|
3575
|
+
["version", getU8Decoder()],
|
|
3576
|
+
["seq", getU64Decoder()],
|
|
3577
|
+
["oldAuthority", getAddressDecoder()],
|
|
3578
|
+
["newAuthority", getAddressDecoder()]
|
|
3579
|
+
]),
|
|
3580
|
+
[getConstantDecoder(CONFIG_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR)]
|
|
3581
|
+
);
|
|
3582
|
+
}
|
|
3583
|
+
function getConfigAuthorityAcceptedEventCodec() {
|
|
3584
|
+
return combineCodec(getConfigAuthorityAcceptedEventEncoder(), getConfigAuthorityAcceptedEventDecoder());
|
|
3585
|
+
}
|
|
3586
|
+
function parseConfigAuthorityAcceptedEvent(data) {
|
|
3587
|
+
if (containsBytes(data, CONFIG_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR, 0)) {
|
|
3588
|
+
return getConfigAuthorityAcceptedEventDecoder().decode(data);
|
|
3589
|
+
}
|
|
3590
|
+
throw new Error('The provided data does not match the "ConfigAuthorityAcceptedEvent" event discriminators.');
|
|
3591
|
+
}
|
|
3592
|
+
var CONFIG_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3593
|
+
125,
|
|
3594
|
+
29,
|
|
3595
|
+
33,
|
|
3596
|
+
186,
|
|
3597
|
+
153,
|
|
3598
|
+
16,
|
|
3599
|
+
155,
|
|
3600
|
+
229
|
|
3601
|
+
]);
|
|
3602
|
+
function getConfigAuthorityProposedEventDiscriminatorBytes() {
|
|
3603
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CONFIG_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR);
|
|
3604
|
+
}
|
|
3605
|
+
function getConfigAuthorityProposedEventEncoder() {
|
|
3606
|
+
return getHiddenPrefixEncoder(
|
|
3607
|
+
getStructEncoder([
|
|
3608
|
+
["version", getU8Encoder()],
|
|
3609
|
+
["seq", getU64Encoder()],
|
|
3610
|
+
["authority", getAddressEncoder()],
|
|
3611
|
+
["proposed", getAddressEncoder()]
|
|
3612
|
+
]),
|
|
3613
|
+
[getConstantEncoder(CONFIG_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR)]
|
|
3614
|
+
);
|
|
3615
|
+
}
|
|
3616
|
+
function getConfigAuthorityProposedEventDecoder() {
|
|
3617
|
+
return getHiddenPrefixDecoder(
|
|
3618
|
+
getStructDecoder([
|
|
3619
|
+
["version", getU8Decoder()],
|
|
3620
|
+
["seq", getU64Decoder()],
|
|
3621
|
+
["authority", getAddressDecoder()],
|
|
3622
|
+
["proposed", getAddressDecoder()]
|
|
3623
|
+
]),
|
|
3624
|
+
[getConstantDecoder(CONFIG_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR)]
|
|
3625
|
+
);
|
|
3626
|
+
}
|
|
3627
|
+
function getConfigAuthorityProposedEventCodec() {
|
|
3628
|
+
return combineCodec(getConfigAuthorityProposedEventEncoder(), getConfigAuthorityProposedEventDecoder());
|
|
3629
|
+
}
|
|
3630
|
+
function parseConfigAuthorityProposedEvent(data) {
|
|
3631
|
+
if (containsBytes(data, CONFIG_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR, 0)) {
|
|
3632
|
+
return getConfigAuthorityProposedEventDecoder().decode(data);
|
|
3633
|
+
}
|
|
3634
|
+
throw new Error('The provided data does not match the "ConfigAuthorityProposedEvent" event discriminators.');
|
|
3635
|
+
}
|
|
3636
|
+
var CONFIG_INITIALIZED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3637
|
+
181,
|
|
3638
|
+
49,
|
|
3639
|
+
200,
|
|
3640
|
+
156,
|
|
3641
|
+
19,
|
|
3642
|
+
167,
|
|
3643
|
+
178,
|
|
3644
|
+
91
|
|
3645
|
+
]);
|
|
3646
|
+
function getConfigInitializedEventDiscriminatorBytes() {
|
|
3647
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CONFIG_INITIALIZED_EVENT_DISCRIMINATOR);
|
|
3648
|
+
}
|
|
3649
|
+
function getConfigInitializedEventEncoder() {
|
|
3650
|
+
return getHiddenPrefixEncoder(
|
|
3651
|
+
getStructEncoder([
|
|
3652
|
+
["version", getU8Encoder()],
|
|
3653
|
+
["seq", getU64Encoder()],
|
|
3654
|
+
["authority", getAddressEncoder()],
|
|
3655
|
+
["bondMint", getAddressEncoder()],
|
|
3656
|
+
["voteWindow", getU32Encoder()],
|
|
3657
|
+
["votingPeriod", getU32Encoder()]
|
|
3658
|
+
]),
|
|
3659
|
+
[getConstantEncoder(CONFIG_INITIALIZED_EVENT_DISCRIMINATOR)]
|
|
3660
|
+
);
|
|
3661
|
+
}
|
|
3662
|
+
function getConfigInitializedEventDecoder() {
|
|
3663
|
+
return getHiddenPrefixDecoder(
|
|
3664
|
+
getStructDecoder([
|
|
3665
|
+
["version", getU8Decoder()],
|
|
3666
|
+
["seq", getU64Decoder()],
|
|
3667
|
+
["authority", getAddressDecoder()],
|
|
3668
|
+
["bondMint", getAddressDecoder()],
|
|
3669
|
+
["voteWindow", getU32Decoder()],
|
|
3670
|
+
["votingPeriod", getU32Decoder()]
|
|
3671
|
+
]),
|
|
3672
|
+
[getConstantDecoder(CONFIG_INITIALIZED_EVENT_DISCRIMINATOR)]
|
|
3673
|
+
);
|
|
3674
|
+
}
|
|
3675
|
+
function getConfigInitializedEventCodec() {
|
|
3676
|
+
return combineCodec(getConfigInitializedEventEncoder(), getConfigInitializedEventDecoder());
|
|
3677
|
+
}
|
|
3678
|
+
function parseConfigInitializedEvent(data) {
|
|
3679
|
+
if (containsBytes(data, CONFIG_INITIALIZED_EVENT_DISCRIMINATOR, 0)) {
|
|
3680
|
+
return getConfigInitializedEventDecoder().decode(data);
|
|
3681
|
+
}
|
|
3682
|
+
throw new Error('The provided data does not match the "ConfigInitializedEvent" event discriminators.');
|
|
3683
|
+
}
|
|
3684
|
+
var CONFIG_UPDATED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3685
|
+
40,
|
|
3686
|
+
241,
|
|
3687
|
+
230,
|
|
3688
|
+
122,
|
|
3689
|
+
11,
|
|
3690
|
+
19,
|
|
3691
|
+
198,
|
|
3692
|
+
194
|
|
3693
|
+
]);
|
|
3694
|
+
function getConfigUpdatedEventDiscriminatorBytes() {
|
|
3695
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CONFIG_UPDATED_EVENT_DISCRIMINATOR);
|
|
3696
|
+
}
|
|
3697
|
+
function getConfigUpdatedEventEncoder() {
|
|
3698
|
+
return getHiddenPrefixEncoder(
|
|
3699
|
+
getStructEncoder([
|
|
3700
|
+
["version", getU8Encoder()],
|
|
3701
|
+
["seq", getU64Encoder()],
|
|
3702
|
+
["bondAmount", getU64Encoder()],
|
|
3703
|
+
["policyBundleHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
3704
|
+
["voteWindow", getU32Encoder()],
|
|
3705
|
+
["votingPeriod", getU32Encoder()]
|
|
3706
|
+
]),
|
|
3707
|
+
[getConstantEncoder(CONFIG_UPDATED_EVENT_DISCRIMINATOR)]
|
|
3708
|
+
);
|
|
3709
|
+
}
|
|
3710
|
+
function getConfigUpdatedEventDecoder() {
|
|
3711
|
+
return getHiddenPrefixDecoder(
|
|
3712
|
+
getStructDecoder([
|
|
3713
|
+
["version", getU8Decoder()],
|
|
3714
|
+
["seq", getU64Decoder()],
|
|
3715
|
+
["bondAmount", getU64Decoder()],
|
|
3716
|
+
["policyBundleHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
3717
|
+
["voteWindow", getU32Decoder()],
|
|
3718
|
+
["votingPeriod", getU32Decoder()]
|
|
3719
|
+
]),
|
|
3720
|
+
[getConstantDecoder(CONFIG_UPDATED_EVENT_DISCRIMINATOR)]
|
|
3721
|
+
);
|
|
3722
|
+
}
|
|
3723
|
+
function getConfigUpdatedEventCodec() {
|
|
3724
|
+
return combineCodec(getConfigUpdatedEventEncoder(), getConfigUpdatedEventDecoder());
|
|
3725
|
+
}
|
|
3726
|
+
function parseConfigUpdatedEvent(data) {
|
|
3727
|
+
if (containsBytes(data, CONFIG_UPDATED_EVENT_DISCRIMINATOR, 0)) {
|
|
3728
|
+
return getConfigUpdatedEventDecoder().decode(data);
|
|
3729
|
+
}
|
|
3730
|
+
throw new Error('The provided data does not match the "ConfigUpdatedEvent" event discriminators.');
|
|
3731
|
+
}
|
|
3732
|
+
var GUARDIAN_ADDED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3733
|
+
151,
|
|
3734
|
+
0,
|
|
3735
|
+
228,
|
|
3736
|
+
5,
|
|
3737
|
+
239,
|
|
3738
|
+
58,
|
|
3739
|
+
162,
|
|
3740
|
+
18
|
|
3741
|
+
]);
|
|
3742
|
+
function getGuardianAddedEventDiscriminatorBytes() {
|
|
3743
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(GUARDIAN_ADDED_EVENT_DISCRIMINATOR);
|
|
3744
|
+
}
|
|
3745
|
+
function getGuardianAddedEventEncoder() {
|
|
3746
|
+
return getHiddenPrefixEncoder(
|
|
3747
|
+
getStructEncoder([
|
|
3748
|
+
["version", getU8Encoder()],
|
|
3749
|
+
["seq", getU64Encoder()],
|
|
3750
|
+
["guardian", getAddressEncoder()]
|
|
3751
|
+
]),
|
|
3752
|
+
[getConstantEncoder(GUARDIAN_ADDED_EVENT_DISCRIMINATOR)]
|
|
3753
|
+
);
|
|
3754
|
+
}
|
|
3755
|
+
function getGuardianAddedEventDecoder() {
|
|
3756
|
+
return getHiddenPrefixDecoder(
|
|
3757
|
+
getStructDecoder([
|
|
3758
|
+
["version", getU8Decoder()],
|
|
3759
|
+
["seq", getU64Decoder()],
|
|
3760
|
+
["guardian", getAddressDecoder()]
|
|
3761
|
+
]),
|
|
3762
|
+
[getConstantDecoder(GUARDIAN_ADDED_EVENT_DISCRIMINATOR)]
|
|
3763
|
+
);
|
|
3764
|
+
}
|
|
3765
|
+
function getGuardianAddedEventCodec() {
|
|
3766
|
+
return combineCodec(getGuardianAddedEventEncoder(), getGuardianAddedEventDecoder());
|
|
3767
|
+
}
|
|
3768
|
+
function parseGuardianAddedEvent(data) {
|
|
3769
|
+
if (containsBytes(data, GUARDIAN_ADDED_EVENT_DISCRIMINATOR, 0)) {
|
|
3770
|
+
return getGuardianAddedEventDecoder().decode(data);
|
|
3771
|
+
}
|
|
3772
|
+
throw new Error('The provided data does not match the "GuardianAddedEvent" event discriminators.');
|
|
3773
|
+
}
|
|
3774
|
+
var GUARDIAN_REGISTERED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3775
|
+
255,
|
|
3776
|
+
23,
|
|
3777
|
+
109,
|
|
3778
|
+
119,
|
|
3779
|
+
11,
|
|
3780
|
+
122,
|
|
3781
|
+
209,
|
|
3782
|
+
103
|
|
3783
|
+
]);
|
|
3784
|
+
function getGuardianRegisteredEventDiscriminatorBytes() {
|
|
3785
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(GUARDIAN_REGISTERED_EVENT_DISCRIMINATOR);
|
|
3786
|
+
}
|
|
3787
|
+
function getGuardianRegisteredEventEncoder() {
|
|
3788
|
+
return getHiddenPrefixEncoder(
|
|
3789
|
+
getStructEncoder([
|
|
3790
|
+
["version", getU8Encoder()],
|
|
3791
|
+
["seq", getU64Encoder()],
|
|
3792
|
+
["guardian", getAddressEncoder()],
|
|
3793
|
+
["voteAuthority", getAddressEncoder()],
|
|
3794
|
+
["bond", getU64Encoder()],
|
|
3795
|
+
["updateNonce", getU32Encoder()]
|
|
3796
|
+
]),
|
|
3797
|
+
[getConstantEncoder(GUARDIAN_REGISTERED_EVENT_DISCRIMINATOR)]
|
|
3798
|
+
);
|
|
3799
|
+
}
|
|
3800
|
+
function getGuardianRegisteredEventDecoder() {
|
|
3801
|
+
return getHiddenPrefixDecoder(
|
|
3802
|
+
getStructDecoder([
|
|
3803
|
+
["version", getU8Decoder()],
|
|
3804
|
+
["seq", getU64Decoder()],
|
|
3805
|
+
["guardian", getAddressDecoder()],
|
|
3806
|
+
["voteAuthority", getAddressDecoder()],
|
|
3807
|
+
["bond", getU64Decoder()],
|
|
3808
|
+
["updateNonce", getU32Decoder()]
|
|
3809
|
+
]),
|
|
3810
|
+
[getConstantDecoder(GUARDIAN_REGISTERED_EVENT_DISCRIMINATOR)]
|
|
3811
|
+
);
|
|
3812
|
+
}
|
|
3813
|
+
function getGuardianRegisteredEventCodec() {
|
|
3814
|
+
return combineCodec(getGuardianRegisteredEventEncoder(), getGuardianRegisteredEventDecoder());
|
|
3815
|
+
}
|
|
3816
|
+
function parseGuardianRegisteredEvent(data) {
|
|
3817
|
+
if (containsBytes(data, GUARDIAN_REGISTERED_EVENT_DISCRIMINATOR, 0)) {
|
|
3818
|
+
return getGuardianRegisteredEventDecoder().decode(data);
|
|
3819
|
+
}
|
|
3820
|
+
throw new Error('The provided data does not match the "GuardianRegisteredEvent" event discriminators.');
|
|
3821
|
+
}
|
|
3822
|
+
var GUARDIAN_REMOVED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3823
|
+
225,
|
|
3824
|
+
27,
|
|
3825
|
+
117,
|
|
3826
|
+
56,
|
|
3827
|
+
241,
|
|
3828
|
+
196,
|
|
3829
|
+
5,
|
|
3830
|
+
56
|
|
3831
|
+
]);
|
|
3832
|
+
function getGuardianRemovedEventDiscriminatorBytes() {
|
|
3833
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(GUARDIAN_REMOVED_EVENT_DISCRIMINATOR);
|
|
3834
|
+
}
|
|
3835
|
+
function getGuardianRemovedEventEncoder() {
|
|
3836
|
+
return getHiddenPrefixEncoder(
|
|
3837
|
+
getStructEncoder([
|
|
3838
|
+
["version", getU8Encoder()],
|
|
3839
|
+
["seq", getU64Encoder()],
|
|
3840
|
+
["guardian", getAddressEncoder()],
|
|
3841
|
+
["refunded", getU64Encoder()],
|
|
3842
|
+
["updateNonce", getU32Encoder()]
|
|
3843
|
+
]),
|
|
3844
|
+
[getConstantEncoder(GUARDIAN_REMOVED_EVENT_DISCRIMINATOR)]
|
|
3845
|
+
);
|
|
3846
|
+
}
|
|
3847
|
+
function getGuardianRemovedEventDecoder() {
|
|
3848
|
+
return getHiddenPrefixDecoder(
|
|
3849
|
+
getStructDecoder([
|
|
3850
|
+
["version", getU8Decoder()],
|
|
3851
|
+
["seq", getU64Decoder()],
|
|
3852
|
+
["guardian", getAddressDecoder()],
|
|
3853
|
+
["refunded", getU64Decoder()],
|
|
3854
|
+
["updateNonce", getU32Decoder()]
|
|
3855
|
+
]),
|
|
3856
|
+
[getConstantDecoder(GUARDIAN_REMOVED_EVENT_DISCRIMINATOR)]
|
|
3857
|
+
);
|
|
3858
|
+
}
|
|
3859
|
+
function getGuardianRemovedEventCodec() {
|
|
3860
|
+
return combineCodec(getGuardianRemovedEventEncoder(), getGuardianRemovedEventDecoder());
|
|
3861
|
+
}
|
|
3862
|
+
function parseGuardianRemovedEvent(data) {
|
|
3863
|
+
if (containsBytes(data, GUARDIAN_REMOVED_EVENT_DISCRIMINATOR, 0)) {
|
|
3864
|
+
return getGuardianRemovedEventDecoder().decode(data);
|
|
3865
|
+
}
|
|
3866
|
+
throw new Error('The provided data does not match the "GuardianRemovedEvent" event discriminators.');
|
|
3867
|
+
}
|
|
3868
|
+
var GUARDIAN_VOTE_AUTHORITY_ROTATED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3869
|
+
182,
|
|
3870
|
+
81,
|
|
3871
|
+
245,
|
|
3872
|
+
184,
|
|
3873
|
+
174,
|
|
3874
|
+
85,
|
|
3875
|
+
224,
|
|
3876
|
+
213
|
|
3877
|
+
]);
|
|
3878
|
+
function getGuardianVoteAuthorityRotatedEventDiscriminatorBytes() {
|
|
3879
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(GUARDIAN_VOTE_AUTHORITY_ROTATED_EVENT_DISCRIMINATOR);
|
|
3880
|
+
}
|
|
3881
|
+
function getGuardianVoteAuthorityRotatedEventEncoder() {
|
|
3882
|
+
return getHiddenPrefixEncoder(
|
|
3883
|
+
getStructEncoder([
|
|
3884
|
+
["version", getU8Encoder()],
|
|
3885
|
+
["seq", getU64Encoder()],
|
|
3886
|
+
["guardian", getAddressEncoder()],
|
|
3887
|
+
["oldVoteAuthority", getAddressEncoder()],
|
|
3888
|
+
["newVoteAuthority", getAddressEncoder()]
|
|
3889
|
+
]),
|
|
3890
|
+
[getConstantEncoder(GUARDIAN_VOTE_AUTHORITY_ROTATED_EVENT_DISCRIMINATOR)]
|
|
3891
|
+
);
|
|
3892
|
+
}
|
|
3893
|
+
function getGuardianVoteAuthorityRotatedEventDecoder() {
|
|
3894
|
+
return getHiddenPrefixDecoder(
|
|
3895
|
+
getStructDecoder([
|
|
3896
|
+
["version", getU8Decoder()],
|
|
3897
|
+
["seq", getU64Decoder()],
|
|
3898
|
+
["guardian", getAddressDecoder()],
|
|
3899
|
+
["oldVoteAuthority", getAddressDecoder()],
|
|
3900
|
+
["newVoteAuthority", getAddressDecoder()]
|
|
3901
|
+
]),
|
|
3902
|
+
[getConstantDecoder(GUARDIAN_VOTE_AUTHORITY_ROTATED_EVENT_DISCRIMINATOR)]
|
|
3903
|
+
);
|
|
3904
|
+
}
|
|
3905
|
+
function getGuardianVoteAuthorityRotatedEventCodec() {
|
|
3906
|
+
return combineCodec(getGuardianVoteAuthorityRotatedEventEncoder(), getGuardianVoteAuthorityRotatedEventDecoder());
|
|
3907
|
+
}
|
|
3908
|
+
function parseGuardianVoteAuthorityRotatedEvent(data) {
|
|
3909
|
+
if (containsBytes(data, GUARDIAN_VOTE_AUTHORITY_ROTATED_EVENT_DISCRIMINATOR, 0)) {
|
|
3910
|
+
return getGuardianVoteAuthorityRotatedEventDecoder().decode(data);
|
|
3911
|
+
}
|
|
3912
|
+
throw new Error('The provided data does not match the "GuardianVoteAuthorityRotatedEvent" event discriminators.');
|
|
3913
|
+
}
|
|
3914
|
+
var RELEASE_APPROVED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3915
|
+
246,
|
|
3916
|
+
7,
|
|
3917
|
+
17,
|
|
3918
|
+
99,
|
|
3919
|
+
160,
|
|
3920
|
+
10,
|
|
3921
|
+
151,
|
|
3922
|
+
253
|
|
3923
|
+
]);
|
|
3924
|
+
function getReleaseApprovedEventDiscriminatorBytes() {
|
|
3925
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RELEASE_APPROVED_EVENT_DISCRIMINATOR);
|
|
3926
|
+
}
|
|
3927
|
+
function getReleaseApprovedEventEncoder() {
|
|
3928
|
+
return getHiddenPrefixEncoder(getStructEncoder([["resolution", getReleaseResolutionEncoder()]]), [
|
|
3929
|
+
getConstantEncoder(RELEASE_APPROVED_EVENT_DISCRIMINATOR)
|
|
3930
|
+
]);
|
|
3931
|
+
}
|
|
3932
|
+
function getReleaseApprovedEventDecoder() {
|
|
3933
|
+
return getHiddenPrefixDecoder(getStructDecoder([["resolution", getReleaseResolutionDecoder()]]), [
|
|
3934
|
+
getConstantDecoder(RELEASE_APPROVED_EVENT_DISCRIMINATOR)
|
|
3935
|
+
]);
|
|
3936
|
+
}
|
|
3937
|
+
function getReleaseApprovedEventCodec() {
|
|
3938
|
+
return combineCodec(getReleaseApprovedEventEncoder(), getReleaseApprovedEventDecoder());
|
|
3939
|
+
}
|
|
3940
|
+
function parseReleaseApprovedEvent(data) {
|
|
3941
|
+
if (containsBytes(data, RELEASE_APPROVED_EVENT_DISCRIMINATOR, 0)) {
|
|
3942
|
+
return getReleaseApprovedEventDecoder().decode(data);
|
|
3943
|
+
}
|
|
3944
|
+
throw new Error('The provided data does not match the "ReleaseApprovedEvent" event discriminators.');
|
|
3945
|
+
}
|
|
3946
|
+
var RELEASE_CANCELLED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3947
|
+
107,
|
|
3948
|
+
100,
|
|
3949
|
+
38,
|
|
3950
|
+
206,
|
|
3951
|
+
48,
|
|
3952
|
+
27,
|
|
3953
|
+
92,
|
|
3954
|
+
178
|
|
3955
|
+
]);
|
|
3956
|
+
function getReleaseCancelledEventDiscriminatorBytes() {
|
|
3957
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RELEASE_CANCELLED_EVENT_DISCRIMINATOR);
|
|
3958
|
+
}
|
|
3959
|
+
function getReleaseCancelledEventEncoder() {
|
|
3960
|
+
return getHiddenPrefixEncoder(
|
|
3961
|
+
getStructEncoder([
|
|
3962
|
+
["version", getU8Encoder()],
|
|
3963
|
+
["seq", getU64Encoder()],
|
|
3964
|
+
["app", getAddressEncoder()],
|
|
3965
|
+
["versionCode", getU32Encoder()]
|
|
3966
|
+
]),
|
|
3967
|
+
[getConstantEncoder(RELEASE_CANCELLED_EVENT_DISCRIMINATOR)]
|
|
3968
|
+
);
|
|
3969
|
+
}
|
|
3970
|
+
function getReleaseCancelledEventDecoder() {
|
|
3971
|
+
return getHiddenPrefixDecoder(
|
|
3972
|
+
getStructDecoder([
|
|
3973
|
+
["version", getU8Decoder()],
|
|
3974
|
+
["seq", getU64Decoder()],
|
|
3975
|
+
["app", getAddressDecoder()],
|
|
3976
|
+
["versionCode", getU32Decoder()]
|
|
3977
|
+
]),
|
|
3978
|
+
[getConstantDecoder(RELEASE_CANCELLED_EVENT_DISCRIMINATOR)]
|
|
3979
|
+
);
|
|
3980
|
+
}
|
|
3981
|
+
function getReleaseCancelledEventCodec() {
|
|
3982
|
+
return combineCodec(getReleaseCancelledEventEncoder(), getReleaseCancelledEventDecoder());
|
|
3983
|
+
}
|
|
3984
|
+
function parseReleaseCancelledEvent(data) {
|
|
3985
|
+
if (containsBytes(data, RELEASE_CANCELLED_EVENT_DISCRIMINATOR, 0)) {
|
|
3986
|
+
return getReleaseCancelledEventDecoder().decode(data);
|
|
3987
|
+
}
|
|
3988
|
+
throw new Error('The provided data does not match the "ReleaseCancelledEvent" event discriminators.');
|
|
3989
|
+
}
|
|
3990
|
+
var RELEASE_EXPIRED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
3991
|
+
185,
|
|
3992
|
+
185,
|
|
3993
|
+
92,
|
|
3994
|
+
34,
|
|
3995
|
+
95,
|
|
3996
|
+
198,
|
|
3997
|
+
124,
|
|
3998
|
+
51
|
|
3999
|
+
]);
|
|
4000
|
+
function getReleaseExpiredEventDiscriminatorBytes() {
|
|
4001
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RELEASE_EXPIRED_EVENT_DISCRIMINATOR);
|
|
4002
|
+
}
|
|
4003
|
+
function getReleaseExpiredEventEncoder() {
|
|
4004
|
+
return getHiddenPrefixEncoder(
|
|
4005
|
+
getStructEncoder([
|
|
4006
|
+
["version", getU8Encoder()],
|
|
4007
|
+
["seq", getU64Encoder()],
|
|
4008
|
+
["app", getAddressEncoder()],
|
|
4009
|
+
["versionCode", getU32Encoder()]
|
|
4010
|
+
]),
|
|
4011
|
+
[getConstantEncoder(RELEASE_EXPIRED_EVENT_DISCRIMINATOR)]
|
|
4012
|
+
);
|
|
4013
|
+
}
|
|
4014
|
+
function getReleaseExpiredEventDecoder() {
|
|
4015
|
+
return getHiddenPrefixDecoder(
|
|
4016
|
+
getStructDecoder([
|
|
4017
|
+
["version", getU8Decoder()],
|
|
4018
|
+
["seq", getU64Decoder()],
|
|
4019
|
+
["app", getAddressDecoder()],
|
|
4020
|
+
["versionCode", getU32Decoder()]
|
|
4021
|
+
]),
|
|
4022
|
+
[getConstantDecoder(RELEASE_EXPIRED_EVENT_DISCRIMINATOR)]
|
|
4023
|
+
);
|
|
4024
|
+
}
|
|
4025
|
+
function getReleaseExpiredEventCodec() {
|
|
4026
|
+
return combineCodec(getReleaseExpiredEventEncoder(), getReleaseExpiredEventDecoder());
|
|
4027
|
+
}
|
|
4028
|
+
function parseReleaseExpiredEvent(data) {
|
|
4029
|
+
if (containsBytes(data, RELEASE_EXPIRED_EVENT_DISCRIMINATOR, 0)) {
|
|
4030
|
+
return getReleaseExpiredEventDecoder().decode(data);
|
|
4031
|
+
}
|
|
4032
|
+
throw new Error('The provided data does not match the "ReleaseExpiredEvent" event discriminators.');
|
|
4033
|
+
}
|
|
4034
|
+
var RELEASE_PROPOSED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
4035
|
+
245,
|
|
4036
|
+
225,
|
|
4037
|
+
27,
|
|
4038
|
+
20,
|
|
4039
|
+
64,
|
|
4040
|
+
160,
|
|
4041
|
+
146,
|
|
4042
|
+
183
|
|
4043
|
+
]);
|
|
4044
|
+
function getReleaseProposedEventDiscriminatorBytes() {
|
|
4045
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RELEASE_PROPOSED_EVENT_DISCRIMINATOR);
|
|
4046
|
+
}
|
|
4047
|
+
function getReleaseProposedEventEncoder() {
|
|
4048
|
+
return getHiddenPrefixEncoder(
|
|
4049
|
+
getStructEncoder([
|
|
4050
|
+
["version", getU8Encoder()],
|
|
4051
|
+
["seq", getU64Encoder()],
|
|
4052
|
+
["app", getAddressEncoder()],
|
|
4053
|
+
["versionCode", getU32Encoder()],
|
|
4054
|
+
["policyBundleHash", fixEncoderSize(getBytesEncoder(), 32)]
|
|
4055
|
+
]),
|
|
4056
|
+
[getConstantEncoder(RELEASE_PROPOSED_EVENT_DISCRIMINATOR)]
|
|
4057
|
+
);
|
|
4058
|
+
}
|
|
4059
|
+
function getReleaseProposedEventDecoder() {
|
|
4060
|
+
return getHiddenPrefixDecoder(
|
|
4061
|
+
getStructDecoder([
|
|
4062
|
+
["version", getU8Decoder()],
|
|
4063
|
+
["seq", getU64Decoder()],
|
|
4064
|
+
["app", getAddressDecoder()],
|
|
4065
|
+
["versionCode", getU32Decoder()],
|
|
4066
|
+
["policyBundleHash", fixDecoderSize(getBytesDecoder(), 32)]
|
|
4067
|
+
]),
|
|
4068
|
+
[getConstantDecoder(RELEASE_PROPOSED_EVENT_DISCRIMINATOR)]
|
|
4069
|
+
);
|
|
4070
|
+
}
|
|
4071
|
+
function getReleaseProposedEventCodec() {
|
|
4072
|
+
return combineCodec(getReleaseProposedEventEncoder(), getReleaseProposedEventDecoder());
|
|
4073
|
+
}
|
|
4074
|
+
function parseReleaseProposedEvent(data) {
|
|
4075
|
+
if (containsBytes(data, RELEASE_PROPOSED_EVENT_DISCRIMINATOR, 0)) {
|
|
4076
|
+
return getReleaseProposedEventDecoder().decode(data);
|
|
4077
|
+
}
|
|
4078
|
+
throw new Error('The provided data does not match the "ReleaseProposedEvent" event discriminators.');
|
|
4079
|
+
}
|
|
4080
|
+
var RELEASE_REJECTED_EVENT_DISCRIMINATOR = new Uint8Array([
|
|
4081
|
+
144,
|
|
4082
|
+
93,
|
|
4083
|
+
149,
|
|
4084
|
+
105,
|
|
4085
|
+
200,
|
|
4086
|
+
85,
|
|
4087
|
+
92,
|
|
4088
|
+
126
|
|
4089
|
+
]);
|
|
4090
|
+
function getReleaseRejectedEventDiscriminatorBytes() {
|
|
4091
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RELEASE_REJECTED_EVENT_DISCRIMINATOR);
|
|
4092
|
+
}
|
|
4093
|
+
function getReleaseRejectedEventEncoder() {
|
|
4094
|
+
return getHiddenPrefixEncoder(getStructEncoder([["resolution", getReleaseResolutionEncoder()]]), [
|
|
4095
|
+
getConstantEncoder(RELEASE_REJECTED_EVENT_DISCRIMINATOR)
|
|
4096
|
+
]);
|
|
4097
|
+
}
|
|
4098
|
+
function getReleaseRejectedEventDecoder() {
|
|
4099
|
+
return getHiddenPrefixDecoder(getStructDecoder([["resolution", getReleaseResolutionDecoder()]]), [
|
|
4100
|
+
getConstantDecoder(RELEASE_REJECTED_EVENT_DISCRIMINATOR)
|
|
4101
|
+
]);
|
|
4102
|
+
}
|
|
4103
|
+
function getReleaseRejectedEventCodec() {
|
|
4104
|
+
return combineCodec(getReleaseRejectedEventEncoder(), getReleaseRejectedEventDecoder());
|
|
4105
|
+
}
|
|
4106
|
+
function parseReleaseRejectedEvent(data) {
|
|
4107
|
+
if (containsBytes(data, RELEASE_REJECTED_EVENT_DISCRIMINATOR, 0)) {
|
|
4108
|
+
return getReleaseRejectedEventDecoder().decode(data);
|
|
4109
|
+
}
|
|
4110
|
+
throw new Error('The provided data does not match the "ReleaseRejectedEvent" event discriminators.');
|
|
4111
|
+
}
|
|
4112
|
+
var VOTE_CAST_EVENT_DISCRIMINATOR = new Uint8Array([39, 53, 195, 104, 188, 17, 225, 213]);
|
|
4113
|
+
function getVoteCastEventDiscriminatorBytes() {
|
|
4114
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(VOTE_CAST_EVENT_DISCRIMINATOR);
|
|
4115
|
+
}
|
|
4116
|
+
function getVoteCastEventEncoder() {
|
|
4117
|
+
return getHiddenPrefixEncoder(
|
|
4118
|
+
getStructEncoder([
|
|
4119
|
+
["version", getU8Encoder()],
|
|
4120
|
+
["seq", getU64Encoder()],
|
|
4121
|
+
["app", getAddressEncoder()],
|
|
4122
|
+
["versionCode", getU32Encoder()],
|
|
4123
|
+
["guardian", getAddressEncoder()],
|
|
4124
|
+
["approve", getBooleanEncoder()],
|
|
4125
|
+
["policyBundleHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
4126
|
+
["findings", getArrayEncoder(getVoteFindingEncoder())]
|
|
4127
|
+
]),
|
|
4128
|
+
[getConstantEncoder(VOTE_CAST_EVENT_DISCRIMINATOR)]
|
|
4129
|
+
);
|
|
4130
|
+
}
|
|
4131
|
+
function getVoteCastEventDecoder() {
|
|
4132
|
+
return getHiddenPrefixDecoder(
|
|
4133
|
+
getStructDecoder([
|
|
4134
|
+
["version", getU8Decoder()],
|
|
4135
|
+
["seq", getU64Decoder()],
|
|
4136
|
+
["app", getAddressDecoder()],
|
|
4137
|
+
["versionCode", getU32Decoder()],
|
|
4138
|
+
["guardian", getAddressDecoder()],
|
|
4139
|
+
["approve", getBooleanDecoder()],
|
|
4140
|
+
["policyBundleHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
4141
|
+
["findings", getArrayDecoder(getVoteFindingDecoder())]
|
|
4142
|
+
]),
|
|
4143
|
+
[getConstantDecoder(VOTE_CAST_EVENT_DISCRIMINATOR)]
|
|
4144
|
+
);
|
|
4145
|
+
}
|
|
4146
|
+
function getVoteCastEventCodec() {
|
|
4147
|
+
return combineCodec(getVoteCastEventEncoder(), getVoteCastEventDecoder());
|
|
4148
|
+
}
|
|
4149
|
+
function parseVoteCastEvent(data) {
|
|
4150
|
+
if (containsBytes(data, VOTE_CAST_EVENT_DISCRIMINATOR, 0)) {
|
|
4151
|
+
return getVoteCastEventDecoder().decode(data);
|
|
4152
|
+
}
|
|
4153
|
+
throw new Error('The provided data does not match the "VoteCastEvent" event discriminators.');
|
|
4154
|
+
}
|
|
4155
|
+
var DEFAULT_MANIFEST_CHUNK = 800;
|
|
4156
|
+
function getManifestChunks(manifest, chunkSize = DEFAULT_MANIFEST_CHUNK) {
|
|
4157
|
+
if (!Number.isInteger(chunkSize) || chunkSize <= 0) {
|
|
4158
|
+
throw new Error(`chunk size must be a positive integer, got ${chunkSize}`);
|
|
4159
|
+
}
|
|
4160
|
+
if (manifest.length === 0) return [{ offset: 0, bytes: manifest }];
|
|
4161
|
+
const chunks = [];
|
|
4162
|
+
for (let offset = 0; offset < manifest.length; offset += chunkSize) {
|
|
4163
|
+
chunks.push({ offset, bytes: manifest.subarray(offset, offset + chunkSize) });
|
|
4164
|
+
}
|
|
4165
|
+
return chunks;
|
|
4166
|
+
}
|
|
4167
|
+
async function getManifestHash(manifest) {
|
|
4168
|
+
return new Uint8Array(await crypto.subtle.digest("SHA-256", new Uint8Array(manifest)));
|
|
4169
|
+
}
|
|
4170
|
+
var SCHEMA_V1 = new Uint8Array([1]);
|
|
4171
|
+
function getManifestEncoder() {
|
|
4172
|
+
return getManifestCodec();
|
|
4173
|
+
}
|
|
4174
|
+
function getManifestDecoder() {
|
|
4175
|
+
return getManifestCodec();
|
|
4176
|
+
}
|
|
4177
|
+
function getManifestCodec() {
|
|
4178
|
+
const v1 = getHiddenPrefixCodec(
|
|
4179
|
+
getStructCodec([
|
|
4180
|
+
["versionCode", getU32Codec()],
|
|
4181
|
+
["package", getStringCodec()],
|
|
4182
|
+
["versionName", getStringCodec()],
|
|
4183
|
+
["minSdk", getU32Codec()],
|
|
4184
|
+
["permissions", getArrayCodec(getStringCodec())],
|
|
4185
|
+
[
|
|
4186
|
+
"apk",
|
|
4187
|
+
getStructCodec([
|
|
4188
|
+
["uri", getStringCodec()],
|
|
4189
|
+
["sha256", getDigestCodec()]
|
|
4190
|
+
])
|
|
4191
|
+
],
|
|
4192
|
+
["terms", getStringCodec()],
|
|
4193
|
+
["privacy", getStringCodec()],
|
|
4194
|
+
["certificateSha256", getDigestCodec()],
|
|
4195
|
+
[
|
|
4196
|
+
"publisherSite",
|
|
4197
|
+
combineCodec(getNullableEncoder(getStringCodec()), getStrictNullableDecoder(getStringCodec()))
|
|
4198
|
+
]
|
|
4199
|
+
]),
|
|
4200
|
+
[getConstantCodec(SCHEMA_V1)]
|
|
4201
|
+
);
|
|
4202
|
+
const manifest = transformCodec(
|
|
4203
|
+
v1,
|
|
4204
|
+
({ __kind: _kind, ...fields }) => fields,
|
|
4205
|
+
(fields) => ({ __kind: "V1", ...fields })
|
|
4206
|
+
);
|
|
4207
|
+
return combineCodec(manifest, rejectTrailingBytes(manifest));
|
|
4208
|
+
}
|
|
4209
|
+
function getStringCodec() {
|
|
4210
|
+
return combineCodec(
|
|
4211
|
+
addEncoderSizePrefix(getUtf8Encoder({ fatal: true }), getU32Encoder()),
|
|
4212
|
+
addDecoderSizePrefix(
|
|
4213
|
+
getUtf8Decoder({ fatal: true, ignoreBOM: true, removeNullCharacters: false }),
|
|
4214
|
+
getU32Decoder()
|
|
4215
|
+
)
|
|
4216
|
+
);
|
|
4217
|
+
}
|
|
4218
|
+
function getDigestCodec() {
|
|
4219
|
+
return fixCodecSize(getBytesCodec(), 32);
|
|
4220
|
+
}
|
|
4221
|
+
function getStrictNullableDecoder(item) {
|
|
4222
|
+
return createDecoder({
|
|
4223
|
+
read(bytes, offset) {
|
|
4224
|
+
const [tag, next] = getU8Decoder().read(bytes, offset);
|
|
4225
|
+
if (tag === 0) return [null, next];
|
|
4226
|
+
if (tag === 1) return item.read(bytes, next);
|
|
4227
|
+
throw new Error(`invalid option tag ${tag} at byte ${offset}`);
|
|
4228
|
+
}
|
|
4229
|
+
});
|
|
4230
|
+
}
|
|
4231
|
+
function rejectTrailingBytes(decoder) {
|
|
4232
|
+
return createDecoder({
|
|
4233
|
+
read(bytes, offset) {
|
|
4234
|
+
const [value, end] = decoder.read(bytes, offset);
|
|
4235
|
+
if (end !== bytes.length) throw new Error(`${bytes.length - end} trailing bytes after the manifest`);
|
|
4236
|
+
return [value, end];
|
|
4237
|
+
}
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
// src/proposal.ts
|
|
4242
|
+
function getPendingRelease(app) {
|
|
4243
|
+
return app.pendingRelease.__kind === "Pending" ? app.pendingRelease.fields[0] : null;
|
|
4244
|
+
}
|
|
4245
|
+
function getLateVoteWindow(pending, config, now) {
|
|
4246
|
+
if (!pending?.resolved) {
|
|
4247
|
+
return null;
|
|
4248
|
+
}
|
|
4249
|
+
const closesAt = pending.quorumTs + BigInt(config.voteWindow);
|
|
4250
|
+
const open = now < closesAt && pending.guardianNonce === config.updateNonce && pending.votes.size < config.guardians.size;
|
|
4251
|
+
return open ? { closesAt, votesCast: pending.votes.size, guardians: config.guardians.size } : null;
|
|
4252
|
+
}
|
|
4253
|
+
function getReleaseProposalStep(app, versionCode, manifestLength, clock) {
|
|
4254
|
+
if (!app) {
|
|
4255
|
+
return { kind: "write", written: null };
|
|
4256
|
+
}
|
|
4257
|
+
if (versionCode <= app.lastResolvedVersion) {
|
|
4258
|
+
return { kind: "spent" };
|
|
4259
|
+
}
|
|
4260
|
+
const pending = getPendingRelease(app);
|
|
4261
|
+
if (!pending) {
|
|
4262
|
+
return { kind: "write", written: null };
|
|
4263
|
+
}
|
|
4264
|
+
if (pending.resolved) {
|
|
4265
|
+
if (!clock) {
|
|
4266
|
+
throw new Error("The guardian config and cluster time are needed when a resolved release holds the slot");
|
|
4267
|
+
}
|
|
4268
|
+
const window = getLateVoteWindow(pending, clock.config, clock.now);
|
|
4269
|
+
return window ? { kind: "waitForLateVotes", window } : { kind: "write", written: null };
|
|
4270
|
+
}
|
|
4271
|
+
if (versionCode < pending.versionCode || versionCode === pending.versionCode && pending.finalized) {
|
|
4272
|
+
return { kind: "underReview", pendingVersionCode: pending.versionCode };
|
|
4273
|
+
}
|
|
4274
|
+
if (versionCode > pending.versionCode || pending.data.length !== manifestLength) {
|
|
4275
|
+
return { kind: "cancelFirst" };
|
|
4276
|
+
}
|
|
4277
|
+
return { kind: "write", written: pending.data };
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4280
|
+
export { ACCEPT_APP_AUTHORITY_DISCRIMINATOR, ACCEPT_CONFIG_AUTHORITY_DISCRIMINATOR, ADD_GUARDIAN_DISCRIMINATOR, APP_ACCOUNT_DISCRIMINATOR, APP_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR, APP_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR, APP_DEVELOPER_UPDATED_EVENT_DISCRIMINATOR, APP_REGISTERED_EVENT_DISCRIMINATOR, CANCEL_RELEASE_DISCRIMINATOR, CONFIG_AUTHORITY_ACCEPTED_EVENT_DISCRIMINATOR, CONFIG_AUTHORITY_PROPOSED_EVENT_DISCRIMINATOR, CONFIG_INITIALIZED_EVENT_DISCRIMINATOR, CONFIG_UPDATED_EVENT_DISCRIMINATOR, DEFAULT_MANIFEST_CHUNK, EXPIRE_RELEASE_DISCRIMINATOR, GUARDIANS_CONFIG_DISCRIMINATOR, GUARDIAN_ADDED_EVENT_DISCRIMINATOR, GUARDIAN_ERROR__ALREADY_VOTED, GUARDIAN_ERROR__CANNOT_CANCEL_RESOLVED_RELEASE, GUARDIAN_ERROR__CERTIFICATE_NOT_SET, GUARDIAN_ERROR__FUNDER_NOT_WALLET, GUARDIAN_ERROR__GUARDIAN_NOT_PENDING, GUARDIAN_ERROR__GUARDIAN_SET_CHANGED_SINCE_QUORUM, GUARDIAN_ERROR__INCORRECT_AUTHORITY, GUARDIAN_ERROR__INCORRECT_BOND_DESTINATION, GUARDIAN_ERROR__INCORRECT_PENDING_APP_AUTHORITY, GUARDIAN_ERROR__INCORRECT_PENDING_CONFIG_AUTHORITY, GUARDIAN_ERROR__INVALID_GUARDIAN, GUARDIAN_ERROR__INVALID_POLICY_BUNDLE_HASH, GUARDIAN_ERROR__INVALID_VOTING_PERIOD, GUARDIAN_ERROR__KEY_IN_USE, GUARDIAN_ERROR__MANIFEST_HASH_MISMATCH, GUARDIAN_ERROR__MANIFEST_LENGTH_MISMATCH, GUARDIAN_ERROR__MANIFEST_TOO_LARGE, GUARDIAN_ERROR__MANIFEST_WRITE_OUT_OF_BOUNDS, GUARDIAN_ERROR__NO_PENDING_APP_AUTHORITY, GUARDIAN_ERROR__NO_PENDING_CONFIG_AUTHORITY, GUARDIAN_ERROR__NO_PENDING_RELEASE, GUARDIAN_ERROR__OVERFLOW, GUARDIAN_ERROR__POLICY_BUNDLE_MISMATCH, GUARDIAN_ERROR__POLICY_BUNDLE_NOT_ATTESTED, GUARDIAN_ERROR__RELEASE_ALREADY_PENDING, GUARDIAN_ERROR__RELEASE_NOT_EXPIRED, GUARDIAN_ERROR__RELEASE_NOT_FINALIZED, GUARDIAN_ERROR__TOO_MANY_DEVELOPERS, GUARDIAN_ERROR__TOO_MANY_GUARDIANS, GUARDIAN_ERROR__UNAUTHORIZED_VOTE_AUTHORITY, GUARDIAN_ERROR__VERSION_CODE_MISMATCH, GUARDIAN_ERROR__VERSION_CODE_NOT_INCREASING, GUARDIAN_ERROR__VERSION_CODE_TOO_LARGE, GUARDIAN_ERROR__VOTE_FINDINGS_TOO_LARGE, GUARDIAN_ERROR__VOTE_WINDOW_CLOSED, GUARDIAN_ERROR__VOTE_WINDOW_OPEN, GUARDIAN_ERROR__VOTING_DEADLINE_PASSED, GUARDIAN_PROGRAM_ADDRESS, GUARDIAN_REGISTERED_EVENT_DISCRIMINATOR, GUARDIAN_REMOVED_EVENT_DISCRIMINATOR, GUARDIAN_VOTE_AUTHORITY_ROTATED_EVENT_DISCRIMINATOR, GuardianAccount, GuardianEvent, GuardianInstruction, INITIALIZE_CONFIG_DISCRIMINATOR, MAX_MANIFEST_LEN, PENDING_REGISTRY_DISCRIMINATOR, PROPOSE_APP_AUTHORITY_DISCRIMINATOR, PROPOSE_CONFIG_AUTHORITY_DISCRIMINATOR, PROPOSE_RELEASE_DISCRIMINATOR, REGISTER_APP_DISCRIMINATOR, REGISTER_GUARDIAN_DISCRIMINATOR, RELEASE_APPROVED_EVENT_DISCRIMINATOR, RELEASE_CANCELLED_EVENT_DISCRIMINATOR, RELEASE_EXPIRED_EVENT_DISCRIMINATOR, RELEASE_PROPOSED_EVENT_DISCRIMINATOR, RELEASE_REJECTED_EVENT_DISCRIMINATOR, REMOVE_GUARDIAN_DISCRIMINATOR, ROTATE_VOTE_AUTHORITY_DISCRIMINATOR, SET_APP_DEVELOPER_DISCRIMINATOR, UPDATE_CONFIG_DISCRIMINATOR, VOTE_CAST_EVENT_DISCRIMINATOR, VOTE_DISCRIMINATOR, WRITE_RELEASE_MANIFEST_DISCRIMINATOR, decodeAppAccount, decodeGuardiansConfig, decodePendingRegistry, fetchAllAppAccount, fetchAllGuardiansConfig, fetchAllMaybeAppAccount, fetchAllMaybeGuardiansConfig, fetchAllMaybePendingRegistry, fetchAllPendingRegistry, fetchAppAccount, fetchGuardiansConfig, fetchMaybeAppAccount, fetchMaybeGuardiansConfig, fetchMaybePendingRegistry, fetchPendingRegistry, findBondVaultPda, findGuardiansConfigPda, findPendingRegistryPda, getAcceptAppAuthorityDiscriminatorBytes, getAcceptAppAuthorityInstruction, getAcceptAppAuthorityInstructionAsync, getAcceptAppAuthorityInstructionDataCodec, getAcceptAppAuthorityInstructionDataDecoder, getAcceptAppAuthorityInstructionDataEncoder, getAcceptConfigAuthorityDiscriminatorBytes, getAcceptConfigAuthorityInstruction, getAcceptConfigAuthorityInstructionAsync, getAcceptConfigAuthorityInstructionDataCodec, getAcceptConfigAuthorityInstructionDataDecoder, getAcceptConfigAuthorityInstructionDataEncoder, getAddGuardianDiscriminatorBytes, getAddGuardianInstruction, getAddGuardianInstructionAsync, getAddGuardianInstructionDataCodec, getAddGuardianInstructionDataDecoder, getAddGuardianInstructionDataEncoder, getAppAccountCodec, getAppAccountDecoder, getAppAccountDiscriminatorBytes, getAppAccountEncoder, getAppAuthorityAcceptedEventCodec, getAppAuthorityAcceptedEventDecoder, getAppAuthorityAcceptedEventDiscriminatorBytes, getAppAuthorityAcceptedEventEncoder, getAppAuthorityProposedEventCodec, getAppAuthorityProposedEventDecoder, getAppAuthorityProposedEventDiscriminatorBytes, getAppAuthorityProposedEventEncoder, getAppDeveloperUpdatedEventCodec, getAppDeveloperUpdatedEventDecoder, getAppDeveloperUpdatedEventDiscriminatorBytes, getAppDeveloperUpdatedEventEncoder, getAppRegisteredEventCodec, getAppRegisteredEventDecoder, getAppRegisteredEventDiscriminatorBytes, getAppRegisteredEventEncoder, getBondInfoCodec, getBondInfoDecoder, getBondInfoEncoder, getCancelReleaseDiscriminatorBytes, getCancelReleaseInstruction, getCancelReleaseInstructionAsync, getCancelReleaseInstructionDataCodec, getCancelReleaseInstructionDataDecoder, getCancelReleaseInstructionDataEncoder, getConfigAuthorityAcceptedEventCodec, getConfigAuthorityAcceptedEventDecoder, getConfigAuthorityAcceptedEventDiscriminatorBytes, getConfigAuthorityAcceptedEventEncoder, getConfigAuthorityProposedEventCodec, getConfigAuthorityProposedEventDecoder, getConfigAuthorityProposedEventDiscriminatorBytes, getConfigAuthorityProposedEventEncoder, getConfigInitializedEventCodec, getConfigInitializedEventDecoder, getConfigInitializedEventDiscriminatorBytes, getConfigInitializedEventEncoder, getConfigUpdatedEventCodec, getConfigUpdatedEventDecoder, getConfigUpdatedEventDiscriminatorBytes, getConfigUpdatedEventEncoder, getExpireReleaseDiscriminatorBytes, getExpireReleaseInstruction, getExpireReleaseInstructionAsync, getExpireReleaseInstructionDataCodec, getExpireReleaseInstructionDataDecoder, getExpireReleaseInstructionDataEncoder, getGuardianAddedEventCodec, getGuardianAddedEventDecoder, getGuardianAddedEventDiscriminatorBytes, getGuardianAddedEventEncoder, getGuardianErrorMessage, getGuardianInfoCodec, getGuardianInfoDecoder, getGuardianInfoEncoder, getGuardianRegisteredEventCodec, getGuardianRegisteredEventDecoder, getGuardianRegisteredEventDiscriminatorBytes, getGuardianRegisteredEventEncoder, getGuardianRemovedEventCodec, getGuardianRemovedEventDecoder, getGuardianRemovedEventDiscriminatorBytes, getGuardianRemovedEventEncoder, getGuardianVoteAuthorityRotatedEventCodec, getGuardianVoteAuthorityRotatedEventDecoder, getGuardianVoteAuthorityRotatedEventDiscriminatorBytes, getGuardianVoteAuthorityRotatedEventEncoder, getGuardiansConfigCodec, getGuardiansConfigDecoder, getGuardiansConfigDiscriminatorBytes, getGuardiansConfigEncoder, getInitializeConfigDiscriminatorBytes, getInitializeConfigInstruction, getInitializeConfigInstructionAsync, getInitializeConfigInstructionDataCodec, getInitializeConfigInstructionDataDecoder, getInitializeConfigInstructionDataEncoder, getLateVoteWindow, getManifestChunks, getManifestCodec, getManifestDecoder, getManifestEncoder, getManifestHash, getPendingRegistryCodec, getPendingRegistryDecoder, getPendingRegistryDiscriminatorBytes, getPendingRegistryEncoder, getPendingRelease, getPendingReleaseCodec, getPendingReleaseDecoder, getPendingReleaseEncoder, getProposeAppAuthorityDiscriminatorBytes, getProposeAppAuthorityInstruction, getProposeAppAuthorityInstructionAsync, getProposeAppAuthorityInstructionDataCodec, getProposeAppAuthorityInstructionDataDecoder, getProposeAppAuthorityInstructionDataEncoder, getProposeConfigAuthorityDiscriminatorBytes, getProposeConfigAuthorityInstruction, getProposeConfigAuthorityInstructionAsync, getProposeConfigAuthorityInstructionDataCodec, getProposeConfigAuthorityInstructionDataDecoder, getProposeConfigAuthorityInstructionDataEncoder, getProposeReleaseDiscriminatorBytes, getProposeReleaseInstruction, getProposeReleaseInstructionAsync, getProposeReleaseInstructionDataCodec, getProposeReleaseInstructionDataDecoder, getProposeReleaseInstructionDataEncoder, getPublishedAppCodec, getPublishedAppDecoder, getPublishedAppEncoder, getRegisterAppDiscriminatorBytes, getRegisterAppInstruction, getRegisterAppInstructionAsync, getRegisterAppInstructionDataCodec, getRegisterAppInstructionDataDecoder, getRegisterAppInstructionDataEncoder, getRegisterGuardianDiscriminatorBytes, getRegisterGuardianInstruction, getRegisterGuardianInstructionAsync, getRegisterGuardianInstructionDataCodec, getRegisterGuardianInstructionDataDecoder, getRegisterGuardianInstructionDataEncoder, getReleaseApprovedEventCodec, getReleaseApprovedEventDecoder, getReleaseApprovedEventDiscriminatorBytes, getReleaseApprovedEventEncoder, getReleaseCancelledEventCodec, getReleaseCancelledEventDecoder, getReleaseCancelledEventDiscriminatorBytes, getReleaseCancelledEventEncoder, getReleaseExpiredEventCodec, getReleaseExpiredEventDecoder, getReleaseExpiredEventDiscriminatorBytes, getReleaseExpiredEventEncoder, getReleaseManifestCodec, getReleaseManifestDecoder, getReleaseManifestEncoder, getReleaseProposalStep, getReleaseProposedEventCodec, getReleaseProposedEventDecoder, getReleaseProposedEventDiscriminatorBytes, getReleaseProposedEventEncoder, getReleaseRejectedEventCodec, getReleaseRejectedEventDecoder, getReleaseRejectedEventDiscriminatorBytes, getReleaseRejectedEventEncoder, getReleaseResolutionCodec, getReleaseResolutionDecoder, getReleaseResolutionEncoder, getRemoveGuardianDiscriminatorBytes, getRemoveGuardianInstruction, getRemoveGuardianInstructionAsync, getRemoveGuardianInstructionDataCodec, getRemoveGuardianInstructionDataDecoder, getRemoveGuardianInstructionDataEncoder, getRotateVoteAuthorityDiscriminatorBytes, getRotateVoteAuthorityInstruction, getRotateVoteAuthorityInstructionAsync, getRotateVoteAuthorityInstructionDataCodec, getRotateVoteAuthorityInstructionDataDecoder, getRotateVoteAuthorityInstructionDataEncoder, getSetAppDeveloperDiscriminatorBytes, getSetAppDeveloperInstruction, getSetAppDeveloperInstructionAsync, getSetAppDeveloperInstructionDataCodec, getSetAppDeveloperInstructionDataDecoder, getSetAppDeveloperInstructionDataEncoder, getUpdateConfigDiscriminatorBytes, getUpdateConfigInstruction, getUpdateConfigInstructionAsync, getUpdateConfigInstructionDataCodec, getUpdateConfigInstructionDataDecoder, getUpdateConfigInstructionDataEncoder, getVoteCastEventCodec, getVoteCastEventDecoder, getVoteCastEventDiscriminatorBytes, getVoteCastEventEncoder, getVoteDiscriminatorBytes, getVoteFindingCodec, getVoteFindingDecoder, getVoteFindingEncoder, getVoteInstruction, getVoteInstructionAsync, getVoteInstructionDataCodec, getVoteInstructionDataDecoder, getVoteInstructionDataEncoder, getWriteReleaseManifestDiscriminatorBytes, getWriteReleaseManifestInstruction, getWriteReleaseManifestInstructionAsync, getWriteReleaseManifestInstructionDataCodec, getWriteReleaseManifestInstructionDataDecoder, getWriteReleaseManifestInstructionDataEncoder, guardianProgram, identifyGuardianAccount, identifyGuardianEvent, identifyGuardianInstruction, isGuardianError, isPendingRelease, parseAcceptAppAuthorityInstruction, parseAcceptConfigAuthorityInstruction, parseAddGuardianInstruction, parseAppAuthorityAcceptedEvent, parseAppAuthorityProposedEvent, parseAppDeveloperUpdatedEvent, parseAppRegisteredEvent, parseCancelReleaseInstruction, parseConfigAuthorityAcceptedEvent, parseConfigAuthorityProposedEvent, parseConfigInitializedEvent, parseConfigUpdatedEvent, parseExpireReleaseInstruction, parseGuardianAddedEvent, parseGuardianInstruction, parseGuardianRegisteredEvent, parseGuardianRemovedEvent, parseGuardianVoteAuthorityRotatedEvent, parseInitializeConfigInstruction, parseProposeAppAuthorityInstruction, parseProposeConfigAuthorityInstruction, parseProposeReleaseInstruction, parseRegisterAppInstruction, parseRegisterGuardianInstruction, parseReleaseApprovedEvent, parseReleaseCancelledEvent, parseReleaseExpiredEvent, parseReleaseProposedEvent, parseReleaseRejectedEvent, parseRemoveGuardianInstruction, parseRotateVoteAuthorityInstruction, parseSetAppDeveloperInstruction, parseUpdateConfigInstruction, parseVoteCastEvent, parseVoteInstruction, parseWriteReleaseManifestInstruction, pendingRelease };
|
|
4281
|
+
//# sourceMappingURL=index.mjs.map
|
|
4282
|
+
//# sourceMappingURL=index.mjs.map
|