@cascade-fyi/sati-sdk 0.2.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/dist/index.cjs +2323 -0
- package/dist/index.d.cts +1322 -0
- package/dist/index.d.mts +1322 -0
- package/dist/index.mjs +2174 -0
- package/idl.json +496 -0
- package/package.json +91 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2323 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
let __solana_kit = require("@solana/kit");
|
|
30
|
+
let __noble_hashes_sha3 = require("@noble/hashes/sha3");
|
|
31
|
+
let bs58 = require("bs58");
|
|
32
|
+
bs58 = __toESM(bs58);
|
|
33
|
+
let sas_lib = require("sas-lib");
|
|
34
|
+
let __solana_program_token_2022 = require("@solana-program/token-2022");
|
|
35
|
+
|
|
36
|
+
//#region src/generated/accounts/registryConfig.ts
|
|
37
|
+
/**
|
|
38
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
39
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
40
|
+
* to add features, then rerun Codama to update it.
|
|
41
|
+
*
|
|
42
|
+
* @see https://github.com/codama-idl/codama
|
|
43
|
+
*/
|
|
44
|
+
const REGISTRY_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
45
|
+
23,
|
|
46
|
+
118,
|
|
47
|
+
10,
|
|
48
|
+
246,
|
|
49
|
+
173,
|
|
50
|
+
231,
|
|
51
|
+
243,
|
|
52
|
+
156
|
|
53
|
+
]);
|
|
54
|
+
function getRegistryConfigDiscriminatorBytes() {
|
|
55
|
+
return (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(REGISTRY_CONFIG_DISCRIMINATOR);
|
|
56
|
+
}
|
|
57
|
+
/** Gets the encoder for {@link RegistryConfigArgs} account data. */
|
|
58
|
+
function getRegistryConfigEncoder() {
|
|
59
|
+
return (0, __solana_kit.transformEncoder)((0, __solana_kit.getStructEncoder)([
|
|
60
|
+
["discriminator", (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8)],
|
|
61
|
+
["groupMint", (0, __solana_kit.getAddressEncoder)()],
|
|
62
|
+
["authority", (0, __solana_kit.getAddressEncoder)()],
|
|
63
|
+
["totalAgents", (0, __solana_kit.getU64Encoder)()],
|
|
64
|
+
["bump", (0, __solana_kit.getU8Encoder)()]
|
|
65
|
+
]), (value) => ({
|
|
66
|
+
...value,
|
|
67
|
+
discriminator: REGISTRY_CONFIG_DISCRIMINATOR
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
/** Gets the decoder for {@link RegistryConfig} account data. */
|
|
71
|
+
function getRegistryConfigDecoder() {
|
|
72
|
+
return (0, __solana_kit.getStructDecoder)([
|
|
73
|
+
["discriminator", (0, __solana_kit.fixDecoderSize)((0, __solana_kit.getBytesDecoder)(), 8)],
|
|
74
|
+
["groupMint", (0, __solana_kit.getAddressDecoder)()],
|
|
75
|
+
["authority", (0, __solana_kit.getAddressDecoder)()],
|
|
76
|
+
["totalAgents", (0, __solana_kit.getU64Decoder)()],
|
|
77
|
+
["bump", (0, __solana_kit.getU8Decoder)()]
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
/** Gets the codec for {@link RegistryConfig} account data. */
|
|
81
|
+
function getRegistryConfigCodec() {
|
|
82
|
+
return (0, __solana_kit.combineCodec)(getRegistryConfigEncoder(), getRegistryConfigDecoder());
|
|
83
|
+
}
|
|
84
|
+
function decodeRegistryConfig(encodedAccount) {
|
|
85
|
+
return (0, __solana_kit.decodeAccount)(encodedAccount, getRegistryConfigDecoder());
|
|
86
|
+
}
|
|
87
|
+
async function fetchRegistryConfig(rpc, address$4, config) {
|
|
88
|
+
const maybeAccount = await fetchMaybeRegistryConfig(rpc, address$4, config);
|
|
89
|
+
(0, __solana_kit.assertAccountExists)(maybeAccount);
|
|
90
|
+
return maybeAccount;
|
|
91
|
+
}
|
|
92
|
+
async function fetchMaybeRegistryConfig(rpc, address$4, config) {
|
|
93
|
+
return decodeRegistryConfig(await (0, __solana_kit.fetchEncodedAccount)(rpc, address$4, config));
|
|
94
|
+
}
|
|
95
|
+
async function fetchAllRegistryConfig(rpc, addresses, config) {
|
|
96
|
+
const maybeAccounts = await fetchAllMaybeRegistryConfig(rpc, addresses, config);
|
|
97
|
+
(0, __solana_kit.assertAccountsExist)(maybeAccounts);
|
|
98
|
+
return maybeAccounts;
|
|
99
|
+
}
|
|
100
|
+
async function fetchAllMaybeRegistryConfig(rpc, addresses, config) {
|
|
101
|
+
return (await (0, __solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRegistryConfig(maybeAccount));
|
|
102
|
+
}
|
|
103
|
+
function getRegistryConfigSize() {
|
|
104
|
+
return 81;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/generated/programs/satiRegistry.ts
|
|
109
|
+
/**
|
|
110
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
111
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
112
|
+
* to add features, then rerun Codama to update it.
|
|
113
|
+
*
|
|
114
|
+
* @see https://github.com/codama-idl/codama
|
|
115
|
+
*/
|
|
116
|
+
const SATI_REGISTRY_PROGRAM_ADDRESS = "satiFVb9MDmfR4ZfRedyKPLGLCg3saQ7Wbxtx9AEeeF";
|
|
117
|
+
let SatiRegistryAccount = /* @__PURE__ */ function(SatiRegistryAccount$1) {
|
|
118
|
+
SatiRegistryAccount$1[SatiRegistryAccount$1["RegistryConfig"] = 0] = "RegistryConfig";
|
|
119
|
+
return SatiRegistryAccount$1;
|
|
120
|
+
}({});
|
|
121
|
+
function identifySatiRegistryAccount(account) {
|
|
122
|
+
if ((0, __solana_kit.containsBytes)("data" in account ? account.data : account, (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(new Uint8Array([
|
|
123
|
+
23,
|
|
124
|
+
118,
|
|
125
|
+
10,
|
|
126
|
+
246,
|
|
127
|
+
173,
|
|
128
|
+
231,
|
|
129
|
+
243,
|
|
130
|
+
156
|
|
131
|
+
])), 0)) return SatiRegistryAccount.RegistryConfig;
|
|
132
|
+
throw new Error("The provided account could not be identified as a satiRegistry account.");
|
|
133
|
+
}
|
|
134
|
+
let SatiRegistryInstruction = /* @__PURE__ */ function(SatiRegistryInstruction$1) {
|
|
135
|
+
SatiRegistryInstruction$1[SatiRegistryInstruction$1["Initialize"] = 0] = "Initialize";
|
|
136
|
+
SatiRegistryInstruction$1[SatiRegistryInstruction$1["RegisterAgent"] = 1] = "RegisterAgent";
|
|
137
|
+
SatiRegistryInstruction$1[SatiRegistryInstruction$1["UpdateRegistryAuthority"] = 2] = "UpdateRegistryAuthority";
|
|
138
|
+
return SatiRegistryInstruction$1;
|
|
139
|
+
}({});
|
|
140
|
+
function identifySatiRegistryInstruction(instruction) {
|
|
141
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
142
|
+
if ((0, __solana_kit.containsBytes)(data, (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(new Uint8Array([
|
|
143
|
+
175,
|
|
144
|
+
175,
|
|
145
|
+
109,
|
|
146
|
+
31,
|
|
147
|
+
13,
|
|
148
|
+
152,
|
|
149
|
+
155,
|
|
150
|
+
237
|
|
151
|
+
])), 0)) return SatiRegistryInstruction.Initialize;
|
|
152
|
+
if ((0, __solana_kit.containsBytes)(data, (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(new Uint8Array([
|
|
153
|
+
135,
|
|
154
|
+
157,
|
|
155
|
+
66,
|
|
156
|
+
195,
|
|
157
|
+
2,
|
|
158
|
+
113,
|
|
159
|
+
175,
|
|
160
|
+
30
|
|
161
|
+
])), 0)) return SatiRegistryInstruction.RegisterAgent;
|
|
162
|
+
if ((0, __solana_kit.containsBytes)(data, (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(new Uint8Array([
|
|
163
|
+
36,
|
|
164
|
+
103,
|
|
165
|
+
15,
|
|
166
|
+
149,
|
|
167
|
+
117,
|
|
168
|
+
134,
|
|
169
|
+
26,
|
|
170
|
+
41
|
|
171
|
+
])), 0)) return SatiRegistryInstruction.UpdateRegistryAuthority;
|
|
172
|
+
throw new Error("The provided instruction could not be identified as a satiRegistry instruction.");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/generated/errors/satiRegistry.ts
|
|
177
|
+
/**
|
|
178
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
179
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
180
|
+
* to add features, then rerun Codama to update it.
|
|
181
|
+
*
|
|
182
|
+
* @see https://github.com/codama-idl/codama
|
|
183
|
+
*/
|
|
184
|
+
/** InvalidGroupMint: Invalid group mint - must be owned by Token-2022 with TokenGroup extension */
|
|
185
|
+
const SATI_REGISTRY_ERROR__INVALID_GROUP_MINT = 6e3;
|
|
186
|
+
/** InvalidAuthority: Invalid authority */
|
|
187
|
+
const SATI_REGISTRY_ERROR__INVALID_AUTHORITY = 6001;
|
|
188
|
+
/** ImmutableAuthority: Authority is immutable (renounced) */
|
|
189
|
+
const SATI_REGISTRY_ERROR__IMMUTABLE_AUTHORITY = 6002;
|
|
190
|
+
/** NameTooLong: Name too long (max 32 bytes) */
|
|
191
|
+
const SATI_REGISTRY_ERROR__NAME_TOO_LONG = 6003;
|
|
192
|
+
/** SymbolTooLong: Symbol too long (max 10 bytes) */
|
|
193
|
+
const SATI_REGISTRY_ERROR__SYMBOL_TOO_LONG = 6004;
|
|
194
|
+
/** UriTooLong: URI too long (max 200 bytes) */
|
|
195
|
+
const SATI_REGISTRY_ERROR__URI_TOO_LONG = 6005;
|
|
196
|
+
/** TooManyMetadataEntries: Too many metadata entries (max 10) */
|
|
197
|
+
const SATI_REGISTRY_ERROR__TOO_MANY_METADATA_ENTRIES = 6006;
|
|
198
|
+
/** MetadataKeyTooLong: Metadata key too long (max 32 bytes) */
|
|
199
|
+
const SATI_REGISTRY_ERROR__METADATA_KEY_TOO_LONG = 6007;
|
|
200
|
+
/** MetadataValueTooLong: Metadata value too long (max 200 bytes) */
|
|
201
|
+
const SATI_REGISTRY_ERROR__METADATA_VALUE_TOO_LONG = 6008;
|
|
202
|
+
/** Overflow: Arithmetic overflow */
|
|
203
|
+
const SATI_REGISTRY_ERROR__OVERFLOW = 6009;
|
|
204
|
+
/** MintAuthorityNotRenounced: Failed to renounce mint authority - supply guarantee violated */
|
|
205
|
+
const SATI_REGISTRY_ERROR__MINT_AUTHORITY_NOT_RENOUNCED = 6010;
|
|
206
|
+
let satiRegistryErrorMessages;
|
|
207
|
+
if (process.env.NODE_ENV !== "production") satiRegistryErrorMessages = {
|
|
208
|
+
[SATI_REGISTRY_ERROR__IMMUTABLE_AUTHORITY]: `Authority is immutable (renounced)`,
|
|
209
|
+
[SATI_REGISTRY_ERROR__INVALID_AUTHORITY]: `Invalid authority`,
|
|
210
|
+
[SATI_REGISTRY_ERROR__INVALID_GROUP_MINT]: `Invalid group mint - must be owned by Token-2022 with TokenGroup extension`,
|
|
211
|
+
[SATI_REGISTRY_ERROR__METADATA_KEY_TOO_LONG]: `Metadata key too long (max 32 bytes)`,
|
|
212
|
+
[SATI_REGISTRY_ERROR__METADATA_VALUE_TOO_LONG]: `Metadata value too long (max 200 bytes)`,
|
|
213
|
+
[SATI_REGISTRY_ERROR__MINT_AUTHORITY_NOT_RENOUNCED]: `Failed to renounce mint authority - supply guarantee violated`,
|
|
214
|
+
[SATI_REGISTRY_ERROR__NAME_TOO_LONG]: `Name too long (max 32 bytes)`,
|
|
215
|
+
[SATI_REGISTRY_ERROR__OVERFLOW]: `Arithmetic overflow`,
|
|
216
|
+
[SATI_REGISTRY_ERROR__SYMBOL_TOO_LONG]: `Symbol too long (max 10 bytes)`,
|
|
217
|
+
[SATI_REGISTRY_ERROR__TOO_MANY_METADATA_ENTRIES]: `Too many metadata entries (max 10)`,
|
|
218
|
+
[SATI_REGISTRY_ERROR__URI_TOO_LONG]: `URI too long (max 200 bytes)`
|
|
219
|
+
};
|
|
220
|
+
function getSatiRegistryErrorMessage(code) {
|
|
221
|
+
if (process.env.NODE_ENV !== "production") return satiRegistryErrorMessages[code];
|
|
222
|
+
return "Error message not available in production bundles.";
|
|
223
|
+
}
|
|
224
|
+
function isSatiRegistryError(error, transactionMessage, code) {
|
|
225
|
+
return (0, __solana_kit.isProgramError)(error, transactionMessage, SATI_REGISTRY_PROGRAM_ADDRESS, code);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/generated/shared/index.ts
|
|
230
|
+
/**
|
|
231
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
232
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
233
|
+
* to add features, then rerun Codama to update it.
|
|
234
|
+
*
|
|
235
|
+
* @see https://github.com/codama-idl/codama
|
|
236
|
+
*/
|
|
237
|
+
/**
|
|
238
|
+
* Asserts that the given value is a PublicKey.
|
|
239
|
+
* @internal
|
|
240
|
+
*/
|
|
241
|
+
function expectAddress(value) {
|
|
242
|
+
if (!value) throw new Error("Expected a Address.");
|
|
243
|
+
if (typeof value === "object" && "address" in value) return value.address;
|
|
244
|
+
if (Array.isArray(value)) return value[0];
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get account metas and signers from resolved accounts.
|
|
249
|
+
* @internal
|
|
250
|
+
*/
|
|
251
|
+
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
252
|
+
return (account) => {
|
|
253
|
+
if (!account.value) {
|
|
254
|
+
if (optionalAccountStrategy === "omitted") return;
|
|
255
|
+
return Object.freeze({
|
|
256
|
+
address: programAddress,
|
|
257
|
+
role: __solana_kit.AccountRole.READONLY
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const writableRole = account.isWritable ? __solana_kit.AccountRole.WRITABLE : __solana_kit.AccountRole.READONLY;
|
|
261
|
+
return Object.freeze({
|
|
262
|
+
address: expectAddress(account.value),
|
|
263
|
+
role: isTransactionSigner(account.value) ? (0, __solana_kit.upgradeRoleToSigner)(writableRole) : writableRole,
|
|
264
|
+
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function isTransactionSigner(value) {
|
|
269
|
+
return !!value && typeof value === "object" && "address" in value && (0, __solana_kit.isTransactionSigner)(value);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/generated/instructions/initialize.ts
|
|
274
|
+
/**
|
|
275
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
276
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
277
|
+
* to add features, then rerun Codama to update it.
|
|
278
|
+
*
|
|
279
|
+
* @see https://github.com/codama-idl/codama
|
|
280
|
+
*/
|
|
281
|
+
const INITIALIZE_DISCRIMINATOR = new Uint8Array([
|
|
282
|
+
175,
|
|
283
|
+
175,
|
|
284
|
+
109,
|
|
285
|
+
31,
|
|
286
|
+
13,
|
|
287
|
+
152,
|
|
288
|
+
155,
|
|
289
|
+
237
|
|
290
|
+
]);
|
|
291
|
+
function getInitializeDiscriminatorBytes() {
|
|
292
|
+
return (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(INITIALIZE_DISCRIMINATOR);
|
|
293
|
+
}
|
|
294
|
+
function getInitializeInstructionDataEncoder() {
|
|
295
|
+
return (0, __solana_kit.transformEncoder)((0, __solana_kit.getStructEncoder)([["discriminator", (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8)]]), (value) => ({
|
|
296
|
+
...value,
|
|
297
|
+
discriminator: INITIALIZE_DISCRIMINATOR
|
|
298
|
+
}));
|
|
299
|
+
}
|
|
300
|
+
function getInitializeInstructionDataDecoder() {
|
|
301
|
+
return (0, __solana_kit.getStructDecoder)([["discriminator", (0, __solana_kit.fixDecoderSize)((0, __solana_kit.getBytesDecoder)(), 8)]]);
|
|
302
|
+
}
|
|
303
|
+
function getInitializeInstructionDataCodec() {
|
|
304
|
+
return (0, __solana_kit.combineCodec)(getInitializeInstructionDataEncoder(), getInitializeInstructionDataDecoder());
|
|
305
|
+
}
|
|
306
|
+
async function getInitializeInstructionAsync(input, config) {
|
|
307
|
+
const programAddress = config?.programAddress ?? SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
308
|
+
const accounts = {
|
|
309
|
+
authority: {
|
|
310
|
+
value: input.authority ?? null,
|
|
311
|
+
isWritable: true
|
|
312
|
+
},
|
|
313
|
+
registryConfig: {
|
|
314
|
+
value: input.registryConfig ?? null,
|
|
315
|
+
isWritable: true
|
|
316
|
+
},
|
|
317
|
+
groupMint: {
|
|
318
|
+
value: input.groupMint ?? null,
|
|
319
|
+
isWritable: true
|
|
320
|
+
},
|
|
321
|
+
systemProgram: {
|
|
322
|
+
value: input.systemProgram ?? null,
|
|
323
|
+
isWritable: false
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
if (!accounts.registryConfig.value) accounts.registryConfig.value = await (0, __solana_kit.getProgramDerivedAddress)({
|
|
327
|
+
programAddress,
|
|
328
|
+
seeds: [(0, __solana_kit.getBytesEncoder)().encode(new Uint8Array([
|
|
329
|
+
114,
|
|
330
|
+
101,
|
|
331
|
+
103,
|
|
332
|
+
105,
|
|
333
|
+
115,
|
|
334
|
+
116,
|
|
335
|
+
114,
|
|
336
|
+
121
|
|
337
|
+
]))]
|
|
338
|
+
});
|
|
339
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
340
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
341
|
+
return Object.freeze({
|
|
342
|
+
accounts: [
|
|
343
|
+
getAccountMeta(accounts.authority),
|
|
344
|
+
getAccountMeta(accounts.registryConfig),
|
|
345
|
+
getAccountMeta(accounts.groupMint),
|
|
346
|
+
getAccountMeta(accounts.systemProgram)
|
|
347
|
+
],
|
|
348
|
+
data: getInitializeInstructionDataEncoder().encode({}),
|
|
349
|
+
programAddress
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
function getInitializeInstruction(input, config) {
|
|
353
|
+
const programAddress = config?.programAddress ?? SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
354
|
+
const accounts = {
|
|
355
|
+
authority: {
|
|
356
|
+
value: input.authority ?? null,
|
|
357
|
+
isWritable: true
|
|
358
|
+
},
|
|
359
|
+
registryConfig: {
|
|
360
|
+
value: input.registryConfig ?? null,
|
|
361
|
+
isWritable: true
|
|
362
|
+
},
|
|
363
|
+
groupMint: {
|
|
364
|
+
value: input.groupMint ?? null,
|
|
365
|
+
isWritable: true
|
|
366
|
+
},
|
|
367
|
+
systemProgram: {
|
|
368
|
+
value: input.systemProgram ?? null,
|
|
369
|
+
isWritable: false
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
373
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
374
|
+
return Object.freeze({
|
|
375
|
+
accounts: [
|
|
376
|
+
getAccountMeta(accounts.authority),
|
|
377
|
+
getAccountMeta(accounts.registryConfig),
|
|
378
|
+
getAccountMeta(accounts.groupMint),
|
|
379
|
+
getAccountMeta(accounts.systemProgram)
|
|
380
|
+
],
|
|
381
|
+
data: getInitializeInstructionDataEncoder().encode({}),
|
|
382
|
+
programAddress
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function parseInitializeInstruction(instruction) {
|
|
386
|
+
if (instruction.accounts.length < 4) throw new Error("Not enough accounts");
|
|
387
|
+
let accountIndex = 0;
|
|
388
|
+
const getNextAccount = () => {
|
|
389
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
390
|
+
accountIndex += 1;
|
|
391
|
+
return accountMeta;
|
|
392
|
+
};
|
|
393
|
+
return {
|
|
394
|
+
programAddress: instruction.programAddress,
|
|
395
|
+
accounts: {
|
|
396
|
+
authority: getNextAccount(),
|
|
397
|
+
registryConfig: getNextAccount(),
|
|
398
|
+
groupMint: getNextAccount(),
|
|
399
|
+
systemProgram: getNextAccount()
|
|
400
|
+
},
|
|
401
|
+
data: getInitializeInstructionDataDecoder().decode(instruction.data)
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/generated/types/agentRegistered.ts
|
|
407
|
+
/**
|
|
408
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
409
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
410
|
+
* to add features, then rerun Codama to update it.
|
|
411
|
+
*
|
|
412
|
+
* @see https://github.com/codama-idl/codama
|
|
413
|
+
*/
|
|
414
|
+
function getAgentRegisteredEncoder() {
|
|
415
|
+
return (0, __solana_kit.getStructEncoder)([
|
|
416
|
+
["mint", (0, __solana_kit.getAddressEncoder)()],
|
|
417
|
+
["owner", (0, __solana_kit.getAddressEncoder)()],
|
|
418
|
+
["memberNumber", (0, __solana_kit.getU64Encoder)()],
|
|
419
|
+
["name", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())],
|
|
420
|
+
["uri", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())],
|
|
421
|
+
["nonTransferable", (0, __solana_kit.getBooleanEncoder)()]
|
|
422
|
+
]);
|
|
423
|
+
}
|
|
424
|
+
function getAgentRegisteredDecoder() {
|
|
425
|
+
return (0, __solana_kit.getStructDecoder)([
|
|
426
|
+
["mint", (0, __solana_kit.getAddressDecoder)()],
|
|
427
|
+
["owner", (0, __solana_kit.getAddressDecoder)()],
|
|
428
|
+
["memberNumber", (0, __solana_kit.getU64Decoder)()],
|
|
429
|
+
["name", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())],
|
|
430
|
+
["uri", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())],
|
|
431
|
+
["nonTransferable", (0, __solana_kit.getBooleanDecoder)()]
|
|
432
|
+
]);
|
|
433
|
+
}
|
|
434
|
+
function getAgentRegisteredCodec() {
|
|
435
|
+
return (0, __solana_kit.combineCodec)(getAgentRegisteredEncoder(), getAgentRegisteredDecoder());
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/generated/types/metadataEntry.ts
|
|
440
|
+
/**
|
|
441
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
442
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
443
|
+
* to add features, then rerun Codama to update it.
|
|
444
|
+
*
|
|
445
|
+
* @see https://github.com/codama-idl/codama
|
|
446
|
+
*/
|
|
447
|
+
function getMetadataEntryEncoder() {
|
|
448
|
+
return (0, __solana_kit.getStructEncoder)([["key", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())], ["value", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())]]);
|
|
449
|
+
}
|
|
450
|
+
function getMetadataEntryDecoder() {
|
|
451
|
+
return (0, __solana_kit.getStructDecoder)([["key", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())], ["value", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())]]);
|
|
452
|
+
}
|
|
453
|
+
function getMetadataEntryCodec() {
|
|
454
|
+
return (0, __solana_kit.combineCodec)(getMetadataEntryEncoder(), getMetadataEntryDecoder());
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/generated/types/registryAuthorityUpdated.ts
|
|
459
|
+
/**
|
|
460
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
461
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
462
|
+
* to add features, then rerun Codama to update it.
|
|
463
|
+
*
|
|
464
|
+
* @see https://github.com/codama-idl/codama
|
|
465
|
+
*/
|
|
466
|
+
function getRegistryAuthorityUpdatedEncoder() {
|
|
467
|
+
return (0, __solana_kit.getStructEncoder)([["oldAuthority", (0, __solana_kit.getAddressEncoder)()], ["newAuthority", (0, __solana_kit.getOptionEncoder)((0, __solana_kit.getAddressEncoder)())]]);
|
|
468
|
+
}
|
|
469
|
+
function getRegistryAuthorityUpdatedDecoder() {
|
|
470
|
+
return (0, __solana_kit.getStructDecoder)([["oldAuthority", (0, __solana_kit.getAddressDecoder)()], ["newAuthority", (0, __solana_kit.getOptionDecoder)((0, __solana_kit.getAddressDecoder)())]]);
|
|
471
|
+
}
|
|
472
|
+
function getRegistryAuthorityUpdatedCodec() {
|
|
473
|
+
return (0, __solana_kit.combineCodec)(getRegistryAuthorityUpdatedEncoder(), getRegistryAuthorityUpdatedDecoder());
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/generated/types/registryInitialized.ts
|
|
478
|
+
/**
|
|
479
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
480
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
481
|
+
* to add features, then rerun Codama to update it.
|
|
482
|
+
*
|
|
483
|
+
* @see https://github.com/codama-idl/codama
|
|
484
|
+
*/
|
|
485
|
+
function getRegistryInitializedEncoder() {
|
|
486
|
+
return (0, __solana_kit.getStructEncoder)([["authority", (0, __solana_kit.getAddressEncoder)()], ["groupMint", (0, __solana_kit.getAddressEncoder)()]]);
|
|
487
|
+
}
|
|
488
|
+
function getRegistryInitializedDecoder() {
|
|
489
|
+
return (0, __solana_kit.getStructDecoder)([["authority", (0, __solana_kit.getAddressDecoder)()], ["groupMint", (0, __solana_kit.getAddressDecoder)()]]);
|
|
490
|
+
}
|
|
491
|
+
function getRegistryInitializedCodec() {
|
|
492
|
+
return (0, __solana_kit.combineCodec)(getRegistryInitializedEncoder(), getRegistryInitializedDecoder());
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/generated/instructions/registerAgent.ts
|
|
497
|
+
/**
|
|
498
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
499
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
500
|
+
* to add features, then rerun Codama to update it.
|
|
501
|
+
*
|
|
502
|
+
* @see https://github.com/codama-idl/codama
|
|
503
|
+
*/
|
|
504
|
+
const REGISTER_AGENT_DISCRIMINATOR = new Uint8Array([
|
|
505
|
+
135,
|
|
506
|
+
157,
|
|
507
|
+
66,
|
|
508
|
+
195,
|
|
509
|
+
2,
|
|
510
|
+
113,
|
|
511
|
+
175,
|
|
512
|
+
30
|
|
513
|
+
]);
|
|
514
|
+
function getRegisterAgentDiscriminatorBytes() {
|
|
515
|
+
return (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(REGISTER_AGENT_DISCRIMINATOR);
|
|
516
|
+
}
|
|
517
|
+
function getRegisterAgentInstructionDataEncoder() {
|
|
518
|
+
return (0, __solana_kit.transformEncoder)((0, __solana_kit.getStructEncoder)([
|
|
519
|
+
["discriminator", (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8)],
|
|
520
|
+
["name", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())],
|
|
521
|
+
["symbol", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())],
|
|
522
|
+
["uri", (0, __solana_kit.addEncoderSizePrefix)((0, __solana_kit.getUtf8Encoder)(), (0, __solana_kit.getU32Encoder)())],
|
|
523
|
+
["additionalMetadata", (0, __solana_kit.getOptionEncoder)((0, __solana_kit.getArrayEncoder)(getMetadataEntryEncoder()))],
|
|
524
|
+
["nonTransferable", (0, __solana_kit.getBooleanEncoder)()]
|
|
525
|
+
]), (value) => ({
|
|
526
|
+
...value,
|
|
527
|
+
discriminator: REGISTER_AGENT_DISCRIMINATOR
|
|
528
|
+
}));
|
|
529
|
+
}
|
|
530
|
+
function getRegisterAgentInstructionDataDecoder() {
|
|
531
|
+
return (0, __solana_kit.getStructDecoder)([
|
|
532
|
+
["discriminator", (0, __solana_kit.fixDecoderSize)((0, __solana_kit.getBytesDecoder)(), 8)],
|
|
533
|
+
["name", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())],
|
|
534
|
+
["symbol", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())],
|
|
535
|
+
["uri", (0, __solana_kit.addDecoderSizePrefix)((0, __solana_kit.getUtf8Decoder)(), (0, __solana_kit.getU32Decoder)())],
|
|
536
|
+
["additionalMetadata", (0, __solana_kit.getOptionDecoder)((0, __solana_kit.getArrayDecoder)(getMetadataEntryDecoder()))],
|
|
537
|
+
["nonTransferable", (0, __solana_kit.getBooleanDecoder)()]
|
|
538
|
+
]);
|
|
539
|
+
}
|
|
540
|
+
function getRegisterAgentInstructionDataCodec() {
|
|
541
|
+
return (0, __solana_kit.combineCodec)(getRegisterAgentInstructionDataEncoder(), getRegisterAgentInstructionDataDecoder());
|
|
542
|
+
}
|
|
543
|
+
async function getRegisterAgentInstructionAsync(input, config) {
|
|
544
|
+
const programAddress = config?.programAddress ?? SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
545
|
+
const accounts = {
|
|
546
|
+
payer: {
|
|
547
|
+
value: input.payer ?? null,
|
|
548
|
+
isWritable: true
|
|
549
|
+
},
|
|
550
|
+
owner: {
|
|
551
|
+
value: input.owner ?? null,
|
|
552
|
+
isWritable: false
|
|
553
|
+
},
|
|
554
|
+
registryConfig: {
|
|
555
|
+
value: input.registryConfig ?? null,
|
|
556
|
+
isWritable: true
|
|
557
|
+
},
|
|
558
|
+
groupMint: {
|
|
559
|
+
value: input.groupMint ?? null,
|
|
560
|
+
isWritable: true
|
|
561
|
+
},
|
|
562
|
+
agentMint: {
|
|
563
|
+
value: input.agentMint ?? null,
|
|
564
|
+
isWritable: true
|
|
565
|
+
},
|
|
566
|
+
agentTokenAccount: {
|
|
567
|
+
value: input.agentTokenAccount ?? null,
|
|
568
|
+
isWritable: true
|
|
569
|
+
},
|
|
570
|
+
token2022Program: {
|
|
571
|
+
value: input.token2022Program ?? null,
|
|
572
|
+
isWritable: false
|
|
573
|
+
},
|
|
574
|
+
associatedTokenProgram: {
|
|
575
|
+
value: input.associatedTokenProgram ?? null,
|
|
576
|
+
isWritable: false
|
|
577
|
+
},
|
|
578
|
+
systemProgram: {
|
|
579
|
+
value: input.systemProgram ?? null,
|
|
580
|
+
isWritable: false
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
const args = { ...input };
|
|
584
|
+
if (!accounts.registryConfig.value) accounts.registryConfig.value = await (0, __solana_kit.getProgramDerivedAddress)({
|
|
585
|
+
programAddress,
|
|
586
|
+
seeds: [(0, __solana_kit.getBytesEncoder)().encode(new Uint8Array([
|
|
587
|
+
114,
|
|
588
|
+
101,
|
|
589
|
+
103,
|
|
590
|
+
105,
|
|
591
|
+
115,
|
|
592
|
+
116,
|
|
593
|
+
114,
|
|
594
|
+
121
|
|
595
|
+
]))]
|
|
596
|
+
});
|
|
597
|
+
if (!accounts.token2022Program.value) accounts.token2022Program.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
598
|
+
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
599
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
600
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
601
|
+
return Object.freeze({
|
|
602
|
+
accounts: [
|
|
603
|
+
getAccountMeta(accounts.payer),
|
|
604
|
+
getAccountMeta(accounts.owner),
|
|
605
|
+
getAccountMeta(accounts.registryConfig),
|
|
606
|
+
getAccountMeta(accounts.groupMint),
|
|
607
|
+
getAccountMeta(accounts.agentMint),
|
|
608
|
+
getAccountMeta(accounts.agentTokenAccount),
|
|
609
|
+
getAccountMeta(accounts.token2022Program),
|
|
610
|
+
getAccountMeta(accounts.associatedTokenProgram),
|
|
611
|
+
getAccountMeta(accounts.systemProgram)
|
|
612
|
+
],
|
|
613
|
+
data: getRegisterAgentInstructionDataEncoder().encode(args),
|
|
614
|
+
programAddress
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
function getRegisterAgentInstruction(input, config) {
|
|
618
|
+
const programAddress = config?.programAddress ?? SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
619
|
+
const accounts = {
|
|
620
|
+
payer: {
|
|
621
|
+
value: input.payer ?? null,
|
|
622
|
+
isWritable: true
|
|
623
|
+
},
|
|
624
|
+
owner: {
|
|
625
|
+
value: input.owner ?? null,
|
|
626
|
+
isWritable: false
|
|
627
|
+
},
|
|
628
|
+
registryConfig: {
|
|
629
|
+
value: input.registryConfig ?? null,
|
|
630
|
+
isWritable: true
|
|
631
|
+
},
|
|
632
|
+
groupMint: {
|
|
633
|
+
value: input.groupMint ?? null,
|
|
634
|
+
isWritable: true
|
|
635
|
+
},
|
|
636
|
+
agentMint: {
|
|
637
|
+
value: input.agentMint ?? null,
|
|
638
|
+
isWritable: true
|
|
639
|
+
},
|
|
640
|
+
agentTokenAccount: {
|
|
641
|
+
value: input.agentTokenAccount ?? null,
|
|
642
|
+
isWritable: true
|
|
643
|
+
},
|
|
644
|
+
token2022Program: {
|
|
645
|
+
value: input.token2022Program ?? null,
|
|
646
|
+
isWritable: false
|
|
647
|
+
},
|
|
648
|
+
associatedTokenProgram: {
|
|
649
|
+
value: input.associatedTokenProgram ?? null,
|
|
650
|
+
isWritable: false
|
|
651
|
+
},
|
|
652
|
+
systemProgram: {
|
|
653
|
+
value: input.systemProgram ?? null,
|
|
654
|
+
isWritable: false
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
const args = { ...input };
|
|
658
|
+
if (!accounts.token2022Program.value) accounts.token2022Program.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
659
|
+
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
660
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
661
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
662
|
+
return Object.freeze({
|
|
663
|
+
accounts: [
|
|
664
|
+
getAccountMeta(accounts.payer),
|
|
665
|
+
getAccountMeta(accounts.owner),
|
|
666
|
+
getAccountMeta(accounts.registryConfig),
|
|
667
|
+
getAccountMeta(accounts.groupMint),
|
|
668
|
+
getAccountMeta(accounts.agentMint),
|
|
669
|
+
getAccountMeta(accounts.agentTokenAccount),
|
|
670
|
+
getAccountMeta(accounts.token2022Program),
|
|
671
|
+
getAccountMeta(accounts.associatedTokenProgram),
|
|
672
|
+
getAccountMeta(accounts.systemProgram)
|
|
673
|
+
],
|
|
674
|
+
data: getRegisterAgentInstructionDataEncoder().encode(args),
|
|
675
|
+
programAddress
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
function parseRegisterAgentInstruction(instruction) {
|
|
679
|
+
if (instruction.accounts.length < 9) throw new Error("Not enough accounts");
|
|
680
|
+
let accountIndex = 0;
|
|
681
|
+
const getNextAccount = () => {
|
|
682
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
683
|
+
accountIndex += 1;
|
|
684
|
+
return accountMeta;
|
|
685
|
+
};
|
|
686
|
+
return {
|
|
687
|
+
programAddress: instruction.programAddress,
|
|
688
|
+
accounts: {
|
|
689
|
+
payer: getNextAccount(),
|
|
690
|
+
owner: getNextAccount(),
|
|
691
|
+
registryConfig: getNextAccount(),
|
|
692
|
+
groupMint: getNextAccount(),
|
|
693
|
+
agentMint: getNextAccount(),
|
|
694
|
+
agentTokenAccount: getNextAccount(),
|
|
695
|
+
token2022Program: getNextAccount(),
|
|
696
|
+
associatedTokenProgram: getNextAccount(),
|
|
697
|
+
systemProgram: getNextAccount()
|
|
698
|
+
},
|
|
699
|
+
data: getRegisterAgentInstructionDataDecoder().decode(instruction.data)
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/generated/instructions/updateRegistryAuthority.ts
|
|
705
|
+
/**
|
|
706
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
707
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
708
|
+
* to add features, then rerun Codama to update it.
|
|
709
|
+
*
|
|
710
|
+
* @see https://github.com/codama-idl/codama
|
|
711
|
+
*/
|
|
712
|
+
const UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
713
|
+
36,
|
|
714
|
+
103,
|
|
715
|
+
15,
|
|
716
|
+
149,
|
|
717
|
+
117,
|
|
718
|
+
134,
|
|
719
|
+
26,
|
|
720
|
+
41
|
|
721
|
+
]);
|
|
722
|
+
function getUpdateRegistryAuthorityDiscriminatorBytes() {
|
|
723
|
+
return (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8).encode(UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR);
|
|
724
|
+
}
|
|
725
|
+
function getUpdateRegistryAuthorityInstructionDataEncoder() {
|
|
726
|
+
return (0, __solana_kit.transformEncoder)((0, __solana_kit.getStructEncoder)([["discriminator", (0, __solana_kit.fixEncoderSize)((0, __solana_kit.getBytesEncoder)(), 8)], ["newAuthority", (0, __solana_kit.getOptionEncoder)((0, __solana_kit.getAddressEncoder)())]]), (value) => ({
|
|
727
|
+
...value,
|
|
728
|
+
discriminator: UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR
|
|
729
|
+
}));
|
|
730
|
+
}
|
|
731
|
+
function getUpdateRegistryAuthorityInstructionDataDecoder() {
|
|
732
|
+
return (0, __solana_kit.getStructDecoder)([["discriminator", (0, __solana_kit.fixDecoderSize)((0, __solana_kit.getBytesDecoder)(), 8)], ["newAuthority", (0, __solana_kit.getOptionDecoder)((0, __solana_kit.getAddressDecoder)())]]);
|
|
733
|
+
}
|
|
734
|
+
function getUpdateRegistryAuthorityInstructionDataCodec() {
|
|
735
|
+
return (0, __solana_kit.combineCodec)(getUpdateRegistryAuthorityInstructionDataEncoder(), getUpdateRegistryAuthorityInstructionDataDecoder());
|
|
736
|
+
}
|
|
737
|
+
async function getUpdateRegistryAuthorityInstructionAsync(input, config) {
|
|
738
|
+
const programAddress = config?.programAddress ?? SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
739
|
+
const accounts = {
|
|
740
|
+
authority: {
|
|
741
|
+
value: input.authority ?? null,
|
|
742
|
+
isWritable: false
|
|
743
|
+
},
|
|
744
|
+
registryConfig: {
|
|
745
|
+
value: input.registryConfig ?? null,
|
|
746
|
+
isWritable: true
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
const args = { ...input };
|
|
750
|
+
if (!accounts.registryConfig.value) accounts.registryConfig.value = await (0, __solana_kit.getProgramDerivedAddress)({
|
|
751
|
+
programAddress,
|
|
752
|
+
seeds: [(0, __solana_kit.getBytesEncoder)().encode(new Uint8Array([
|
|
753
|
+
114,
|
|
754
|
+
101,
|
|
755
|
+
103,
|
|
756
|
+
105,
|
|
757
|
+
115,
|
|
758
|
+
116,
|
|
759
|
+
114,
|
|
760
|
+
121
|
|
761
|
+
]))]
|
|
762
|
+
});
|
|
763
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
764
|
+
return Object.freeze({
|
|
765
|
+
accounts: [getAccountMeta(accounts.authority), getAccountMeta(accounts.registryConfig)],
|
|
766
|
+
data: getUpdateRegistryAuthorityInstructionDataEncoder().encode(args),
|
|
767
|
+
programAddress
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
function getUpdateRegistryAuthorityInstruction(input, config) {
|
|
771
|
+
const programAddress = config?.programAddress ?? SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
772
|
+
const accounts = {
|
|
773
|
+
authority: {
|
|
774
|
+
value: input.authority ?? null,
|
|
775
|
+
isWritable: false
|
|
776
|
+
},
|
|
777
|
+
registryConfig: {
|
|
778
|
+
value: input.registryConfig ?? null,
|
|
779
|
+
isWritable: true
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
const args = { ...input };
|
|
783
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
784
|
+
return Object.freeze({
|
|
785
|
+
accounts: [getAccountMeta(accounts.authority), getAccountMeta(accounts.registryConfig)],
|
|
786
|
+
data: getUpdateRegistryAuthorityInstructionDataEncoder().encode(args),
|
|
787
|
+
programAddress
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
function parseUpdateRegistryAuthorityInstruction(instruction) {
|
|
791
|
+
if (instruction.accounts.length < 2) throw new Error("Not enough accounts");
|
|
792
|
+
let accountIndex = 0;
|
|
793
|
+
const getNextAccount = () => {
|
|
794
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
795
|
+
accountIndex += 1;
|
|
796
|
+
return accountMeta;
|
|
797
|
+
};
|
|
798
|
+
return {
|
|
799
|
+
programAddress: instruction.programAddress,
|
|
800
|
+
accounts: {
|
|
801
|
+
authority: getNextAccount(),
|
|
802
|
+
registryConfig: getNextAccount()
|
|
803
|
+
},
|
|
804
|
+
data: getUpdateRegistryAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
//#endregion
|
|
809
|
+
//#region src/schemas.ts
|
|
810
|
+
/**
|
|
811
|
+
* SATI SAS Schema Definitions
|
|
812
|
+
*
|
|
813
|
+
* Schema definitions for Solana Attestation Service (SAS) attestations.
|
|
814
|
+
* These schemas define the data structures for SATI reputation and validation.
|
|
815
|
+
*/
|
|
816
|
+
/**
|
|
817
|
+
* SAS Layout Types
|
|
818
|
+
*
|
|
819
|
+
* Type-safe enum for schema field layout definitions.
|
|
820
|
+
* These map to the SAS program's internal type codes.
|
|
821
|
+
*
|
|
822
|
+
* @see https://github.com/solana-foundation/solana-attestation-service
|
|
823
|
+
*/
|
|
824
|
+
let SASLayoutType = /* @__PURE__ */ function(SASLayoutType$1) {
|
|
825
|
+
/** Unsigned 8-bit integer (0-255) */
|
|
826
|
+
SASLayoutType$1[SASLayoutType$1["U8"] = 0] = "U8";
|
|
827
|
+
/** Unsigned 16-bit integer (0-65535) */
|
|
828
|
+
SASLayoutType$1[SASLayoutType$1["U16"] = 1] = "U16";
|
|
829
|
+
/** Unsigned 32-bit integer */
|
|
830
|
+
SASLayoutType$1[SASLayoutType$1["U32"] = 2] = "U32";
|
|
831
|
+
/** Unsigned 64-bit integer */
|
|
832
|
+
SASLayoutType$1[SASLayoutType$1["U64"] = 3] = "U64";
|
|
833
|
+
/** Unsigned 128-bit integer */
|
|
834
|
+
SASLayoutType$1[SASLayoutType$1["U128"] = 4] = "U128";
|
|
835
|
+
/** Signed 8-bit integer */
|
|
836
|
+
SASLayoutType$1[SASLayoutType$1["I8"] = 5] = "I8";
|
|
837
|
+
/** Signed 16-bit integer */
|
|
838
|
+
SASLayoutType$1[SASLayoutType$1["I16"] = 6] = "I16";
|
|
839
|
+
/** Signed 32-bit integer */
|
|
840
|
+
SASLayoutType$1[SASLayoutType$1["I32"] = 7] = "I32";
|
|
841
|
+
/** Signed 64-bit integer (for timestamps) */
|
|
842
|
+
SASLayoutType$1[SASLayoutType$1["I64"] = 8] = "I64";
|
|
843
|
+
/** Signed 128-bit integer */
|
|
844
|
+
SASLayoutType$1[SASLayoutType$1["I128"] = 9] = "I128";
|
|
845
|
+
/** Boolean */
|
|
846
|
+
SASLayoutType$1[SASLayoutType$1["Bool"] = 10] = "Bool";
|
|
847
|
+
/** Single character */
|
|
848
|
+
SASLayoutType$1[SASLayoutType$1["Char"] = 11] = "Char";
|
|
849
|
+
/** UTF-8 string with 4-byte length prefix */
|
|
850
|
+
SASLayoutType$1[SASLayoutType$1["String"] = 12] = "String";
|
|
851
|
+
/** Byte array with 4-byte length prefix */
|
|
852
|
+
SASLayoutType$1[SASLayoutType$1["VecU8"] = 13] = "VecU8";
|
|
853
|
+
return SASLayoutType$1;
|
|
854
|
+
}({});
|
|
855
|
+
/**
|
|
856
|
+
* FeedbackAuth Schema - Authorization for client to submit feedback
|
|
857
|
+
*
|
|
858
|
+
* Replaces ERC-8004's off-chain signature with on-chain attestation.
|
|
859
|
+
*
|
|
860
|
+
* Attestation configuration:
|
|
861
|
+
* - credential = agent NFT mint
|
|
862
|
+
* - subject = client pubkey (authorized reviewer)
|
|
863
|
+
* - issuer = agent owner
|
|
864
|
+
* - nonce = hash(agentMint, clientPubkey)
|
|
865
|
+
*/
|
|
866
|
+
const FEEDBACK_AUTH_SCHEMA = {
|
|
867
|
+
name: "SATIFeedbackAuth",
|
|
868
|
+
version: 1,
|
|
869
|
+
description: "Authorization for client to submit feedback",
|
|
870
|
+
layout: [
|
|
871
|
+
SASLayoutType.String,
|
|
872
|
+
SASLayoutType.U16,
|
|
873
|
+
SASLayoutType.I64
|
|
874
|
+
],
|
|
875
|
+
fieldNames: [
|
|
876
|
+
"agent_mint",
|
|
877
|
+
"index_limit",
|
|
878
|
+
"expiry"
|
|
879
|
+
]
|
|
880
|
+
};
|
|
881
|
+
/**
|
|
882
|
+
* Feedback Schema - Client feedback for agent (ERC-8004 compatible)
|
|
883
|
+
*
|
|
884
|
+
* Attestation configuration:
|
|
885
|
+
* - credential = agent NFT mint
|
|
886
|
+
* - issuer = client (feedback giver)
|
|
887
|
+
* - nonce = hash(agent_mint, client_pubkey, timestamp)
|
|
888
|
+
*/
|
|
889
|
+
const FEEDBACK_SCHEMA = {
|
|
890
|
+
name: "SATIFeedback",
|
|
891
|
+
version: 1,
|
|
892
|
+
description: "Client feedback for agent (ERC-8004 compatible)",
|
|
893
|
+
layout: [
|
|
894
|
+
SASLayoutType.String,
|
|
895
|
+
SASLayoutType.U8,
|
|
896
|
+
SASLayoutType.String,
|
|
897
|
+
SASLayoutType.String,
|
|
898
|
+
SASLayoutType.String,
|
|
899
|
+
SASLayoutType.VecU8,
|
|
900
|
+
SASLayoutType.String
|
|
901
|
+
],
|
|
902
|
+
fieldNames: [
|
|
903
|
+
"agent_mint",
|
|
904
|
+
"score",
|
|
905
|
+
"tag1",
|
|
906
|
+
"tag2",
|
|
907
|
+
"fileuri",
|
|
908
|
+
"filehash",
|
|
909
|
+
"payment_proof"
|
|
910
|
+
]
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* FeedbackResponse Schema - Response to feedback (ERC-8004 appendResponse)
|
|
914
|
+
*
|
|
915
|
+
* Attestation configuration:
|
|
916
|
+
* - credential = agent NFT mint
|
|
917
|
+
* - issuer = responder (agent owner, auditor, etc.)
|
|
918
|
+
* - nonce = hash(feedback_id, responder_pubkey, index)
|
|
919
|
+
*/
|
|
920
|
+
const FEEDBACK_RESPONSE_SCHEMA = {
|
|
921
|
+
name: "SATIFeedbackResponse",
|
|
922
|
+
version: 1,
|
|
923
|
+
description: "Response to feedback (ERC-8004 appendResponse)",
|
|
924
|
+
layout: [
|
|
925
|
+
SASLayoutType.String,
|
|
926
|
+
SASLayoutType.String,
|
|
927
|
+
SASLayoutType.VecU8
|
|
928
|
+
],
|
|
929
|
+
fieldNames: [
|
|
930
|
+
"feedback_id",
|
|
931
|
+
"response_uri",
|
|
932
|
+
"response_hash"
|
|
933
|
+
]
|
|
934
|
+
};
|
|
935
|
+
/**
|
|
936
|
+
* ValidationRequest Schema - Agent requests work validation
|
|
937
|
+
*
|
|
938
|
+
* Attestation configuration:
|
|
939
|
+
* - credential = agent NFT mint
|
|
940
|
+
* - subject = validator pubkey
|
|
941
|
+
* - issuer = agent owner
|
|
942
|
+
* - nonce = hash(agent_mint, validator_pubkey, user_nonce)
|
|
943
|
+
*/
|
|
944
|
+
const VALIDATION_REQUEST_SCHEMA = {
|
|
945
|
+
name: "SATIValidationRequest",
|
|
946
|
+
version: 1,
|
|
947
|
+
description: "Agent requests work validation",
|
|
948
|
+
layout: [
|
|
949
|
+
SASLayoutType.String,
|
|
950
|
+
SASLayoutType.String,
|
|
951
|
+
SASLayoutType.String,
|
|
952
|
+
SASLayoutType.VecU8
|
|
953
|
+
],
|
|
954
|
+
fieldNames: [
|
|
955
|
+
"agent_mint",
|
|
956
|
+
"method_id",
|
|
957
|
+
"request_uri",
|
|
958
|
+
"request_hash"
|
|
959
|
+
]
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* ValidationResponse Schema - Validator responds to request
|
|
963
|
+
*
|
|
964
|
+
* Attestation configuration:
|
|
965
|
+
* - credential = agent NFT mint (from request)
|
|
966
|
+
* - issuer = validator
|
|
967
|
+
* - nonce = hash(request_id, response_index)
|
|
968
|
+
*/
|
|
969
|
+
const VALIDATION_RESPONSE_SCHEMA = {
|
|
970
|
+
name: "SATIValidationResponse",
|
|
971
|
+
version: 1,
|
|
972
|
+
description: "Validator responds to request",
|
|
973
|
+
layout: [
|
|
974
|
+
SASLayoutType.String,
|
|
975
|
+
SASLayoutType.U8,
|
|
976
|
+
SASLayoutType.String,
|
|
977
|
+
SASLayoutType.VecU8,
|
|
978
|
+
SASLayoutType.String
|
|
979
|
+
],
|
|
980
|
+
fieldNames: [
|
|
981
|
+
"request_id",
|
|
982
|
+
"response",
|
|
983
|
+
"response_uri",
|
|
984
|
+
"response_hash",
|
|
985
|
+
"tag"
|
|
986
|
+
]
|
|
987
|
+
};
|
|
988
|
+
/**
|
|
989
|
+
* Certification Schema - Immutable certification for agent
|
|
990
|
+
*
|
|
991
|
+
* For permanent, unmodifiable records (security audits, compliance
|
|
992
|
+
* certifications, credential attestations). SAS attestations are
|
|
993
|
+
* immutable by design - content cannot be modified after creation.
|
|
994
|
+
*
|
|
995
|
+
* Attestation configuration:
|
|
996
|
+
* - credential = agent NFT mint
|
|
997
|
+
* - issuer = certifier (e.g., audit firm)
|
|
998
|
+
* - nonce = hash(agent_mint, certifier_pubkey, cert_type, issued_at)
|
|
999
|
+
*/
|
|
1000
|
+
const CERTIFICATION_SCHEMA = {
|
|
1001
|
+
name: "SATICertification",
|
|
1002
|
+
version: 1,
|
|
1003
|
+
description: "Immutable certification for agent",
|
|
1004
|
+
layout: [
|
|
1005
|
+
SASLayoutType.String,
|
|
1006
|
+
SASLayoutType.String,
|
|
1007
|
+
SASLayoutType.String,
|
|
1008
|
+
SASLayoutType.I64
|
|
1009
|
+
],
|
|
1010
|
+
fieldNames: [
|
|
1011
|
+
"certifier",
|
|
1012
|
+
"cert_type",
|
|
1013
|
+
"cert_uri",
|
|
1014
|
+
"issued_at"
|
|
1015
|
+
]
|
|
1016
|
+
};
|
|
1017
|
+
/**
|
|
1018
|
+
* All SATI SAS schemas
|
|
1019
|
+
*/
|
|
1020
|
+
const SATI_SCHEMAS = {
|
|
1021
|
+
feedbackAuth: FEEDBACK_AUTH_SCHEMA,
|
|
1022
|
+
feedback: FEEDBACK_SCHEMA,
|
|
1023
|
+
feedbackResponse: FEEDBACK_RESPONSE_SCHEMA,
|
|
1024
|
+
validationRequest: VALIDATION_REQUEST_SCHEMA,
|
|
1025
|
+
validationResponse: VALIDATION_RESPONSE_SCHEMA,
|
|
1026
|
+
certification: CERTIFICATION_SCHEMA
|
|
1027
|
+
};
|
|
1028
|
+
/**
|
|
1029
|
+
* Schema names for lookup
|
|
1030
|
+
*/
|
|
1031
|
+
const SCHEMA_NAMES = {
|
|
1032
|
+
FEEDBACK_AUTH: "SATIFeedbackAuth",
|
|
1033
|
+
FEEDBACK: "SATIFeedback",
|
|
1034
|
+
FEEDBACK_RESPONSE: "SATIFeedbackResponse",
|
|
1035
|
+
VALIDATION_REQUEST: "SATIValidationRequest",
|
|
1036
|
+
VALIDATION_RESPONSE: "SATIValidationResponse",
|
|
1037
|
+
CERTIFICATION: "SATICertification"
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
//#endregion
|
|
1041
|
+
//#region src/sas.ts
|
|
1042
|
+
/**
|
|
1043
|
+
* SATI credential name used for all attestations
|
|
1044
|
+
*/
|
|
1045
|
+
const SATI_CREDENTIAL_NAME = "SATI";
|
|
1046
|
+
/**
|
|
1047
|
+
* Schema names for SATI attestations
|
|
1048
|
+
*/
|
|
1049
|
+
const SATI_SCHEMA_NAMES = {
|
|
1050
|
+
FEEDBACK_AUTH: "SATIFeedbackAuth",
|
|
1051
|
+
FEEDBACK: "SATIFeedback",
|
|
1052
|
+
FEEDBACK_RESPONSE: "SATIFeedbackResponse",
|
|
1053
|
+
VALIDATION_REQUEST: "SATIValidationRequest",
|
|
1054
|
+
VALIDATION_RESPONSE: "SATIValidationResponse",
|
|
1055
|
+
CERTIFICATION: "SATICertification"
|
|
1056
|
+
};
|
|
1057
|
+
/**
|
|
1058
|
+
* All SATI schemas with their definitions (keyed by schema name constant)
|
|
1059
|
+
*/
|
|
1060
|
+
const SATI_SAS_SCHEMAS = {
|
|
1061
|
+
FEEDBACK_AUTH: FEEDBACK_AUTH_SCHEMA,
|
|
1062
|
+
FEEDBACK: FEEDBACK_SCHEMA,
|
|
1063
|
+
FEEDBACK_RESPONSE: FEEDBACK_RESPONSE_SCHEMA,
|
|
1064
|
+
VALIDATION_REQUEST: VALIDATION_REQUEST_SCHEMA,
|
|
1065
|
+
VALIDATION_RESPONSE: VALIDATION_RESPONSE_SCHEMA,
|
|
1066
|
+
CERTIFICATION: CERTIFICATION_SCHEMA
|
|
1067
|
+
};
|
|
1068
|
+
/**
|
|
1069
|
+
* Derive SATI credential PDA
|
|
1070
|
+
*
|
|
1071
|
+
* @param authority - Credential authority address
|
|
1072
|
+
* @returns Credential PDA and bump
|
|
1073
|
+
*/
|
|
1074
|
+
async function deriveSatiCredentialPda(authority) {
|
|
1075
|
+
return (0, sas_lib.deriveCredentialPda)({
|
|
1076
|
+
authority,
|
|
1077
|
+
name: SATI_CREDENTIAL_NAME
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Derive SATI schema PDA
|
|
1082
|
+
*
|
|
1083
|
+
* @param credentialPda - SATI credential PDA
|
|
1084
|
+
* @param schemaName - Schema name (e.g., "SATIFeedback")
|
|
1085
|
+
* @param version - Schema version (default: 1)
|
|
1086
|
+
* @returns Schema PDA and bump
|
|
1087
|
+
*/
|
|
1088
|
+
async function deriveSatiSchemaPda(credentialPda, schemaName, version = 1) {
|
|
1089
|
+
return (0, sas_lib.deriveSchemaPda)({
|
|
1090
|
+
credential: credentialPda,
|
|
1091
|
+
name: schemaName,
|
|
1092
|
+
version
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Derive attestation PDA for a specific schema
|
|
1097
|
+
*
|
|
1098
|
+
* @param credentialPda - SATI credential PDA
|
|
1099
|
+
* @param schemaPda - Schema PDA
|
|
1100
|
+
* @param nonce - Unique nonce for this attestation (e.g., hash of agent + client)
|
|
1101
|
+
* @returns Attestation PDA and bump
|
|
1102
|
+
*/
|
|
1103
|
+
async function deriveSatiAttestationPda(credentialPda, schemaPda, nonce) {
|
|
1104
|
+
return (0, sas_lib.deriveAttestationPda)({
|
|
1105
|
+
credential: credentialPda,
|
|
1106
|
+
schema: schemaPda,
|
|
1107
|
+
nonce
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Get instructions to create SATI credential
|
|
1112
|
+
*
|
|
1113
|
+
* @param params - Creation parameters
|
|
1114
|
+
* @returns Instruction to create credential
|
|
1115
|
+
*/
|
|
1116
|
+
function getCreateSatiCredentialInstruction(params) {
|
|
1117
|
+
return (0, sas_lib.getCreateCredentialInstruction)({
|
|
1118
|
+
payer: params.payer,
|
|
1119
|
+
credential: params.credentialPda,
|
|
1120
|
+
authority: params.authority,
|
|
1121
|
+
name: SATI_CREDENTIAL_NAME,
|
|
1122
|
+
signers: params.authorizedSigners
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Get instruction to create a SATI schema
|
|
1127
|
+
*
|
|
1128
|
+
* @param params - Schema creation parameters
|
|
1129
|
+
* @returns Instruction to create schema
|
|
1130
|
+
*/
|
|
1131
|
+
function getCreateSatiSchemaInstruction(params) {
|
|
1132
|
+
return (0, sas_lib.getCreateSchemaInstruction)({
|
|
1133
|
+
payer: params.payer,
|
|
1134
|
+
authority: params.authority,
|
|
1135
|
+
credential: params.credentialPda,
|
|
1136
|
+
schema: params.schemaPda,
|
|
1137
|
+
name: params.schema.name,
|
|
1138
|
+
description: params.schema.description,
|
|
1139
|
+
layout: new Uint8Array(params.schema.layout),
|
|
1140
|
+
fieldNames: params.schema.fieldNames
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Serialize feedback authorization data for attestation
|
|
1145
|
+
*
|
|
1146
|
+
* @param data - FeedbackAuth data
|
|
1147
|
+
* @param schemaData - Schema account data from fetchSchema
|
|
1148
|
+
* @returns Serialized data buffer
|
|
1149
|
+
*/
|
|
1150
|
+
function serializeFeedbackAuthData(data, schemaData) {
|
|
1151
|
+
return (0, sas_lib.serializeAttestationData)(schemaData, data);
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Serialize feedback data for attestation
|
|
1155
|
+
*
|
|
1156
|
+
* @param data - Feedback data
|
|
1157
|
+
* @param schemaData - Schema account data from fetchSchema
|
|
1158
|
+
* @returns Serialized data buffer
|
|
1159
|
+
*/
|
|
1160
|
+
function serializeFeedbackData(data, schemaData) {
|
|
1161
|
+
return (0, sas_lib.serializeAttestationData)(schemaData, {
|
|
1162
|
+
agent_mint: data.agent_mint,
|
|
1163
|
+
score: data.score,
|
|
1164
|
+
tag1: data.tag1 ?? "",
|
|
1165
|
+
tag2: data.tag2 ?? "",
|
|
1166
|
+
fileuri: data.fileuri ?? "",
|
|
1167
|
+
filehash: data.filehash ?? new Uint8Array(32),
|
|
1168
|
+
payment_proof: data.payment_proof ?? ""
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Serialize feedback response data for attestation
|
|
1173
|
+
*
|
|
1174
|
+
* @param data - FeedbackResponse data
|
|
1175
|
+
* @param schemaData - Schema account data from fetchSchema
|
|
1176
|
+
* @returns Serialized data buffer
|
|
1177
|
+
*/
|
|
1178
|
+
function serializeFeedbackResponseData(data, schemaData) {
|
|
1179
|
+
return (0, sas_lib.serializeAttestationData)(schemaData, {
|
|
1180
|
+
feedback_id: data.feedback_id,
|
|
1181
|
+
response_uri: data.response_uri,
|
|
1182
|
+
response_hash: data.response_hash ?? new Uint8Array(32)
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Serialize validation request data for attestation
|
|
1187
|
+
*
|
|
1188
|
+
* @param data - ValidationRequest data
|
|
1189
|
+
* @param schemaData - Schema account data from fetchSchema
|
|
1190
|
+
* @returns Serialized data buffer
|
|
1191
|
+
*/
|
|
1192
|
+
function serializeValidationRequestData(data, schemaData) {
|
|
1193
|
+
return (0, sas_lib.serializeAttestationData)(schemaData, {
|
|
1194
|
+
agent_mint: data.agent_mint,
|
|
1195
|
+
method_id: data.method_id,
|
|
1196
|
+
request_uri: data.request_uri,
|
|
1197
|
+
request_hash: data.request_hash ?? new Uint8Array(32)
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Serialize validation response data for attestation
|
|
1202
|
+
*
|
|
1203
|
+
* @param data - ValidationResponse data
|
|
1204
|
+
* @param schemaData - Schema account data from fetchSchema
|
|
1205
|
+
* @returns Serialized data buffer
|
|
1206
|
+
*/
|
|
1207
|
+
function serializeValidationResponseData(data, schemaData) {
|
|
1208
|
+
return (0, sas_lib.serializeAttestationData)(schemaData, {
|
|
1209
|
+
request_id: data.request_id,
|
|
1210
|
+
response: data.response,
|
|
1211
|
+
response_uri: data.response_uri ?? "",
|
|
1212
|
+
response_hash: data.response_hash ?? new Uint8Array(32),
|
|
1213
|
+
tag: data.tag ?? ""
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Compute nonce for FeedbackAuth attestation
|
|
1218
|
+
* nonce = keccak256("feedbackAuth:" + agentMint + ":" + clientPubkey)
|
|
1219
|
+
*
|
|
1220
|
+
* @param agentMint - Agent NFT mint address
|
|
1221
|
+
* @param clientPubkey - Client public key
|
|
1222
|
+
* @returns Nonce as Address (base58)
|
|
1223
|
+
*/
|
|
1224
|
+
function computeFeedbackAuthNonce(agentMint, clientPubkey) {
|
|
1225
|
+
const hash = (0, __noble_hashes_sha3.keccak_256)(new TextEncoder().encode(`feedbackAuth:${agentMint}:${clientPubkey}`));
|
|
1226
|
+
return (0, __solana_kit.address)(bs58.default.encode(hash));
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Compute nonce for Feedback attestation
|
|
1230
|
+
* nonce = keccak256("feedback:" + agentMint + ":" + clientPubkey + ":" + timestamp)
|
|
1231
|
+
*
|
|
1232
|
+
* @param agentMint - Agent NFT mint address
|
|
1233
|
+
* @param clientPubkey - Client public key
|
|
1234
|
+
* @param timestamp - Unix timestamp
|
|
1235
|
+
* @returns Nonce as Address (base58)
|
|
1236
|
+
*/
|
|
1237
|
+
function computeFeedbackNonce(agentMint, clientPubkey, timestamp) {
|
|
1238
|
+
const hash = (0, __noble_hashes_sha3.keccak_256)(new TextEncoder().encode(`feedback:${agentMint}:${clientPubkey}:${timestamp}`));
|
|
1239
|
+
return (0, __solana_kit.address)(bs58.default.encode(hash));
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Compute nonce for FeedbackResponse attestation
|
|
1243
|
+
* nonce = keccak256("response:" + feedbackId + ":" + responderPubkey + ":" + index)
|
|
1244
|
+
*
|
|
1245
|
+
* @param feedbackId - Feedback attestation address
|
|
1246
|
+
* @param responderPubkey - Responder public key
|
|
1247
|
+
* @param index - Response index
|
|
1248
|
+
* @returns Nonce as Address (base58)
|
|
1249
|
+
*/
|
|
1250
|
+
function computeFeedbackResponseNonce(feedbackId, responderPubkey, index) {
|
|
1251
|
+
const hash = (0, __noble_hashes_sha3.keccak_256)(new TextEncoder().encode(`response:${feedbackId}:${responderPubkey}:${index}`));
|
|
1252
|
+
return (0, __solana_kit.address)(bs58.default.encode(hash));
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Compute nonce for ValidationRequest attestation
|
|
1256
|
+
* nonce = keccak256("validationReq:" + agentMint + ":" + validatorPubkey + ":" + userNonce)
|
|
1257
|
+
*
|
|
1258
|
+
* @param agentMint - Agent NFT mint address
|
|
1259
|
+
* @param validatorPubkey - Validator public key
|
|
1260
|
+
* @param userNonce - User-provided nonce
|
|
1261
|
+
* @returns Nonce as Address (base58)
|
|
1262
|
+
*/
|
|
1263
|
+
function computeValidationRequestNonce(agentMint, validatorPubkey, userNonce) {
|
|
1264
|
+
const hash = (0, __noble_hashes_sha3.keccak_256)(new TextEncoder().encode(`validationReq:${agentMint}:${validatorPubkey}:${userNonce}`));
|
|
1265
|
+
return (0, __solana_kit.address)(bs58.default.encode(hash));
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Compute nonce for ValidationResponse attestation
|
|
1269
|
+
* nonce = keccak256("validationResp:" + requestId + ":" + responseIndex)
|
|
1270
|
+
*
|
|
1271
|
+
* @param requestId - Request attestation address
|
|
1272
|
+
* @param responseIndex - Response index
|
|
1273
|
+
* @returns Nonce as Address (base58)
|
|
1274
|
+
*/
|
|
1275
|
+
function computeValidationResponseNonce(requestId, responseIndex) {
|
|
1276
|
+
const hash = (0, __noble_hashes_sha3.keccak_256)(new TextEncoder().encode(`validationResp:${requestId}:${responseIndex}`));
|
|
1277
|
+
return (0, __solana_kit.address)(bs58.default.encode(hash));
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Serialize certification data for attestation
|
|
1281
|
+
*
|
|
1282
|
+
* @param data - Certification data
|
|
1283
|
+
* @param schemaData - Schema account data from fetchSchema
|
|
1284
|
+
* @returns Serialized data buffer
|
|
1285
|
+
*/
|
|
1286
|
+
function serializeCertificationData(data, schemaData) {
|
|
1287
|
+
return (0, sas_lib.serializeAttestationData)(schemaData, data);
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Compute nonce for Certification attestation
|
|
1291
|
+
* nonce = keccak256("certification:" + agentMint + ":" + certifierPubkey + ":" + certType + ":" + issuedAt)
|
|
1292
|
+
*
|
|
1293
|
+
* @param agentMint - Agent NFT mint address
|
|
1294
|
+
* @param certifierPubkey - Certifier public key
|
|
1295
|
+
* @param certType - Certification type (e.g., "security-audit")
|
|
1296
|
+
* @param issuedAt - Unix timestamp
|
|
1297
|
+
* @returns Nonce as Address (base58)
|
|
1298
|
+
*/
|
|
1299
|
+
function computeCertificationNonce(agentMint, certifierPubkey, certType, issuedAt) {
|
|
1300
|
+
const hash = (0, __noble_hashes_sha3.keccak_256)(new TextEncoder().encode(`certification:${agentMint}:${certifierPubkey}:${certType}:${issuedAt}`));
|
|
1301
|
+
return (0, __solana_kit.address)(bs58.default.encode(hash));
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
//#endregion
|
|
1305
|
+
//#region src/helpers.ts
|
|
1306
|
+
/**
|
|
1307
|
+
* SATI SDK Helpers
|
|
1308
|
+
*
|
|
1309
|
+
* Browser-compatible utility functions for PDA derivation and constants.
|
|
1310
|
+
* For @solana/web3.js compatibility, import from "@sati/sdk/web3-compat".
|
|
1311
|
+
*/
|
|
1312
|
+
const TOKEN_2022_PROGRAM_ADDRESS = (0, __solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
1313
|
+
const ASSOCIATED_TOKEN_PROGRAM_ADDRESS = (0, __solana_kit.address)("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
1314
|
+
/**
|
|
1315
|
+
* Derive the Registry Config PDA
|
|
1316
|
+
*
|
|
1317
|
+
* Seeds: ["registry"]
|
|
1318
|
+
*/
|
|
1319
|
+
async function findRegistryConfigPda() {
|
|
1320
|
+
return (0, __solana_kit.getProgramDerivedAddress)({
|
|
1321
|
+
programAddress: SATI_REGISTRY_PROGRAM_ADDRESS,
|
|
1322
|
+
seeds: [new TextEncoder().encode("registry")]
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Derive the Group Mint PDA (SATI collection)
|
|
1327
|
+
*
|
|
1328
|
+
* Seeds: ["group_mint"]
|
|
1329
|
+
*/
|
|
1330
|
+
async function findGroupMintPda() {
|
|
1331
|
+
return (0, __solana_kit.getProgramDerivedAddress)({
|
|
1332
|
+
programAddress: SATI_REGISTRY_PROGRAM_ADDRESS,
|
|
1333
|
+
seeds: [new TextEncoder().encode("group_mint")]
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Derive Associated Token Account address for Token-2022
|
|
1338
|
+
*
|
|
1339
|
+
* @param mint - Token mint address
|
|
1340
|
+
* @param owner - Token account owner
|
|
1341
|
+
*/
|
|
1342
|
+
async function findAssociatedTokenAddress(mint, owner) {
|
|
1343
|
+
const addressEncoder = (0, __solana_kit.getAddressEncoder)();
|
|
1344
|
+
return (0, __solana_kit.getProgramDerivedAddress)({
|
|
1345
|
+
programAddress: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
1346
|
+
seeds: [
|
|
1347
|
+
addressEncoder.encode(owner),
|
|
1348
|
+
addressEncoder.encode(TOKEN_2022_PROGRAM_ADDRESS),
|
|
1349
|
+
addressEncoder.encode(mint)
|
|
1350
|
+
]
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
//#endregion
|
|
1355
|
+
//#region src/deployed/devnet.json
|
|
1356
|
+
var require_devnet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1357
|
+
module.exports = {
|
|
1358
|
+
"network": "devnet",
|
|
1359
|
+
"authority": "7NetKx8TuRMBpqYFKZCVetkNuvWCPTrgekmGrsJwTmfN",
|
|
1360
|
+
"deployedAt": "2025-12-17T17:06:56.684Z",
|
|
1361
|
+
"config": {
|
|
1362
|
+
"credential": "7HCCiuYUHptR1SXXHBRqkKUPb5G3hPvnKfy5v8n2cFmY",
|
|
1363
|
+
"schemas": {
|
|
1364
|
+
"feedbackAuth": "DNFKm4xxbc4kRkSSMNH3jVapja4FpZ3ZTrpPjyCvKsS2",
|
|
1365
|
+
"feedback": "ThaSG2CDHu2zoFwwr7ymv4EuJ196GEG7b96hUZUaYau",
|
|
1366
|
+
"feedbackResponse": "6QumCz2bLZ4knxQ4cBdAQwb7UNhVq6Kt5CJEV2Wv1D2E",
|
|
1367
|
+
"validationRequest": "EfpXKG3UxAGy1S96b5nTmyxbZ2UPWVUa4LkwzxFYYxHt",
|
|
1368
|
+
"validationResponse": "EsKybaVzREeUDtVNmqkxP5bYnWzesAmjU24J7yUN5P2m",
|
|
1369
|
+
"certification": "FS9btVi37tSUzvZnfbSKJGfkxshQ5kJs821CUeN6spsb"
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}));
|
|
1374
|
+
|
|
1375
|
+
//#endregion
|
|
1376
|
+
//#region src/deployed/mainnet.json
|
|
1377
|
+
var require_mainnet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1378
|
+
module.exports = {
|
|
1379
|
+
"network": "mainnet",
|
|
1380
|
+
"authority": "SQ2xxkJ6uEDHprYMNXPxS2AwyEtGGToZ7YC94icKH3Z",
|
|
1381
|
+
"deployedAt": "2025-12-17T17:44:18.254Z",
|
|
1382
|
+
"config": {
|
|
1383
|
+
"credential": "DQHW6fAhPfGAENuwJVYfzEvUN12DakZgaaGtPPRfGei1",
|
|
1384
|
+
"schemas": {
|
|
1385
|
+
"feedbackAuth": "5xSf1fTKoC9hxdVWviv7hXu1CUqBuJC6u91ATkAFNVQF",
|
|
1386
|
+
"feedback": "6fhPUeLkkg2zA9YrhMLry7ff91DZ7zuCXRPahNkieRUB",
|
|
1387
|
+
"feedbackResponse": "6YNVUMLe7oxVLKeEzqAzXhd3GpzxVJwcnXPy79q3VzZr",
|
|
1388
|
+
"validationRequest": "GwPFMxXzieodxgPsu1c6tJUwEu57VjrUUwYjhe9C6g5w",
|
|
1389
|
+
"validationResponse": "6YwoDaKEhhktZJY3thQMLpAuJYZtxySRGQuBjXk6VwrK",
|
|
1390
|
+
"certification": "6V8aJX32J9uEwvpRwerRQ6nJK5y7r69NipBTkMTYMhsZ"
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
}));
|
|
1395
|
+
|
|
1396
|
+
//#endregion
|
|
1397
|
+
//#region src/deployed/index.ts
|
|
1398
|
+
let devnetConfig = null;
|
|
1399
|
+
let mainnetConfig = null;
|
|
1400
|
+
try {
|
|
1401
|
+
devnetConfig = require_devnet();
|
|
1402
|
+
} catch {}
|
|
1403
|
+
try {
|
|
1404
|
+
mainnetConfig = require_mainnet();
|
|
1405
|
+
} catch {}
|
|
1406
|
+
const configs = {
|
|
1407
|
+
devnet: devnetConfig,
|
|
1408
|
+
mainnet: mainnetConfig,
|
|
1409
|
+
localnet: null
|
|
1410
|
+
};
|
|
1411
|
+
/**
|
|
1412
|
+
* Load deployed SAS configuration for a network
|
|
1413
|
+
*
|
|
1414
|
+
* @param network - Network identifier ("devnet", "mainnet", "localnet")
|
|
1415
|
+
* @returns SAS config if deployed, null otherwise
|
|
1416
|
+
*/
|
|
1417
|
+
function loadDeployedConfig(network) {
|
|
1418
|
+
return configs[network] ?? null;
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Check if a network has deployed SAS configuration
|
|
1422
|
+
*
|
|
1423
|
+
* @param network - Network identifier
|
|
1424
|
+
* @returns true if config exists for network
|
|
1425
|
+
*/
|
|
1426
|
+
function hasDeployedConfig(network) {
|
|
1427
|
+
return configs[network] !== null;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Get list of networks with deployed configurations
|
|
1431
|
+
*
|
|
1432
|
+
* @returns Array of network names with deployed configs
|
|
1433
|
+
*/
|
|
1434
|
+
function getDeployedNetworks() {
|
|
1435
|
+
return Object.entries(configs).filter(([_, config]) => config !== null).map(([network]) => network);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
//#endregion
|
|
1439
|
+
//#region src/client.ts
|
|
1440
|
+
/**
|
|
1441
|
+
* SATI Client - High-Level SDK Interface
|
|
1442
|
+
*
|
|
1443
|
+
* Provides a convenient wrapper around the generated Codama client
|
|
1444
|
+
* and SAS attestation operations for the Solana Agent Trust Infrastructure.
|
|
1445
|
+
*
|
|
1446
|
+
* Features:
|
|
1447
|
+
* - Agent registration via Token-2022 NFT minting
|
|
1448
|
+
* - Reputation management via SAS attestations (ERC-8004 compatible)
|
|
1449
|
+
* - Validation request/response workflows
|
|
1450
|
+
*
|
|
1451
|
+
* @see https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8004.md
|
|
1452
|
+
*/
|
|
1453
|
+
const RPC_URLS = {
|
|
1454
|
+
mainnet: "https://api.mainnet-beta.solana.com",
|
|
1455
|
+
devnet: "https://api.devnet.solana.com",
|
|
1456
|
+
localnet: "http://127.0.0.1:8899"
|
|
1457
|
+
};
|
|
1458
|
+
const WS_URLS = {
|
|
1459
|
+
mainnet: "wss://api.mainnet-beta.solana.com",
|
|
1460
|
+
devnet: "wss://api.devnet.solana.com",
|
|
1461
|
+
localnet: "ws://127.0.0.1:8900"
|
|
1462
|
+
};
|
|
1463
|
+
/**
|
|
1464
|
+
* Helper to unwrap Option type from @solana/kit
|
|
1465
|
+
*/
|
|
1466
|
+
function unwrapOption(option) {
|
|
1467
|
+
if (option.__option === "Some") return option.value;
|
|
1468
|
+
return null;
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* SATI Client
|
|
1472
|
+
*
|
|
1473
|
+
* High-level interface for interacting with SATI protocol.
|
|
1474
|
+
*
|
|
1475
|
+
* @example
|
|
1476
|
+
* ```typescript
|
|
1477
|
+
* const sati = new SATI({ network: "devnet" });
|
|
1478
|
+
*
|
|
1479
|
+
* // Register an agent
|
|
1480
|
+
* const { mint, memberNumber } = await sati.registerAgent({
|
|
1481
|
+
* payer,
|
|
1482
|
+
* name: "MyAgent",
|
|
1483
|
+
* uri: "ipfs://QmRegistrationFile",
|
|
1484
|
+
* });
|
|
1485
|
+
*
|
|
1486
|
+
* // Load agent identity
|
|
1487
|
+
* const agent = await sati.loadAgent(mint);
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
var SATI = class {
|
|
1491
|
+
constructor(options) {
|
|
1492
|
+
this.sasConfig = null;
|
|
1493
|
+
this.network = options.network;
|
|
1494
|
+
const rpcUrl = options.rpcUrl ?? RPC_URLS[options.network];
|
|
1495
|
+
const wsUrl = options.wsUrl ?? WS_URLS[options.network];
|
|
1496
|
+
this.rpc = (0, __solana_kit.createSolanaRpc)(rpcUrl);
|
|
1497
|
+
this.rpcSubscriptions = (0, __solana_kit.createSolanaRpcSubscriptions)(wsUrl);
|
|
1498
|
+
this.sendAndConfirm = (0, __solana_kit.sendAndConfirmTransactionFactory)({
|
|
1499
|
+
rpc: this.rpc,
|
|
1500
|
+
rpcSubscriptions: this.rpcSubscriptions
|
|
1501
|
+
});
|
|
1502
|
+
const deployedConfig = loadDeployedConfig(this.network);
|
|
1503
|
+
if (deployedConfig) this.sasConfig = deployedConfig;
|
|
1504
|
+
}
|
|
1505
|
+
/**
|
|
1506
|
+
* Set SAS configuration for reputation/validation operations
|
|
1507
|
+
*
|
|
1508
|
+
* This should be called after SATI schemas are deployed to the network.
|
|
1509
|
+
* Use setupSASSchemas() to deploy schemas if they don't exist yet.
|
|
1510
|
+
*
|
|
1511
|
+
* @param config - SAS credential and schema addresses
|
|
1512
|
+
*/
|
|
1513
|
+
setSASConfig(config) {
|
|
1514
|
+
this.sasConfig = config;
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Get current SAS configuration
|
|
1518
|
+
*/
|
|
1519
|
+
getSASConfig() {
|
|
1520
|
+
return this.sasConfig;
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Ensure SAS config is set, throw if not
|
|
1524
|
+
*/
|
|
1525
|
+
requireSASConfig() {
|
|
1526
|
+
if (!this.sasConfig) throw new Error("SAS configuration not set. Call setSASConfig() or setupSASSchemas() first.");
|
|
1527
|
+
return this.sasConfig;
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Register a new agent identity
|
|
1531
|
+
*
|
|
1532
|
+
* Creates a Token-2022 NFT with metadata and group membership atomically.
|
|
1533
|
+
*
|
|
1534
|
+
* **Compute Budget Note:**
|
|
1535
|
+
* Each additional metadata entry adds ~5-10k compute units.
|
|
1536
|
+
* When using >5 entries, the on-chain program logs a warning suggesting
|
|
1537
|
+
* 400k CUs. If transactions fail with compute exceeded, prepend a
|
|
1538
|
+
* SetComputeUnitLimit instruction to your transaction.
|
|
1539
|
+
*
|
|
1540
|
+
* @param params - Registration parameters
|
|
1541
|
+
* @returns Mint address and member number
|
|
1542
|
+
*/
|
|
1543
|
+
async registerAgent(params) {
|
|
1544
|
+
const { payer, name, symbol = "SATI", uri, additionalMetadata, nonTransferable = false, owner } = params;
|
|
1545
|
+
const agentMint = await (0, __solana_kit.generateKeyPairSigner)();
|
|
1546
|
+
const [groupMint] = await findGroupMintPda();
|
|
1547
|
+
const ownerAddress = owner ?? payer.address;
|
|
1548
|
+
const [agentTokenAccount] = await findAssociatedTokenAddress(agentMint.address, ownerAddress);
|
|
1549
|
+
const registerIx = await getRegisterAgentInstructionAsync({
|
|
1550
|
+
payer,
|
|
1551
|
+
owner: ownerAddress,
|
|
1552
|
+
groupMint,
|
|
1553
|
+
agentMint,
|
|
1554
|
+
agentTokenAccount,
|
|
1555
|
+
name,
|
|
1556
|
+
symbol,
|
|
1557
|
+
uri,
|
|
1558
|
+
additionalMetadata: additionalMetadata ?? null,
|
|
1559
|
+
nonTransferable
|
|
1560
|
+
});
|
|
1561
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1562
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(registerIx, msg)));
|
|
1563
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1564
|
+
const [registryConfigAddress] = await findRegistryConfigPda();
|
|
1565
|
+
const memberNumber = (await fetchRegistryConfig(this.rpc, registryConfigAddress)).data.totalAgents;
|
|
1566
|
+
const signature = (0, __solana_kit.getSignatureFromTransaction)(signedTx);
|
|
1567
|
+
return {
|
|
1568
|
+
mint: agentMint.address,
|
|
1569
|
+
memberNumber,
|
|
1570
|
+
signature: signature.toString()
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Get registry statistics
|
|
1575
|
+
*/
|
|
1576
|
+
async getRegistryStats() {
|
|
1577
|
+
const [registryConfigAddress] = await findRegistryConfigPda();
|
|
1578
|
+
const registryConfig = await fetchRegistryConfig(this.rpc, registryConfigAddress);
|
|
1579
|
+
const isImmutable = registryConfig.data.authority === "11111111111111111111111111111111";
|
|
1580
|
+
return {
|
|
1581
|
+
groupMint: registryConfig.data.groupMint,
|
|
1582
|
+
authority: registryConfig.data.authority,
|
|
1583
|
+
totalAgents: registryConfig.data.totalAgents,
|
|
1584
|
+
isImmutable
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Load agent identity from mint address
|
|
1589
|
+
*
|
|
1590
|
+
* Fetches Token-2022 metadata and group membership.
|
|
1591
|
+
*
|
|
1592
|
+
* @param mint - Agent NFT mint address
|
|
1593
|
+
* @returns Agent identity or null if not found
|
|
1594
|
+
*/
|
|
1595
|
+
async loadAgent(mint) {
|
|
1596
|
+
try {
|
|
1597
|
+
const extensions = unwrapOption((await (0, __solana_program_token_2022.fetchMint)(this.rpc, mint)).data.extensions);
|
|
1598
|
+
if (!extensions) return null;
|
|
1599
|
+
const metadataExt = extensions.find((ext) => ext.__kind === "TokenMetadata");
|
|
1600
|
+
if (!metadataExt) return null;
|
|
1601
|
+
const groupMemberExt = extensions.find((ext) => ext.__kind === "TokenGroupMember");
|
|
1602
|
+
const nonTransferableExt = extensions.find((ext) => ext.__kind === "NonTransferable");
|
|
1603
|
+
const owner = await this.getAgentOwner(mint);
|
|
1604
|
+
const additionalMetadata = {};
|
|
1605
|
+
if (metadataExt.additionalMetadata) for (const [key, value] of metadataExt.additionalMetadata) additionalMetadata[key] = value;
|
|
1606
|
+
return {
|
|
1607
|
+
mint,
|
|
1608
|
+
owner,
|
|
1609
|
+
name: metadataExt.name,
|
|
1610
|
+
symbol: metadataExt.symbol,
|
|
1611
|
+
uri: metadataExt.uri,
|
|
1612
|
+
memberNumber: groupMemberExt?.memberNumber ?? 0n,
|
|
1613
|
+
additionalMetadata,
|
|
1614
|
+
nonTransferable: !!nonTransferableExt
|
|
1615
|
+
};
|
|
1616
|
+
} catch {
|
|
1617
|
+
return null;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Update agent metadata
|
|
1622
|
+
*
|
|
1623
|
+
* Directly calls Token-2022 updateTokenMetadataField instruction.
|
|
1624
|
+
* Requires owner signature.
|
|
1625
|
+
*
|
|
1626
|
+
* Note: This method requires building raw instructions for the
|
|
1627
|
+
* spl-token-metadata-interface. For now, use @solana/spl-token directly
|
|
1628
|
+
* or the Anchor client for metadata updates.
|
|
1629
|
+
*
|
|
1630
|
+
* @param _mint - Agent NFT mint address
|
|
1631
|
+
* @param _updates - Fields to update
|
|
1632
|
+
*/
|
|
1633
|
+
async updateAgentMetadata(_mint, _updates) {
|
|
1634
|
+
throw new Error("updateAgentMetadata requires spl-token-metadata-interface - use @solana/spl-token updateTokenMetadataField() directly");
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Transfer agent to new owner
|
|
1638
|
+
*
|
|
1639
|
+
* Standard Token-2022 transfer. Requires current owner signature.
|
|
1640
|
+
*
|
|
1641
|
+
* @param params - Transfer parameters
|
|
1642
|
+
*/
|
|
1643
|
+
async transferAgent(params) {
|
|
1644
|
+
const { payer, owner, mint, newOwner } = params;
|
|
1645
|
+
const [sourceAta] = await findAssociatedTokenAddress(mint, owner.address);
|
|
1646
|
+
const [destAta] = await findAssociatedTokenAddress(mint, newOwner);
|
|
1647
|
+
const transferIx = (0, __solana_program_token_2022.getTransferInstruction)({
|
|
1648
|
+
source: sourceAta,
|
|
1649
|
+
destination: destAta,
|
|
1650
|
+
authority: owner,
|
|
1651
|
+
amount: 1n
|
|
1652
|
+
});
|
|
1653
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1654
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(transferIx, msg)));
|
|
1655
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1656
|
+
return { signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString() };
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Get current owner of an agent
|
|
1660
|
+
*
|
|
1661
|
+
* Finds the token account holding the NFT and returns its owner.
|
|
1662
|
+
*
|
|
1663
|
+
* @param mint - Agent NFT mint address
|
|
1664
|
+
* @returns Owner address
|
|
1665
|
+
*/
|
|
1666
|
+
async getAgentOwner(mint) {
|
|
1667
|
+
const response = await this.rpc.getTokenLargestAccounts(mint, { commitment: "confirmed" }).send();
|
|
1668
|
+
if (!response.value || response.value.length === 0) throw new Error(`No token accounts found for mint ${mint}`);
|
|
1669
|
+
const holderAccount = response.value.find((acc) => BigInt(acc.amount) > 0n);
|
|
1670
|
+
if (!holderAccount) throw new Error(`No holder found for agent ${mint}`);
|
|
1671
|
+
return (await (0, __solana_program_token_2022.fetchToken)(this.rpc, (0, __solana_kit.address)(holderAccount.address))).data.owner;
|
|
1672
|
+
}
|
|
1673
|
+
/**
|
|
1674
|
+
* List registered agents
|
|
1675
|
+
*
|
|
1676
|
+
* Uses getProgramAccounts to find all SATI agent NFTs.
|
|
1677
|
+
* For better performance at scale, use an indexer.
|
|
1678
|
+
*
|
|
1679
|
+
* @param params - Pagination parameters
|
|
1680
|
+
* @returns Array of agent identities
|
|
1681
|
+
*/
|
|
1682
|
+
async listAgents(params) {
|
|
1683
|
+
const { offset = 0, limit = 100 } = params ?? {};
|
|
1684
|
+
const [groupMint] = await findGroupMintPda();
|
|
1685
|
+
const accounts = await this.rpc.getProgramAccounts(TOKEN_2022_PROGRAM_ADDRESS, {
|
|
1686
|
+
commitment: "confirmed",
|
|
1687
|
+
encoding: "base64",
|
|
1688
|
+
dataSlice: {
|
|
1689
|
+
offset: 0,
|
|
1690
|
+
length: 0
|
|
1691
|
+
}
|
|
1692
|
+
}).send();
|
|
1693
|
+
const agents = [];
|
|
1694
|
+
const addressesToCheck = accounts.slice(offset, offset + limit * 2).map((acc) => acc.pubkey);
|
|
1695
|
+
for (const addr of addressesToCheck) {
|
|
1696
|
+
if (agents.length >= limit) break;
|
|
1697
|
+
const agent = await this.loadAgent(addr);
|
|
1698
|
+
if (agent) {
|
|
1699
|
+
const extensions = unwrapOption((await (0, __solana_program_token_2022.fetchMint)(this.rpc, addr)).data.extensions);
|
|
1700
|
+
if (extensions) {
|
|
1701
|
+
const groupMemberExt = extensions.find((ext) => ext.__kind === "TokenGroupMember");
|
|
1702
|
+
if (groupMemberExt && groupMemberExt.group === groupMint) agents.push(agent);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return agents;
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Authorize a client to submit feedback
|
|
1710
|
+
*
|
|
1711
|
+
* Creates a FeedbackAuth attestation via SAS.
|
|
1712
|
+
* Must be called by the agent owner.
|
|
1713
|
+
*
|
|
1714
|
+
* @param params - Authorization parameters
|
|
1715
|
+
* @returns Attestation address and signature
|
|
1716
|
+
*/
|
|
1717
|
+
async authorizeFeedback(params) {
|
|
1718
|
+
const sasConfig = this.requireSASConfig();
|
|
1719
|
+
const { payer, agentOwner, agentMint, client, indexLimit, expiry = 0 } = params;
|
|
1720
|
+
const nonce = computeFeedbackAuthNonce(agentMint, client);
|
|
1721
|
+
const [attestationPda] = await deriveSatiAttestationPda(sasConfig.credential, sasConfig.schemas.feedbackAuth, nonce);
|
|
1722
|
+
const schema = await (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.feedbackAuth);
|
|
1723
|
+
const data = serializeFeedbackAuthData({
|
|
1724
|
+
agent_mint: agentMint,
|
|
1725
|
+
index_limit: indexLimit,
|
|
1726
|
+
expiry
|
|
1727
|
+
}, schema.data);
|
|
1728
|
+
const expiryTimestamp = expiry || Math.floor(Date.now() / 1e3) + 365 * 24 * 60 * 60;
|
|
1729
|
+
const createAttestationIx = await (0, sas_lib.getCreateAttestationInstruction)({
|
|
1730
|
+
payer,
|
|
1731
|
+
authority: agentOwner,
|
|
1732
|
+
credential: sasConfig.credential,
|
|
1733
|
+
schema: sasConfig.schemas.feedbackAuth,
|
|
1734
|
+
attestation: attestationPda,
|
|
1735
|
+
nonce,
|
|
1736
|
+
expiry: expiryTimestamp,
|
|
1737
|
+
data
|
|
1738
|
+
});
|
|
1739
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1740
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(createAttestationIx, msg)));
|
|
1741
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1742
|
+
return {
|
|
1743
|
+
attestation: attestationPda,
|
|
1744
|
+
signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString()
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Revoke feedback authorization
|
|
1749
|
+
*
|
|
1750
|
+
* Closes the FeedbackAuth attestation and reclaims rent.
|
|
1751
|
+
*
|
|
1752
|
+
* @param params - Revocation parameters
|
|
1753
|
+
*/
|
|
1754
|
+
async revokeAuthorization(params) {
|
|
1755
|
+
const sasConfig = this.requireSASConfig();
|
|
1756
|
+
const { payer, authority, attestation } = params;
|
|
1757
|
+
const eventAuthority = await (0, sas_lib.deriveEventAuthorityAddress)();
|
|
1758
|
+
const closeIx = await (0, sas_lib.getCloseAttestationInstruction)({
|
|
1759
|
+
payer,
|
|
1760
|
+
attestation,
|
|
1761
|
+
authority,
|
|
1762
|
+
credential: sasConfig.credential,
|
|
1763
|
+
eventAuthority,
|
|
1764
|
+
attestationProgram: sas_lib.SOLANA_ATTESTATION_SERVICE_PROGRAM_ADDRESS
|
|
1765
|
+
});
|
|
1766
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1767
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(closeIx, msg)));
|
|
1768
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1769
|
+
return { signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString() };
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Submit feedback for an agent
|
|
1773
|
+
*
|
|
1774
|
+
* Creates a Feedback attestation via SAS.
|
|
1775
|
+
* Requires prior authorization from agent owner via authorizeFeedback().
|
|
1776
|
+
*
|
|
1777
|
+
* @param params - Feedback parameters
|
|
1778
|
+
* @returns Attestation address and signature
|
|
1779
|
+
*/
|
|
1780
|
+
async giveFeedback(params) {
|
|
1781
|
+
const sasConfig = this.requireSASConfig();
|
|
1782
|
+
const { payer, client, agentMint, score, tag1, tag2, fileuri, filehash, paymentProof } = params;
|
|
1783
|
+
if (score < 0 || score > 100) throw new Error("Score must be between 0 and 100");
|
|
1784
|
+
const timestamp = Math.floor(Date.now() / 1e3);
|
|
1785
|
+
const nonce = computeFeedbackNonce(agentMint, client.address, timestamp);
|
|
1786
|
+
const [attestationPda] = await deriveSatiAttestationPda(sasConfig.credential, sasConfig.schemas.feedback, nonce);
|
|
1787
|
+
const schema = await (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.feedback);
|
|
1788
|
+
const data = serializeFeedbackData({
|
|
1789
|
+
agent_mint: agentMint,
|
|
1790
|
+
score,
|
|
1791
|
+
tag1,
|
|
1792
|
+
tag2,
|
|
1793
|
+
fileuri,
|
|
1794
|
+
filehash,
|
|
1795
|
+
payment_proof: paymentProof
|
|
1796
|
+
}, schema.data);
|
|
1797
|
+
const createAttestationIx = await (0, sas_lib.getCreateAttestationInstruction)({
|
|
1798
|
+
payer,
|
|
1799
|
+
authority: client,
|
|
1800
|
+
credential: sasConfig.credential,
|
|
1801
|
+
schema: sasConfig.schemas.feedback,
|
|
1802
|
+
attestation: attestationPda,
|
|
1803
|
+
nonce,
|
|
1804
|
+
expiry: 0,
|
|
1805
|
+
data
|
|
1806
|
+
});
|
|
1807
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1808
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(createAttestationIx, msg)));
|
|
1809
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1810
|
+
return {
|
|
1811
|
+
attestation: attestationPda,
|
|
1812
|
+
signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString()
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Revoke submitted feedback
|
|
1817
|
+
*
|
|
1818
|
+
* Closes the Feedback attestation and reclaims rent.
|
|
1819
|
+
*
|
|
1820
|
+
* @param params - Revocation parameters
|
|
1821
|
+
*/
|
|
1822
|
+
async revokeFeedback(params) {
|
|
1823
|
+
const sasConfig = this.requireSASConfig();
|
|
1824
|
+
const { payer, client, attestation } = params;
|
|
1825
|
+
const eventAuthority = await (0, sas_lib.deriveEventAuthorityAddress)();
|
|
1826
|
+
const closeIx = await (0, sas_lib.getCloseAttestationInstruction)({
|
|
1827
|
+
payer,
|
|
1828
|
+
attestation,
|
|
1829
|
+
authority: client,
|
|
1830
|
+
credential: sasConfig.credential,
|
|
1831
|
+
eventAuthority,
|
|
1832
|
+
attestationProgram: sas_lib.SOLANA_ATTESTATION_SERVICE_PROGRAM_ADDRESS
|
|
1833
|
+
});
|
|
1834
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1835
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(closeIx, msg)));
|
|
1836
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1837
|
+
return { signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString() };
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Append response to feedback
|
|
1841
|
+
*
|
|
1842
|
+
* Creates a FeedbackResponse attestation via SAS.
|
|
1843
|
+
* Can be called by agent owner, auditor, or anyone.
|
|
1844
|
+
*
|
|
1845
|
+
* @param params - Response parameters
|
|
1846
|
+
* @returns Attestation address and signature
|
|
1847
|
+
*/
|
|
1848
|
+
async appendResponse(params) {
|
|
1849
|
+
const sasConfig = this.requireSASConfig();
|
|
1850
|
+
const { payer, responder, feedbackAttestation, responseUri, responseHash, responseIndex = 0 } = params;
|
|
1851
|
+
const nonce = computeFeedbackResponseNonce(feedbackAttestation, responder.address, responseIndex);
|
|
1852
|
+
const [attestationPda] = await deriveSatiAttestationPda(sasConfig.credential, sasConfig.schemas.feedbackResponse, nonce);
|
|
1853
|
+
const schema = await (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.feedbackResponse);
|
|
1854
|
+
const data = serializeFeedbackResponseData({
|
|
1855
|
+
feedback_id: feedbackAttestation,
|
|
1856
|
+
response_uri: responseUri,
|
|
1857
|
+
response_hash: responseHash
|
|
1858
|
+
}, schema.data);
|
|
1859
|
+
const createAttestationIx = await (0, sas_lib.getCreateAttestationInstruction)({
|
|
1860
|
+
payer,
|
|
1861
|
+
authority: responder,
|
|
1862
|
+
credential: sasConfig.credential,
|
|
1863
|
+
schema: sasConfig.schemas.feedbackResponse,
|
|
1864
|
+
attestation: attestationPda,
|
|
1865
|
+
nonce,
|
|
1866
|
+
expiry: 0,
|
|
1867
|
+
data
|
|
1868
|
+
});
|
|
1869
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1870
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(createAttestationIx, msg)));
|
|
1871
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1872
|
+
return {
|
|
1873
|
+
attestation: attestationPda,
|
|
1874
|
+
signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString()
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Read feedback attestation
|
|
1879
|
+
*
|
|
1880
|
+
* @param attestation - Feedback attestation address
|
|
1881
|
+
* @returns Feedback data or null if not found
|
|
1882
|
+
*/
|
|
1883
|
+
async readFeedback(attestation) {
|
|
1884
|
+
const sasConfig = this.requireSASConfig();
|
|
1885
|
+
try {
|
|
1886
|
+
const [attestationAccount, schema] = await Promise.all([(0, sas_lib.fetchAttestation)(this.rpc, attestation), (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.feedback)]);
|
|
1887
|
+
const data = (0, sas_lib.deserializeAttestationData)(schema.data, attestationAccount.data.data);
|
|
1888
|
+
return {
|
|
1889
|
+
attestation,
|
|
1890
|
+
agentMint: (0, __solana_kit.address)(data.agent_mint),
|
|
1891
|
+
score: data.score,
|
|
1892
|
+
tag1: data.tag1 || void 0,
|
|
1893
|
+
tag2: data.tag2 || void 0,
|
|
1894
|
+
fileUri: data.fileuri || void 0,
|
|
1895
|
+
fileHash: data.filehash?.length > 0 ? data.filehash : void 0,
|
|
1896
|
+
paymentProof: data.payment_proof || void 0,
|
|
1897
|
+
issuer: attestationAccount.data.signer,
|
|
1898
|
+
expiry: Number(attestationAccount.data.expiry),
|
|
1899
|
+
revoked: false
|
|
1900
|
+
};
|
|
1901
|
+
} catch {
|
|
1902
|
+
return null;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Request validation from a validator
|
|
1907
|
+
*
|
|
1908
|
+
* Creates a ValidationRequest attestation via SAS.
|
|
1909
|
+
* Must be called by agent owner.
|
|
1910
|
+
*
|
|
1911
|
+
* @param params - Request parameters
|
|
1912
|
+
* @returns Attestation address and signature
|
|
1913
|
+
*/
|
|
1914
|
+
async requestValidation(params) {
|
|
1915
|
+
const sasConfig = this.requireSASConfig();
|
|
1916
|
+
const { payer, agentOwner, agentMint, validator, methodId, requestUri, requestHash } = params;
|
|
1917
|
+
const nonce = computeValidationRequestNonce(agentMint, validator, Math.floor(Date.now() / 1e3));
|
|
1918
|
+
const [attestationPda] = await deriveSatiAttestationPda(sasConfig.credential, sasConfig.schemas.validationRequest, nonce);
|
|
1919
|
+
const schema = await (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.validationRequest);
|
|
1920
|
+
const data = serializeValidationRequestData({
|
|
1921
|
+
agent_mint: agentMint,
|
|
1922
|
+
method_id: methodId,
|
|
1923
|
+
request_uri: requestUri,
|
|
1924
|
+
request_hash: requestHash
|
|
1925
|
+
}, schema.data);
|
|
1926
|
+
const createAttestationIx = await (0, sas_lib.getCreateAttestationInstruction)({
|
|
1927
|
+
payer,
|
|
1928
|
+
authority: agentOwner,
|
|
1929
|
+
credential: sasConfig.credential,
|
|
1930
|
+
schema: sasConfig.schemas.validationRequest,
|
|
1931
|
+
attestation: attestationPda,
|
|
1932
|
+
nonce,
|
|
1933
|
+
expiry: 0,
|
|
1934
|
+
data
|
|
1935
|
+
});
|
|
1936
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1937
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(createAttestationIx, msg)));
|
|
1938
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1939
|
+
return {
|
|
1940
|
+
attestation: attestationPda,
|
|
1941
|
+
signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString()
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Respond to a validation request
|
|
1946
|
+
*
|
|
1947
|
+
* Creates a ValidationResponse attestation via SAS.
|
|
1948
|
+
* Called by validators.
|
|
1949
|
+
*
|
|
1950
|
+
* @param params - Response parameters
|
|
1951
|
+
* @returns Attestation address and signature
|
|
1952
|
+
*/
|
|
1953
|
+
async respondToValidation(params) {
|
|
1954
|
+
const sasConfig = this.requireSASConfig();
|
|
1955
|
+
const { payer, validator, requestAttestation, response, responseUri, responseHash, tag, responseIndex = 0 } = params;
|
|
1956
|
+
if (response < 0 || response > 100) throw new Error("Response must be between 0 and 100");
|
|
1957
|
+
const nonce = computeValidationResponseNonce(requestAttestation, responseIndex);
|
|
1958
|
+
const [attestationPda] = await deriveSatiAttestationPda(sasConfig.credential, sasConfig.schemas.validationResponse, nonce);
|
|
1959
|
+
const schema = await (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.validationResponse);
|
|
1960
|
+
const data = serializeValidationResponseData({
|
|
1961
|
+
request_id: requestAttestation,
|
|
1962
|
+
response,
|
|
1963
|
+
response_uri: responseUri,
|
|
1964
|
+
response_hash: responseHash,
|
|
1965
|
+
tag
|
|
1966
|
+
}, schema.data);
|
|
1967
|
+
const createAttestationIx = await (0, sas_lib.getCreateAttestationInstruction)({
|
|
1968
|
+
payer,
|
|
1969
|
+
authority: validator,
|
|
1970
|
+
credential: sasConfig.credential,
|
|
1971
|
+
schema: sasConfig.schemas.validationResponse,
|
|
1972
|
+
attestation: attestationPda,
|
|
1973
|
+
nonce,
|
|
1974
|
+
expiry: 0,
|
|
1975
|
+
data
|
|
1976
|
+
});
|
|
1977
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
1978
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(createAttestationIx, msg)));
|
|
1979
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
1980
|
+
return {
|
|
1981
|
+
attestation: attestationPda,
|
|
1982
|
+
signature: (0, __solana_kit.getSignatureFromTransaction)(signedTx).toString()
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Get validation status
|
|
1987
|
+
*
|
|
1988
|
+
* Fetches the validation request and looks for any responses.
|
|
1989
|
+
*
|
|
1990
|
+
* @param requestAttestation - ValidationRequest attestation address
|
|
1991
|
+
* @param responseIndex - Response index to check (default: 0)
|
|
1992
|
+
* @returns Validation status or null if not found
|
|
1993
|
+
*/
|
|
1994
|
+
async getValidationStatus(requestAttestation, responseIndex = 0) {
|
|
1995
|
+
const sasConfig = this.requireSASConfig();
|
|
1996
|
+
try {
|
|
1997
|
+
const [requestAccount, requestSchema] = await Promise.all([(0, sas_lib.fetchAttestation)(this.rpc, requestAttestation), (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.validationRequest)]);
|
|
1998
|
+
(0, sas_lib.deserializeAttestationData)(requestSchema.data, requestAccount.data.data);
|
|
1999
|
+
const responseNonce = computeValidationResponseNonce(requestAttestation, responseIndex);
|
|
2000
|
+
const [responseAttestationPda] = await deriveSatiAttestationPda(sasConfig.credential, sasConfig.schemas.validationResponse, responseNonce);
|
|
2001
|
+
let responseData = null;
|
|
2002
|
+
let responseAccount = null;
|
|
2003
|
+
try {
|
|
2004
|
+
const [respAccount, responseSchema] = await Promise.all([(0, sas_lib.fetchAttestation)(this.rpc, responseAttestationPda), (0, sas_lib.fetchSchema)(this.rpc, sasConfig.schemas.validationResponse)]);
|
|
2005
|
+
responseAccount = respAccount;
|
|
2006
|
+
responseData = (0, sas_lib.deserializeAttestationData)(responseSchema.data, respAccount.data.data);
|
|
2007
|
+
} catch {}
|
|
2008
|
+
const responseHash = responseData?.response_hash;
|
|
2009
|
+
return {
|
|
2010
|
+
requestAttestation,
|
|
2011
|
+
responseAttestation: responseData ? responseAttestationPda : void 0,
|
|
2012
|
+
response: responseData?.response,
|
|
2013
|
+
responseUri: responseData?.response_uri || void 0,
|
|
2014
|
+
responseHash: responseHash && responseHash.length > 0 ? responseHash : void 0,
|
|
2015
|
+
tag: responseData?.tag || void 0,
|
|
2016
|
+
validator: requestAccount.data.signer,
|
|
2017
|
+
completed: responseData !== null,
|
|
2018
|
+
responseExpiry: responseAccount ? Number(responseAccount.data.expiry) : void 0
|
|
2019
|
+
};
|
|
2020
|
+
} catch {
|
|
2021
|
+
return null;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Setup SATI SAS schemas with idempotent deployment.
|
|
2026
|
+
*
|
|
2027
|
+
* This method is safe to call multiple times. It will:
|
|
2028
|
+
* 1. Check which components already exist on-chain
|
|
2029
|
+
* 2. Deploy only missing credential and schemas
|
|
2030
|
+
* 3. Verify all components exist after deployment
|
|
2031
|
+
*
|
|
2032
|
+
* @param params - Setup parameters
|
|
2033
|
+
* @returns Deployment result with status and config
|
|
2034
|
+
*/
|
|
2035
|
+
async setupSASSchemas(params) {
|
|
2036
|
+
const { payer, authority, authorizedSigners = [authority.address], testMode = false } = params;
|
|
2037
|
+
const credentialName = testMode ? "SATI_TEST_v0" : SATI_CREDENTIAL_NAME;
|
|
2038
|
+
const schemaNames = testMode ? {
|
|
2039
|
+
FEEDBACK_AUTH: "TestFeedbackAuth_v0",
|
|
2040
|
+
FEEDBACK: "TestFeedback_v0",
|
|
2041
|
+
FEEDBACK_RESPONSE: "TestFeedbackResponse_v0",
|
|
2042
|
+
VALIDATION_REQUEST: "TestValidationRequest_v0",
|
|
2043
|
+
VALIDATION_RESPONSE: "TestValidationResponse_v0",
|
|
2044
|
+
CERTIFICATION: "TestCertification_v0"
|
|
2045
|
+
} : SATI_SCHEMA_NAMES;
|
|
2046
|
+
const [credentialPda] = await (0, sas_lib.deriveCredentialPda)({
|
|
2047
|
+
authority: authority.address,
|
|
2048
|
+
name: credentialName
|
|
2049
|
+
});
|
|
2050
|
+
const schemaKeys = [
|
|
2051
|
+
"FEEDBACK_AUTH",
|
|
2052
|
+
"FEEDBACK",
|
|
2053
|
+
"FEEDBACK_RESPONSE",
|
|
2054
|
+
"VALIDATION_REQUEST",
|
|
2055
|
+
"VALIDATION_RESPONSE",
|
|
2056
|
+
"CERTIFICATION"
|
|
2057
|
+
];
|
|
2058
|
+
const schemaPdas = [];
|
|
2059
|
+
for (const key of schemaKeys) {
|
|
2060
|
+
const [pda] = await (0, sas_lib.deriveSchemaPda)({
|
|
2061
|
+
credential: credentialPda,
|
|
2062
|
+
name: schemaNames[key],
|
|
2063
|
+
version: 1
|
|
2064
|
+
});
|
|
2065
|
+
schemaPdas.push(pda);
|
|
2066
|
+
}
|
|
2067
|
+
const credentialAccount = await (0, sas_lib.fetchMaybeCredential)(this.rpc, credentialPda);
|
|
2068
|
+
const schemaAccounts = await (0, sas_lib.fetchAllMaybeSchema)(this.rpc, schemaPdas);
|
|
2069
|
+
const credentialExists = credentialAccount.exists;
|
|
2070
|
+
const schemaExistsFlags = schemaAccounts.map((acc) => acc.exists);
|
|
2071
|
+
const instructions = [];
|
|
2072
|
+
if (!credentialExists) instructions.push((0, sas_lib.getCreateCredentialInstruction)({
|
|
2073
|
+
payer,
|
|
2074
|
+
credential: credentialPda,
|
|
2075
|
+
authority,
|
|
2076
|
+
name: credentialName,
|
|
2077
|
+
signers: authorizedSigners
|
|
2078
|
+
}));
|
|
2079
|
+
const schemaDefinitions = [
|
|
2080
|
+
{
|
|
2081
|
+
key: "FEEDBACK_AUTH",
|
|
2082
|
+
pda: schemaPdas[0],
|
|
2083
|
+
baseSchema: SATI_SAS_SCHEMAS.FEEDBACK_AUTH
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
key: "FEEDBACK",
|
|
2087
|
+
pda: schemaPdas[1],
|
|
2088
|
+
baseSchema: SATI_SAS_SCHEMAS.FEEDBACK
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
key: "FEEDBACK_RESPONSE",
|
|
2092
|
+
pda: schemaPdas[2],
|
|
2093
|
+
baseSchema: SATI_SAS_SCHEMAS.FEEDBACK_RESPONSE
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
key: "VALIDATION_REQUEST",
|
|
2097
|
+
pda: schemaPdas[3],
|
|
2098
|
+
baseSchema: SATI_SAS_SCHEMAS.VALIDATION_REQUEST
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
key: "VALIDATION_RESPONSE",
|
|
2102
|
+
pda: schemaPdas[4],
|
|
2103
|
+
baseSchema: SATI_SAS_SCHEMAS.VALIDATION_RESPONSE
|
|
2104
|
+
},
|
|
2105
|
+
{
|
|
2106
|
+
key: "CERTIFICATION",
|
|
2107
|
+
pda: schemaPdas[5],
|
|
2108
|
+
baseSchema: SATI_SAS_SCHEMAS.CERTIFICATION
|
|
2109
|
+
}
|
|
2110
|
+
];
|
|
2111
|
+
for (let i = 0; i < schemaDefinitions.length; i++) if (!schemaExistsFlags[i]) {
|
|
2112
|
+
const { key, pda, baseSchema } = schemaDefinitions[i];
|
|
2113
|
+
const schemaWithName = {
|
|
2114
|
+
...baseSchema,
|
|
2115
|
+
name: schemaNames[key]
|
|
2116
|
+
};
|
|
2117
|
+
instructions.push((0, sas_lib.getCreateSchemaInstruction)({
|
|
2118
|
+
payer,
|
|
2119
|
+
authority,
|
|
2120
|
+
credential: credentialPda,
|
|
2121
|
+
schema: pda,
|
|
2122
|
+
name: schemaWithName.name,
|
|
2123
|
+
description: schemaWithName.description,
|
|
2124
|
+
layout: new Uint8Array(schemaWithName.layout),
|
|
2125
|
+
fieldNames: schemaWithName.fieldNames
|
|
2126
|
+
}));
|
|
2127
|
+
}
|
|
2128
|
+
const signatures = [];
|
|
2129
|
+
const BATCH_SIZE = 2;
|
|
2130
|
+
const credentialIx = !credentialExists ? instructions.shift() : null;
|
|
2131
|
+
const schemaIxs = instructions;
|
|
2132
|
+
if (credentialIx) {
|
|
2133
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
2134
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstruction)(credentialIx, msg)));
|
|
2135
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
2136
|
+
const signature = (0, __solana_kit.getSignatureFromTransaction)(signedTx);
|
|
2137
|
+
signatures.push(signature);
|
|
2138
|
+
}
|
|
2139
|
+
for (let i = 0; i < schemaIxs.length; i += BATCH_SIZE) {
|
|
2140
|
+
const batch = schemaIxs.slice(i, i + BATCH_SIZE);
|
|
2141
|
+
const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
|
|
2142
|
+
const signedTx = await (0, __solana_kit.signTransactionMessageWithSigners)((0, __solana_kit.pipe)((0, __solana_kit.createTransactionMessage)({ version: 0 }), (msg) => (0, __solana_kit.setTransactionMessageFeePayer)(payer.address, msg), (msg) => (0, __solana_kit.setTransactionMessageLifetimeUsingBlockhash)(latestBlockhash, msg), (msg) => (0, __solana_kit.appendTransactionMessageInstructions)(batch, msg)));
|
|
2143
|
+
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
2144
|
+
const signature = (0, __solana_kit.getSignatureFromTransaction)(signedTx);
|
|
2145
|
+
signatures.push(signature);
|
|
2146
|
+
}
|
|
2147
|
+
const config = {
|
|
2148
|
+
credential: credentialPda,
|
|
2149
|
+
schemas: {
|
|
2150
|
+
feedbackAuth: schemaPdas[0],
|
|
2151
|
+
feedback: schemaPdas[1],
|
|
2152
|
+
feedbackResponse: schemaPdas[2],
|
|
2153
|
+
validationRequest: schemaPdas[3],
|
|
2154
|
+
validationResponse: schemaPdas[4],
|
|
2155
|
+
certification: schemaPdas[5]
|
|
2156
|
+
}
|
|
2157
|
+
};
|
|
2158
|
+
this.sasConfig = config;
|
|
2159
|
+
const schemaStatuses = schemaDefinitions.map((item, idx) => ({
|
|
2160
|
+
name: schemaNames[item.key],
|
|
2161
|
+
address: schemaPdas[idx],
|
|
2162
|
+
existed: schemaExistsFlags[idx],
|
|
2163
|
+
deployed: !schemaExistsFlags[idx]
|
|
2164
|
+
}));
|
|
2165
|
+
return {
|
|
2166
|
+
success: (await this.verifySASDeployment(config)).verified,
|
|
2167
|
+
credential: {
|
|
2168
|
+
address: credentialPda,
|
|
2169
|
+
existed: credentialExists,
|
|
2170
|
+
deployed: !credentialExists
|
|
2171
|
+
},
|
|
2172
|
+
schemas: schemaStatuses,
|
|
2173
|
+
signatures,
|
|
2174
|
+
config
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Verify that all SAS components exist on-chain.
|
|
2179
|
+
*
|
|
2180
|
+
* @param config - SAS configuration to verify
|
|
2181
|
+
* @returns Verification result with list of missing components
|
|
2182
|
+
*/
|
|
2183
|
+
async verifySASDeployment(config) {
|
|
2184
|
+
const missing = [];
|
|
2185
|
+
if (!(await (0, sas_lib.fetchMaybeCredential)(this.rpc, config.credential)).exists) missing.push("credential");
|
|
2186
|
+
const schemaAddresses = Object.values(config.schemas);
|
|
2187
|
+
const schemaNames = Object.keys(config.schemas);
|
|
2188
|
+
(await (0, sas_lib.fetchAllMaybeSchema)(this.rpc, schemaAddresses)).forEach((acc, idx) => {
|
|
2189
|
+
if (!acc.exists) missing.push(schemaNames[idx]);
|
|
2190
|
+
});
|
|
2191
|
+
return {
|
|
2192
|
+
verified: missing.length === 0,
|
|
2193
|
+
missing
|
|
2194
|
+
};
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
//#endregion
|
|
2199
|
+
exports.ASSOCIATED_TOKEN_PROGRAM_ADDRESS = ASSOCIATED_TOKEN_PROGRAM_ADDRESS;
|
|
2200
|
+
exports.CERTIFICATION_SCHEMA = CERTIFICATION_SCHEMA;
|
|
2201
|
+
exports.FEEDBACK_AUTH_SCHEMA = FEEDBACK_AUTH_SCHEMA;
|
|
2202
|
+
exports.FEEDBACK_RESPONSE_SCHEMA = FEEDBACK_RESPONSE_SCHEMA;
|
|
2203
|
+
exports.FEEDBACK_SCHEMA = FEEDBACK_SCHEMA;
|
|
2204
|
+
exports.INITIALIZE_DISCRIMINATOR = INITIALIZE_DISCRIMINATOR;
|
|
2205
|
+
exports.REGISTER_AGENT_DISCRIMINATOR = REGISTER_AGENT_DISCRIMINATOR;
|
|
2206
|
+
exports.REGISTRY_CONFIG_DISCRIMINATOR = REGISTRY_CONFIG_DISCRIMINATOR;
|
|
2207
|
+
exports.SASLayoutType = SASLayoutType;
|
|
2208
|
+
exports.SAS_PROGRAM_ID = sas_lib.SOLANA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
|
|
2209
|
+
exports.SATI = SATI;
|
|
2210
|
+
exports.SATI_CREDENTIAL_NAME = SATI_CREDENTIAL_NAME;
|
|
2211
|
+
exports.SATI_REGISTRY_ERROR__IMMUTABLE_AUTHORITY = SATI_REGISTRY_ERROR__IMMUTABLE_AUTHORITY;
|
|
2212
|
+
exports.SATI_REGISTRY_ERROR__INVALID_AUTHORITY = SATI_REGISTRY_ERROR__INVALID_AUTHORITY;
|
|
2213
|
+
exports.SATI_REGISTRY_ERROR__INVALID_GROUP_MINT = SATI_REGISTRY_ERROR__INVALID_GROUP_MINT;
|
|
2214
|
+
exports.SATI_REGISTRY_ERROR__METADATA_KEY_TOO_LONG = SATI_REGISTRY_ERROR__METADATA_KEY_TOO_LONG;
|
|
2215
|
+
exports.SATI_REGISTRY_ERROR__METADATA_VALUE_TOO_LONG = SATI_REGISTRY_ERROR__METADATA_VALUE_TOO_LONG;
|
|
2216
|
+
exports.SATI_REGISTRY_ERROR__MINT_AUTHORITY_NOT_RENOUNCED = SATI_REGISTRY_ERROR__MINT_AUTHORITY_NOT_RENOUNCED;
|
|
2217
|
+
exports.SATI_REGISTRY_ERROR__NAME_TOO_LONG = SATI_REGISTRY_ERROR__NAME_TOO_LONG;
|
|
2218
|
+
exports.SATI_REGISTRY_ERROR__OVERFLOW = SATI_REGISTRY_ERROR__OVERFLOW;
|
|
2219
|
+
exports.SATI_REGISTRY_ERROR__SYMBOL_TOO_LONG = SATI_REGISTRY_ERROR__SYMBOL_TOO_LONG;
|
|
2220
|
+
exports.SATI_REGISTRY_ERROR__TOO_MANY_METADATA_ENTRIES = SATI_REGISTRY_ERROR__TOO_MANY_METADATA_ENTRIES;
|
|
2221
|
+
exports.SATI_REGISTRY_ERROR__URI_TOO_LONG = SATI_REGISTRY_ERROR__URI_TOO_LONG;
|
|
2222
|
+
exports.SATI_REGISTRY_PROGRAM_ADDRESS = SATI_REGISTRY_PROGRAM_ADDRESS;
|
|
2223
|
+
exports.SATI_SAS_SCHEMAS = SATI_SAS_SCHEMAS;
|
|
2224
|
+
exports.SATI_SCHEMAS = SATI_SCHEMAS;
|
|
2225
|
+
exports.SATI_SCHEMA_NAMES = SATI_SCHEMA_NAMES;
|
|
2226
|
+
exports.SCHEMA_NAMES = SCHEMA_NAMES;
|
|
2227
|
+
exports.SatiRegistryAccount = SatiRegistryAccount;
|
|
2228
|
+
exports.SatiRegistryInstruction = SatiRegistryInstruction;
|
|
2229
|
+
exports.TOKEN_2022_PROGRAM_ADDRESS = TOKEN_2022_PROGRAM_ADDRESS;
|
|
2230
|
+
exports.UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR = UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR;
|
|
2231
|
+
exports.VALIDATION_REQUEST_SCHEMA = VALIDATION_REQUEST_SCHEMA;
|
|
2232
|
+
exports.VALIDATION_RESPONSE_SCHEMA = VALIDATION_RESPONSE_SCHEMA;
|
|
2233
|
+
Object.defineProperty(exports, 'address', {
|
|
2234
|
+
enumerable: true,
|
|
2235
|
+
get: function () {
|
|
2236
|
+
return __solana_kit.address;
|
|
2237
|
+
}
|
|
2238
|
+
});
|
|
2239
|
+
exports.computeCertificationNonce = computeCertificationNonce;
|
|
2240
|
+
exports.computeFeedbackAuthNonce = computeFeedbackAuthNonce;
|
|
2241
|
+
exports.computeFeedbackNonce = computeFeedbackNonce;
|
|
2242
|
+
exports.computeFeedbackResponseNonce = computeFeedbackResponseNonce;
|
|
2243
|
+
exports.computeValidationRequestNonce = computeValidationRequestNonce;
|
|
2244
|
+
exports.computeValidationResponseNonce = computeValidationResponseNonce;
|
|
2245
|
+
exports.decodeRegistryConfig = decodeRegistryConfig;
|
|
2246
|
+
exports.deriveAttestationPda = sas_lib.deriveAttestationPda;
|
|
2247
|
+
exports.deriveCredentialPda = sas_lib.deriveCredentialPda;
|
|
2248
|
+
exports.deriveEventAuthorityAddress = sas_lib.deriveEventAuthorityAddress;
|
|
2249
|
+
exports.deriveSatiAttestationPda = deriveSatiAttestationPda;
|
|
2250
|
+
exports.deriveSatiCredentialPda = deriveSatiCredentialPda;
|
|
2251
|
+
exports.deriveSatiSchemaPda = deriveSatiSchemaPda;
|
|
2252
|
+
exports.deriveSchemaPda = sas_lib.deriveSchemaPda;
|
|
2253
|
+
exports.deserializeAttestationData = sas_lib.deserializeAttestationData;
|
|
2254
|
+
exports.fetchAllMaybeRegistryConfig = fetchAllMaybeRegistryConfig;
|
|
2255
|
+
exports.fetchAllMaybeSchema = sas_lib.fetchAllMaybeSchema;
|
|
2256
|
+
exports.fetchAllRegistryConfig = fetchAllRegistryConfig;
|
|
2257
|
+
exports.fetchAttestation = sas_lib.fetchAttestation;
|
|
2258
|
+
exports.fetchMaybeCredential = sas_lib.fetchMaybeCredential;
|
|
2259
|
+
exports.fetchMaybeRegistryConfig = fetchMaybeRegistryConfig;
|
|
2260
|
+
exports.fetchMaybeSchema = sas_lib.fetchMaybeSchema;
|
|
2261
|
+
exports.fetchRegistryConfig = fetchRegistryConfig;
|
|
2262
|
+
exports.fetchSchema = sas_lib.fetchSchema;
|
|
2263
|
+
exports.findAssociatedTokenAddress = findAssociatedTokenAddress;
|
|
2264
|
+
exports.findGroupMintPda = findGroupMintPda;
|
|
2265
|
+
exports.findRegistryConfigPda = findRegistryConfigPda;
|
|
2266
|
+
exports.getAgentRegisteredCodec = getAgentRegisteredCodec;
|
|
2267
|
+
exports.getAgentRegisteredDecoder = getAgentRegisteredDecoder;
|
|
2268
|
+
exports.getAgentRegisteredEncoder = getAgentRegisteredEncoder;
|
|
2269
|
+
exports.getCloseAttestationInstruction = sas_lib.getCloseAttestationInstruction;
|
|
2270
|
+
exports.getCreateAttestationInstruction = sas_lib.getCreateAttestationInstruction;
|
|
2271
|
+
exports.getCreateCredentialInstruction = sas_lib.getCreateCredentialInstruction;
|
|
2272
|
+
exports.getCreateSatiCredentialInstruction = getCreateSatiCredentialInstruction;
|
|
2273
|
+
exports.getCreateSatiSchemaInstruction = getCreateSatiSchemaInstruction;
|
|
2274
|
+
exports.getCreateSchemaInstruction = sas_lib.getCreateSchemaInstruction;
|
|
2275
|
+
exports.getDeployedNetworks = getDeployedNetworks;
|
|
2276
|
+
exports.getInitializeDiscriminatorBytes = getInitializeDiscriminatorBytes;
|
|
2277
|
+
exports.getInitializeInstruction = getInitializeInstruction;
|
|
2278
|
+
exports.getInitializeInstructionAsync = getInitializeInstructionAsync;
|
|
2279
|
+
exports.getInitializeInstructionDataCodec = getInitializeInstructionDataCodec;
|
|
2280
|
+
exports.getInitializeInstructionDataDecoder = getInitializeInstructionDataDecoder;
|
|
2281
|
+
exports.getInitializeInstructionDataEncoder = getInitializeInstructionDataEncoder;
|
|
2282
|
+
exports.getMetadataEntryCodec = getMetadataEntryCodec;
|
|
2283
|
+
exports.getMetadataEntryDecoder = getMetadataEntryDecoder;
|
|
2284
|
+
exports.getMetadataEntryEncoder = getMetadataEntryEncoder;
|
|
2285
|
+
exports.getRegisterAgentDiscriminatorBytes = getRegisterAgentDiscriminatorBytes;
|
|
2286
|
+
exports.getRegisterAgentInstruction = getRegisterAgentInstruction;
|
|
2287
|
+
exports.getRegisterAgentInstructionAsync = getRegisterAgentInstructionAsync;
|
|
2288
|
+
exports.getRegisterAgentInstructionDataCodec = getRegisterAgentInstructionDataCodec;
|
|
2289
|
+
exports.getRegisterAgentInstructionDataDecoder = getRegisterAgentInstructionDataDecoder;
|
|
2290
|
+
exports.getRegisterAgentInstructionDataEncoder = getRegisterAgentInstructionDataEncoder;
|
|
2291
|
+
exports.getRegistryAuthorityUpdatedCodec = getRegistryAuthorityUpdatedCodec;
|
|
2292
|
+
exports.getRegistryAuthorityUpdatedDecoder = getRegistryAuthorityUpdatedDecoder;
|
|
2293
|
+
exports.getRegistryAuthorityUpdatedEncoder = getRegistryAuthorityUpdatedEncoder;
|
|
2294
|
+
exports.getRegistryConfigCodec = getRegistryConfigCodec;
|
|
2295
|
+
exports.getRegistryConfigDecoder = getRegistryConfigDecoder;
|
|
2296
|
+
exports.getRegistryConfigDiscriminatorBytes = getRegistryConfigDiscriminatorBytes;
|
|
2297
|
+
exports.getRegistryConfigEncoder = getRegistryConfigEncoder;
|
|
2298
|
+
exports.getRegistryConfigSize = getRegistryConfigSize;
|
|
2299
|
+
exports.getRegistryInitializedCodec = getRegistryInitializedCodec;
|
|
2300
|
+
exports.getRegistryInitializedDecoder = getRegistryInitializedDecoder;
|
|
2301
|
+
exports.getRegistryInitializedEncoder = getRegistryInitializedEncoder;
|
|
2302
|
+
exports.getSatiRegistryErrorMessage = getSatiRegistryErrorMessage;
|
|
2303
|
+
exports.getUpdateRegistryAuthorityDiscriminatorBytes = getUpdateRegistryAuthorityDiscriminatorBytes;
|
|
2304
|
+
exports.getUpdateRegistryAuthorityInstruction = getUpdateRegistryAuthorityInstruction;
|
|
2305
|
+
exports.getUpdateRegistryAuthorityInstructionAsync = getUpdateRegistryAuthorityInstructionAsync;
|
|
2306
|
+
exports.getUpdateRegistryAuthorityInstructionDataCodec = getUpdateRegistryAuthorityInstructionDataCodec;
|
|
2307
|
+
exports.getUpdateRegistryAuthorityInstructionDataDecoder = getUpdateRegistryAuthorityInstructionDataDecoder;
|
|
2308
|
+
exports.getUpdateRegistryAuthorityInstructionDataEncoder = getUpdateRegistryAuthorityInstructionDataEncoder;
|
|
2309
|
+
exports.hasDeployedConfig = hasDeployedConfig;
|
|
2310
|
+
exports.identifySatiRegistryAccount = identifySatiRegistryAccount;
|
|
2311
|
+
exports.identifySatiRegistryInstruction = identifySatiRegistryInstruction;
|
|
2312
|
+
exports.isSatiRegistryError = isSatiRegistryError;
|
|
2313
|
+
exports.loadDeployedConfig = loadDeployedConfig;
|
|
2314
|
+
exports.parseInitializeInstruction = parseInitializeInstruction;
|
|
2315
|
+
exports.parseRegisterAgentInstruction = parseRegisterAgentInstruction;
|
|
2316
|
+
exports.parseUpdateRegistryAuthorityInstruction = parseUpdateRegistryAuthorityInstruction;
|
|
2317
|
+
exports.serializeAttestationData = sas_lib.serializeAttestationData;
|
|
2318
|
+
exports.serializeCertificationData = serializeCertificationData;
|
|
2319
|
+
exports.serializeFeedbackAuthData = serializeFeedbackAuthData;
|
|
2320
|
+
exports.serializeFeedbackData = serializeFeedbackData;
|
|
2321
|
+
exports.serializeFeedbackResponseData = serializeFeedbackResponseData;
|
|
2322
|
+
exports.serializeValidationRequestData = serializeValidationRequestData;
|
|
2323
|
+
exports.serializeValidationResponseData = serializeValidationResponseData;
|