trezoa-sas-lib 1.0.11

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.
Files changed (57) hide show
  1. package/dist/src/generated/accounts/attestation.d.ts +40 -0
  2. package/dist/src/generated/accounts/attestation.js +69 -0
  3. package/dist/src/generated/accounts/credential.d.ts +27 -0
  4. package/dist/src/generated/accounts/credential.js +61 -0
  5. package/dist/src/generated/accounts/index.d.ts +10 -0
  6. package/dist/src/generated/accounts/index.js +26 -0
  7. package/dist/src/generated/accounts/schema.d.ts +31 -0
  8. package/dist/src/generated/accounts/schema.js +69 -0
  9. package/dist/src/generated/index.d.ts +11 -0
  10. package/dist/src/generated/index.js +27 -0
  11. package/dist/src/generated/instructions/changeAuthorizedSigners.d.ts +51 -0
  12. package/dist/src/generated/instructions/changeAuthorizedSigners.js +93 -0
  13. package/dist/src/generated/instructions/changeSchemaDescription.d.ts +56 -0
  14. package/dist/src/generated/instructions/changeSchemaDescription.js +96 -0
  15. package/dist/src/generated/instructions/changeSchemaStatus.d.ts +50 -0
  16. package/dist/src/generated/instructions/changeSchemaStatus.js +82 -0
  17. package/dist/src/generated/instructions/changeSchemaVersion.d.ts +60 -0
  18. package/dist/src/generated/instructions/changeSchemaVersion.js +107 -0
  19. package/dist/src/generated/instructions/closeAttestation.d.ts +56 -0
  20. package/dist/src/generated/instructions/closeAttestation.js +102 -0
  21. package/dist/src/generated/instructions/closeTokenizedAttestation.d.ts +74 -0
  22. package/dist/src/generated/instructions/closeTokenizedAttestation.js +124 -0
  23. package/dist/src/generated/instructions/createAttestation.d.ts +67 -0
  24. package/dist/src/generated/instructions/createAttestation.js +100 -0
  25. package/dist/src/generated/instructions/createCredential.d.ts +52 -0
  26. package/dist/src/generated/instructions/createCredential.js +92 -0
  27. package/dist/src/generated/instructions/createSchema.d.ts +63 -0
  28. package/dist/src/generated/instructions/createSchema.js +105 -0
  29. package/dist/src/generated/instructions/createTokenizedAttestation.d.ts +110 -0
  30. package/dist/src/generated/instructions/createTokenizedAttestation.js +146 -0
  31. package/dist/src/generated/instructions/emitEvent.d.ts +36 -0
  32. package/dist/src/generated/instructions/emitEvent.js +69 -0
  33. package/dist/src/generated/instructions/index.d.ts +19 -0
  34. package/dist/src/generated/instructions/index.js +35 -0
  35. package/dist/src/generated/instructions/tokenizeSchema.d.ts +67 -0
  36. package/dist/src/generated/instructions/tokenizeSchema.js +106 -0
  37. package/dist/src/generated/programs/index.d.ts +8 -0
  38. package/dist/src/generated/programs/index.js +24 -0
  39. package/dist/src/generated/programs/trezoaAttestationService.d.ts +57 -0
  40. package/dist/src/generated/programs/trezoaAttestationService.js +74 -0
  41. package/dist/src/generated/shared/index.d.ts +49 -0
  42. package/dist/src/generated/shared/index.js +94 -0
  43. package/dist/src/generated/types/closeAttestationEvent.d.ts +17 -0
  44. package/dist/src/generated/types/closeAttestationEvent.js +36 -0
  45. package/dist/src/generated/types/index.d.ts +8 -0
  46. package/dist/src/generated/types/index.js +24 -0
  47. package/dist/src/index.d.ts +3 -0
  48. package/dist/src/index.js +19 -0
  49. package/dist/src/pdas.d.ts +69 -0
  50. package/dist/src/pdas.js +96 -0
  51. package/dist/src/utils.d.ts +21 -0
  52. package/dist/src/utils.js +98 -0
  53. package/dist/test/pdas.d.ts +1 -0
  54. package/dist/test/pdas.js +61 -0
  55. package/dist/test/utils.d.ts +1 -0
  56. package/dist/test/utils.js +29 -0
  57. package/package.json +29 -0
@@ -0,0 +1,110 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type AccountMeta, type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@trezoa/kit';
9
+ import { TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const CREATE_TOKENIZED_ATTESTATION_DISCRIMINATOR = 10;
11
+ export declare function getCreateTokenizedAttestationDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type CreateTokenizedAttestationInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountPayer extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountCredential extends string | AccountMeta<string> = string, TAccountSchema extends string | AccountMeta<string> = string, TAccountAttestation extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', TAccountSchemaMint extends string | AccountMeta<string> = string, TAccountAttestationMint extends string | AccountMeta<string> = string, TAccountSasPda extends string | AccountMeta<string> = string, TAccountRecipientTokenAccount extends string | AccountMeta<string> = string, TAccountRecipient extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', TAccountAssociatedTokenProgram extends string | AccountMeta<string> = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL', TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
13
+ TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer,
14
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
15
+ TAccountCredential extends string ? ReadonlyAccount<TAccountCredential> : TAccountCredential,
16
+ TAccountSchema extends string ? ReadonlyAccount<TAccountSchema> : TAccountSchema,
17
+ TAccountAttestation extends string ? WritableAccount<TAccountAttestation> : TAccountAttestation,
18
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
19
+ TAccountSchemaMint extends string ? WritableAccount<TAccountSchemaMint> : TAccountSchemaMint,
20
+ TAccountAttestationMint extends string ? WritableAccount<TAccountAttestationMint> : TAccountAttestationMint,
21
+ TAccountSasPda extends string ? ReadonlyAccount<TAccountSasPda> : TAccountSasPda,
22
+ TAccountRecipientTokenAccount extends string ? WritableAccount<TAccountRecipientTokenAccount> : TAccountRecipientTokenAccount,
23
+ TAccountRecipient extends string ? ReadonlyAccount<TAccountRecipient> : TAccountRecipient,
24
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
25
+ TAccountAssociatedTokenProgram extends string ? ReadonlyAccount<TAccountAssociatedTokenProgram> : TAccountAssociatedTokenProgram,
26
+ ...TRemainingAccounts
27
+ ]>;
28
+ export type CreateTokenizedAttestationInstructionData = {
29
+ discriminator: number;
30
+ nonce: Address;
31
+ data: ReadonlyUint8Array;
32
+ expiry: bigint;
33
+ name: string;
34
+ uri: string;
35
+ symbol: string;
36
+ mintAccountSpace: number;
37
+ };
38
+ export type CreateTokenizedAttestationInstructionDataArgs = {
39
+ nonce: Address;
40
+ data: ReadonlyUint8Array;
41
+ expiry: number | bigint;
42
+ name: string;
43
+ uri: string;
44
+ symbol: string;
45
+ mintAccountSpace: number;
46
+ };
47
+ export declare function getCreateTokenizedAttestationInstructionDataEncoder(): Encoder<CreateTokenizedAttestationInstructionDataArgs>;
48
+ export declare function getCreateTokenizedAttestationInstructionDataDecoder(): Decoder<CreateTokenizedAttestationInstructionData>;
49
+ export declare function getCreateTokenizedAttestationInstructionDataCodec(): Codec<CreateTokenizedAttestationInstructionDataArgs, CreateTokenizedAttestationInstructionData>;
50
+ export type CreateTokenizedAttestationInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountSchema extends string = string, TAccountAttestation extends string = string, TAccountSystemProgram extends string = string, TAccountSchemaMint extends string = string, TAccountAttestationMint extends string = string, TAccountSasPda extends string = string, TAccountRecipientTokenAccount extends string = string, TAccountRecipient extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string> = {
51
+ payer: TransactionSigner<TAccountPayer>;
52
+ /** Authorized signer of the Schema's Credential */
53
+ authority: TransactionSigner<TAccountAuthority>;
54
+ /** Credential the Schema is associated with */
55
+ credential: Address<TAccountCredential>;
56
+ /** Schema the Attestation is associated with */
57
+ schema: Address<TAccountSchema>;
58
+ attestation: Address<TAccountAttestation>;
59
+ systemProgram?: Address<TAccountSystemProgram>;
60
+ /** Mint of Schema Token */
61
+ schemaMint: Address<TAccountSchemaMint>;
62
+ /** Mint of Attestation Token */
63
+ attestationMint: Address<TAccountAttestationMint>;
64
+ /** Program derived address used as program signer authority */
65
+ sasPda: Address<TAccountSasPda>;
66
+ /** Associated token account of Recipient for Attestation Token */
67
+ recipientTokenAccount: Address<TAccountRecipientTokenAccount>;
68
+ /** Wallet to receive Attestation Token */
69
+ recipient: Address<TAccountRecipient>;
70
+ tokenProgram?: Address<TAccountTokenProgram>;
71
+ associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
72
+ nonce: CreateTokenizedAttestationInstructionDataArgs['nonce'];
73
+ data: CreateTokenizedAttestationInstructionDataArgs['data'];
74
+ expiry: CreateTokenizedAttestationInstructionDataArgs['expiry'];
75
+ name: CreateTokenizedAttestationInstructionDataArgs['name'];
76
+ uri: CreateTokenizedAttestationInstructionDataArgs['uri'];
77
+ symbol: CreateTokenizedAttestationInstructionDataArgs['symbol'];
78
+ mintAccountSpace: CreateTokenizedAttestationInstructionDataArgs['mintAccountSpace'];
79
+ };
80
+ export declare function getCreateTokenizedAttestationInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountSchema extends string, TAccountAttestation extends string, TAccountSystemProgram extends string, TAccountSchemaMint extends string, TAccountAttestationMint extends string, TAccountSasPda extends string, TAccountRecipientTokenAccount extends string, TAccountRecipient extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: CreateTokenizedAttestationInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSchema, TAccountAttestation, TAccountSystemProgram, TAccountSchemaMint, TAccountAttestationMint, TAccountSasPda, TAccountRecipientTokenAccount, TAccountRecipient, TAccountTokenProgram, TAccountAssociatedTokenProgram>, config?: {
81
+ programAddress?: TProgramAddress;
82
+ }): CreateTokenizedAttestationInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSchema, TAccountAttestation, TAccountSystemProgram, TAccountSchemaMint, TAccountAttestationMint, TAccountSasPda, TAccountRecipientTokenAccount, TAccountRecipient, TAccountTokenProgram, TAccountAssociatedTokenProgram>;
83
+ export type ParsedCreateTokenizedAttestationInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
84
+ programAddress: Address<TProgram>;
85
+ accounts: {
86
+ payer: TAccountMetas[0];
87
+ /** Authorized signer of the Schema's Credential */
88
+ authority: TAccountMetas[1];
89
+ /** Credential the Schema is associated with */
90
+ credential: TAccountMetas[2];
91
+ /** Schema the Attestation is associated with */
92
+ schema: TAccountMetas[3];
93
+ attestation: TAccountMetas[4];
94
+ systemProgram: TAccountMetas[5];
95
+ /** Mint of Schema Token */
96
+ schemaMint: TAccountMetas[6];
97
+ /** Mint of Attestation Token */
98
+ attestationMint: TAccountMetas[7];
99
+ /** Program derived address used as program signer authority */
100
+ sasPda: TAccountMetas[8];
101
+ /** Associated token account of Recipient for Attestation Token */
102
+ recipientTokenAccount: TAccountMetas[9];
103
+ /** Wallet to receive Attestation Token */
104
+ recipient: TAccountMetas[10];
105
+ tokenProgram: TAccountMetas[11];
106
+ associatedTokenProgram: TAccountMetas[12];
107
+ };
108
+ data: CreateTokenizedAttestationInstructionData;
109
+ };
110
+ export declare function parseCreateTokenizedAttestationInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCreateTokenizedAttestationInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CREATE_TOKENIZED_ATTESTATION_DISCRIMINATOR = void 0;
11
+ exports.getCreateTokenizedAttestationDiscriminatorBytes = getCreateTokenizedAttestationDiscriminatorBytes;
12
+ exports.getCreateTokenizedAttestationInstructionDataEncoder = getCreateTokenizedAttestationInstructionDataEncoder;
13
+ exports.getCreateTokenizedAttestationInstructionDataDecoder = getCreateTokenizedAttestationInstructionDataDecoder;
14
+ exports.getCreateTokenizedAttestationInstructionDataCodec = getCreateTokenizedAttestationInstructionDataCodec;
15
+ exports.getCreateTokenizedAttestationInstruction = getCreateTokenizedAttestationInstruction;
16
+ exports.parseCreateTokenizedAttestationInstruction = parseCreateTokenizedAttestationInstruction;
17
+ const kit_1 = require("@trezoa/kit");
18
+ const programs_1 = require("../programs");
19
+ const shared_1 = require("../shared");
20
+ exports.CREATE_TOKENIZED_ATTESTATION_DISCRIMINATOR = 10;
21
+ function getCreateTokenizedAttestationDiscriminatorBytes() {
22
+ return (0, kit_1.getU8Encoder)().encode(exports.CREATE_TOKENIZED_ATTESTATION_DISCRIMINATOR);
23
+ }
24
+ function getCreateTokenizedAttestationInstructionDataEncoder() {
25
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
26
+ ['discriminator', (0, kit_1.getU8Encoder)()],
27
+ ['nonce', (0, kit_1.getAddressEncoder)()],
28
+ ['data', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
29
+ ['expiry', (0, kit_1.getI64Encoder)()],
30
+ ['name', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getUtf8Encoder)(), (0, kit_1.getU32Encoder)())],
31
+ ['uri', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getUtf8Encoder)(), (0, kit_1.getU32Encoder)())],
32
+ ['symbol', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getUtf8Encoder)(), (0, kit_1.getU32Encoder)())],
33
+ ['mintAccountSpace', (0, kit_1.getU16Encoder)()],
34
+ ]), (value) => ({
35
+ ...value,
36
+ discriminator: exports.CREATE_TOKENIZED_ATTESTATION_DISCRIMINATOR,
37
+ }));
38
+ }
39
+ function getCreateTokenizedAttestationInstructionDataDecoder() {
40
+ return (0, kit_1.getStructDecoder)([
41
+ ['discriminator', (0, kit_1.getU8Decoder)()],
42
+ ['nonce', (0, kit_1.getAddressDecoder)()],
43
+ ['data', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
44
+ ['expiry', (0, kit_1.getI64Decoder)()],
45
+ ['name', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getUtf8Decoder)(), (0, kit_1.getU32Decoder)())],
46
+ ['uri', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getUtf8Decoder)(), (0, kit_1.getU32Decoder)())],
47
+ ['symbol', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getUtf8Decoder)(), (0, kit_1.getU32Decoder)())],
48
+ ['mintAccountSpace', (0, kit_1.getU16Decoder)()],
49
+ ]);
50
+ }
51
+ function getCreateTokenizedAttestationInstructionDataCodec() {
52
+ return (0, kit_1.combineCodec)(getCreateTokenizedAttestationInstructionDataEncoder(), getCreateTokenizedAttestationInstructionDataDecoder());
53
+ }
54
+ function getCreateTokenizedAttestationInstruction(input, config) {
55
+ // Program address.
56
+ const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
57
+ // Original accounts.
58
+ const originalAccounts = {
59
+ payer: { value: input.payer ?? null, isWritable: true },
60
+ authority: { value: input.authority ?? null, isWritable: false },
61
+ credential: { value: input.credential ?? null, isWritable: false },
62
+ schema: { value: input.schema ?? null, isWritable: false },
63
+ attestation: { value: input.attestation ?? null, isWritable: true },
64
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
65
+ schemaMint: { value: input.schemaMint ?? null, isWritable: true },
66
+ attestationMint: { value: input.attestationMint ?? null, isWritable: true },
67
+ sasPda: { value: input.sasPda ?? null, isWritable: false },
68
+ recipientTokenAccount: {
69
+ value: input.recipientTokenAccount ?? null,
70
+ isWritable: true,
71
+ },
72
+ recipient: { value: input.recipient ?? null, isWritable: false },
73
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
74
+ associatedTokenProgram: {
75
+ value: input.associatedTokenProgram ?? null,
76
+ isWritable: false,
77
+ },
78
+ };
79
+ const accounts = originalAccounts;
80
+ // Original args.
81
+ const args = { ...input };
82
+ // Resolve default values.
83
+ if (!accounts.systemProgram.value) {
84
+ accounts.systemProgram.value =
85
+ '11111111111111111111111111111111';
86
+ }
87
+ if (!accounts.tokenProgram.value) {
88
+ accounts.tokenProgram.value =
89
+ 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
90
+ }
91
+ if (!accounts.associatedTokenProgram.value) {
92
+ accounts.associatedTokenProgram.value =
93
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
94
+ }
95
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
96
+ return Object.freeze({
97
+ accounts: [
98
+ getAccountMeta(accounts.payer),
99
+ getAccountMeta(accounts.authority),
100
+ getAccountMeta(accounts.credential),
101
+ getAccountMeta(accounts.schema),
102
+ getAccountMeta(accounts.attestation),
103
+ getAccountMeta(accounts.systemProgram),
104
+ getAccountMeta(accounts.schemaMint),
105
+ getAccountMeta(accounts.attestationMint),
106
+ getAccountMeta(accounts.sasPda),
107
+ getAccountMeta(accounts.recipientTokenAccount),
108
+ getAccountMeta(accounts.recipient),
109
+ getAccountMeta(accounts.tokenProgram),
110
+ getAccountMeta(accounts.associatedTokenProgram),
111
+ ],
112
+ data: getCreateTokenizedAttestationInstructionDataEncoder().encode(args),
113
+ programAddress,
114
+ });
115
+ }
116
+ function parseCreateTokenizedAttestationInstruction(instruction) {
117
+ if (instruction.accounts.length < 13) {
118
+ // TODO: Coded error.
119
+ throw new Error('Not enough accounts');
120
+ }
121
+ let accountIndex = 0;
122
+ const getNextAccount = () => {
123
+ const accountMeta = instruction.accounts[accountIndex];
124
+ accountIndex += 1;
125
+ return accountMeta;
126
+ };
127
+ return {
128
+ programAddress: instruction.programAddress,
129
+ accounts: {
130
+ payer: getNextAccount(),
131
+ authority: getNextAccount(),
132
+ credential: getNextAccount(),
133
+ schema: getNextAccount(),
134
+ attestation: getNextAccount(),
135
+ systemProgram: getNextAccount(),
136
+ schemaMint: getNextAccount(),
137
+ attestationMint: getNextAccount(),
138
+ sasPda: getNextAccount(),
139
+ recipientTokenAccount: getNextAccount(),
140
+ recipient: getNextAccount(),
141
+ tokenProgram: getNextAccount(),
142
+ associatedTokenProgram: getNextAccount(),
143
+ },
144
+ data: getCreateTokenizedAttestationInstructionDataDecoder().decode(instruction.data),
145
+ };
146
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner } from '@trezoa/kit';
9
+ import { TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const EMIT_EVENT_DISCRIMINATOR = 228;
11
+ export declare function getEmitEventDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type EmitEventInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountEventAuthority extends string | AccountMeta<string> = '9qmfijJ9MX4XVGdgWB64UuGUb19guVXrpn1HxweCybVb', TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
13
+ TAccountEventAuthority extends string ? ReadonlySignerAccount<TAccountEventAuthority> & AccountSignerMeta<TAccountEventAuthority> : TAccountEventAuthority,
14
+ ...TRemainingAccounts
15
+ ]>;
16
+ export type EmitEventInstructionData = {
17
+ discriminator: number;
18
+ };
19
+ export type EmitEventInstructionDataArgs = {};
20
+ export declare function getEmitEventInstructionDataEncoder(): FixedSizeEncoder<EmitEventInstructionDataArgs>;
21
+ export declare function getEmitEventInstructionDataDecoder(): FixedSizeDecoder<EmitEventInstructionData>;
22
+ export declare function getEmitEventInstructionDataCodec(): FixedSizeCodec<EmitEventInstructionDataArgs, EmitEventInstructionData>;
23
+ export type EmitEventInput<TAccountEventAuthority extends string = string> = {
24
+ eventAuthority?: TransactionSigner<TAccountEventAuthority>;
25
+ };
26
+ export declare function getEmitEventInstruction<TAccountEventAuthority extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: EmitEventInput<TAccountEventAuthority>, config?: {
27
+ programAddress?: TProgramAddress;
28
+ }): EmitEventInstruction<TProgramAddress, TAccountEventAuthority>;
29
+ export type ParsedEmitEventInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
30
+ programAddress: Address<TProgram>;
31
+ accounts: {
32
+ eventAuthority: TAccountMetas[0];
33
+ };
34
+ data: EmitEventInstructionData;
35
+ };
36
+ export declare function parseEmitEventInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedEmitEventInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.EMIT_EVENT_DISCRIMINATOR = void 0;
11
+ exports.getEmitEventDiscriminatorBytes = getEmitEventDiscriminatorBytes;
12
+ exports.getEmitEventInstructionDataEncoder = getEmitEventInstructionDataEncoder;
13
+ exports.getEmitEventInstructionDataDecoder = getEmitEventInstructionDataDecoder;
14
+ exports.getEmitEventInstructionDataCodec = getEmitEventInstructionDataCodec;
15
+ exports.getEmitEventInstruction = getEmitEventInstruction;
16
+ exports.parseEmitEventInstruction = parseEmitEventInstruction;
17
+ const kit_1 = require("@trezoa/kit");
18
+ const programs_1 = require("../programs");
19
+ const shared_1 = require("../shared");
20
+ exports.EMIT_EVENT_DISCRIMINATOR = 228;
21
+ function getEmitEventDiscriminatorBytes() {
22
+ return (0, kit_1.getU8Encoder)().encode(exports.EMIT_EVENT_DISCRIMINATOR);
23
+ }
24
+ function getEmitEventInstructionDataEncoder() {
25
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.getU8Encoder)()]]), (value) => ({ ...value, discriminator: exports.EMIT_EVENT_DISCRIMINATOR }));
26
+ }
27
+ function getEmitEventInstructionDataDecoder() {
28
+ return (0, kit_1.getStructDecoder)([['discriminator', (0, kit_1.getU8Decoder)()]]);
29
+ }
30
+ function getEmitEventInstructionDataCodec() {
31
+ return (0, kit_1.combineCodec)(getEmitEventInstructionDataEncoder(), getEmitEventInstructionDataDecoder());
32
+ }
33
+ function getEmitEventInstruction(input, config) {
34
+ // Program address.
35
+ const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
36
+ // Original accounts.
37
+ const originalAccounts = {
38
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
39
+ };
40
+ const accounts = originalAccounts;
41
+ // Resolve default values.
42
+ if (!accounts.eventAuthority.value) {
43
+ accounts.eventAuthority.value =
44
+ '9qmfijJ9MX4XVGdgWB64UuGUb19guVXrpn1HxweCybVb';
45
+ }
46
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
47
+ return Object.freeze({
48
+ accounts: [getAccountMeta(accounts.eventAuthority)],
49
+ data: getEmitEventInstructionDataEncoder().encode({}),
50
+ programAddress,
51
+ });
52
+ }
53
+ function parseEmitEventInstruction(instruction) {
54
+ if (instruction.accounts.length < 1) {
55
+ // TODO: Coded error.
56
+ throw new Error('Not enough accounts');
57
+ }
58
+ let accountIndex = 0;
59
+ const getNextAccount = () => {
60
+ const accountMeta = instruction.accounts[accountIndex];
61
+ accountIndex += 1;
62
+ return accountMeta;
63
+ };
64
+ return {
65
+ programAddress: instruction.programAddress,
66
+ accounts: { eventAuthority: getNextAccount() },
67
+ data: getEmitEventInstructionDataDecoder().decode(instruction.data),
68
+ };
69
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ export * from './changeAuthorizedSigners';
9
+ export * from './changeSchemaDescription';
10
+ export * from './changeSchemaStatus';
11
+ export * from './changeSchemaVersion';
12
+ export * from './closeAttestation';
13
+ export * from './closeTokenizedAttestation';
14
+ export * from './createAttestation';
15
+ export * from './createCredential';
16
+ export * from './createSchema';
17
+ export * from './createTokenizedAttestation';
18
+ export * from './emitEvent';
19
+ export * from './tokenizeSchema';
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("./changeAuthorizedSigners"), exports);
25
+ __exportStar(require("./changeSchemaDescription"), exports);
26
+ __exportStar(require("./changeSchemaStatus"), exports);
27
+ __exportStar(require("./changeSchemaVersion"), exports);
28
+ __exportStar(require("./closeAttestation"), exports);
29
+ __exportStar(require("./closeTokenizedAttestation"), exports);
30
+ __exportStar(require("./createAttestation"), exports);
31
+ __exportStar(require("./createCredential"), exports);
32
+ __exportStar(require("./createSchema"), exports);
33
+ __exportStar(require("./createTokenizedAttestation"), exports);
34
+ __exportStar(require("./emitEvent"), exports);
35
+ __exportStar(require("./tokenizeSchema"), exports);
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@trezoa/kit';
9
+ import { TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const TOKENIZE_SCHEMA_DISCRIMINATOR = 9;
11
+ export declare function getTokenizeSchemaDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type TokenizeSchemaInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountPayer extends string | AccountMeta<string> = string, TAccountAuthority extends string | AccountMeta<string> = string, TAccountCredential extends string | AccountMeta<string> = string, TAccountSchema extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountSasPda extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', TAccountTokenProgram extends string | AccountMeta<string> = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
13
+ TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer,
14
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
15
+ TAccountCredential extends string ? ReadonlyAccount<TAccountCredential> : TAccountCredential,
16
+ TAccountSchema extends string ? ReadonlyAccount<TAccountSchema> : TAccountSchema,
17
+ TAccountMint extends string ? WritableAccount<TAccountMint> : TAccountMint,
18
+ TAccountSasPda extends string ? ReadonlyAccount<TAccountSasPda> : TAccountSasPda,
19
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
20
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
21
+ ...TRemainingAccounts
22
+ ]>;
23
+ export type TokenizeSchemaInstructionData = {
24
+ discriminator: number;
25
+ maxSize: bigint;
26
+ };
27
+ export type TokenizeSchemaInstructionDataArgs = {
28
+ maxSize: number | bigint;
29
+ };
30
+ export declare function getTokenizeSchemaInstructionDataEncoder(): FixedSizeEncoder<TokenizeSchemaInstructionDataArgs>;
31
+ export declare function getTokenizeSchemaInstructionDataDecoder(): FixedSizeDecoder<TokenizeSchemaInstructionData>;
32
+ export declare function getTokenizeSchemaInstructionDataCodec(): FixedSizeCodec<TokenizeSchemaInstructionDataArgs, TokenizeSchemaInstructionData>;
33
+ export type TokenizeSchemaInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountSchema extends string = string, TAccountMint extends string = string, TAccountSasPda extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string> = {
34
+ payer: TransactionSigner<TAccountPayer>;
35
+ authority: TransactionSigner<TAccountAuthority>;
36
+ /** Credential the Schema is associated with */
37
+ credential: Address<TAccountCredential>;
38
+ schema: Address<TAccountSchema>;
39
+ /** Mint of Schema Token */
40
+ mint: Address<TAccountMint>;
41
+ /** Program derived address used as program signer authority */
42
+ sasPda: Address<TAccountSasPda>;
43
+ systemProgram?: Address<TAccountSystemProgram>;
44
+ tokenProgram?: Address<TAccountTokenProgram>;
45
+ maxSize: TokenizeSchemaInstructionDataArgs['maxSize'];
46
+ };
47
+ export declare function getTokenizeSchemaInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountSchema extends string, TAccountMint extends string, TAccountSasPda extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: TokenizeSchemaInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSchema, TAccountMint, TAccountSasPda, TAccountSystemProgram, TAccountTokenProgram>, config?: {
48
+ programAddress?: TProgramAddress;
49
+ }): TokenizeSchemaInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSchema, TAccountMint, TAccountSasPda, TAccountSystemProgram, TAccountTokenProgram>;
50
+ export type ParsedTokenizeSchemaInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
51
+ programAddress: Address<TProgram>;
52
+ accounts: {
53
+ payer: TAccountMetas[0];
54
+ authority: TAccountMetas[1];
55
+ /** Credential the Schema is associated with */
56
+ credential: TAccountMetas[2];
57
+ schema: TAccountMetas[3];
58
+ /** Mint of Schema Token */
59
+ mint: TAccountMetas[4];
60
+ /** Program derived address used as program signer authority */
61
+ sasPda: TAccountMetas[5];
62
+ systemProgram: TAccountMetas[6];
63
+ tokenProgram: TAccountMetas[7];
64
+ };
65
+ data: TokenizeSchemaInstructionData;
66
+ };
67
+ export declare function parseTokenizeSchemaInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedTokenizeSchemaInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.TOKENIZE_SCHEMA_DISCRIMINATOR = void 0;
11
+ exports.getTokenizeSchemaDiscriminatorBytes = getTokenizeSchemaDiscriminatorBytes;
12
+ exports.getTokenizeSchemaInstructionDataEncoder = getTokenizeSchemaInstructionDataEncoder;
13
+ exports.getTokenizeSchemaInstructionDataDecoder = getTokenizeSchemaInstructionDataDecoder;
14
+ exports.getTokenizeSchemaInstructionDataCodec = getTokenizeSchemaInstructionDataCodec;
15
+ exports.getTokenizeSchemaInstruction = getTokenizeSchemaInstruction;
16
+ exports.parseTokenizeSchemaInstruction = parseTokenizeSchemaInstruction;
17
+ const kit_1 = require("@trezoa/kit");
18
+ const programs_1 = require("../programs");
19
+ const shared_1 = require("../shared");
20
+ exports.TOKENIZE_SCHEMA_DISCRIMINATOR = 9;
21
+ function getTokenizeSchemaDiscriminatorBytes() {
22
+ return (0, kit_1.getU8Encoder)().encode(exports.TOKENIZE_SCHEMA_DISCRIMINATOR);
23
+ }
24
+ function getTokenizeSchemaInstructionDataEncoder() {
25
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
26
+ ['discriminator', (0, kit_1.getU8Encoder)()],
27
+ ['maxSize', (0, kit_1.getU64Encoder)()],
28
+ ]), (value) => ({ ...value, discriminator: exports.TOKENIZE_SCHEMA_DISCRIMINATOR }));
29
+ }
30
+ function getTokenizeSchemaInstructionDataDecoder() {
31
+ return (0, kit_1.getStructDecoder)([
32
+ ['discriminator', (0, kit_1.getU8Decoder)()],
33
+ ['maxSize', (0, kit_1.getU64Decoder)()],
34
+ ]);
35
+ }
36
+ function getTokenizeSchemaInstructionDataCodec() {
37
+ return (0, kit_1.combineCodec)(getTokenizeSchemaInstructionDataEncoder(), getTokenizeSchemaInstructionDataDecoder());
38
+ }
39
+ function getTokenizeSchemaInstruction(input, config) {
40
+ // Program address.
41
+ const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
42
+ // Original accounts.
43
+ const originalAccounts = {
44
+ payer: { value: input.payer ?? null, isWritable: true },
45
+ authority: { value: input.authority ?? null, isWritable: false },
46
+ credential: { value: input.credential ?? null, isWritable: false },
47
+ schema: { value: input.schema ?? null, isWritable: false },
48
+ mint: { value: input.mint ?? null, isWritable: true },
49
+ sasPda: { value: input.sasPda ?? null, isWritable: false },
50
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
51
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
52
+ };
53
+ const accounts = originalAccounts;
54
+ // Original args.
55
+ const args = { ...input };
56
+ // Resolve default values.
57
+ if (!accounts.systemProgram.value) {
58
+ accounts.systemProgram.value =
59
+ '11111111111111111111111111111111';
60
+ }
61
+ if (!accounts.tokenProgram.value) {
62
+ accounts.tokenProgram.value =
63
+ 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
64
+ }
65
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
66
+ return Object.freeze({
67
+ accounts: [
68
+ getAccountMeta(accounts.payer),
69
+ getAccountMeta(accounts.authority),
70
+ getAccountMeta(accounts.credential),
71
+ getAccountMeta(accounts.schema),
72
+ getAccountMeta(accounts.mint),
73
+ getAccountMeta(accounts.sasPda),
74
+ getAccountMeta(accounts.systemProgram),
75
+ getAccountMeta(accounts.tokenProgram),
76
+ ],
77
+ data: getTokenizeSchemaInstructionDataEncoder().encode(args),
78
+ programAddress,
79
+ });
80
+ }
81
+ function parseTokenizeSchemaInstruction(instruction) {
82
+ if (instruction.accounts.length < 8) {
83
+ // TODO: Coded error.
84
+ throw new Error('Not enough accounts');
85
+ }
86
+ let accountIndex = 0;
87
+ const getNextAccount = () => {
88
+ const accountMeta = instruction.accounts[accountIndex];
89
+ accountIndex += 1;
90
+ return accountMeta;
91
+ };
92
+ return {
93
+ programAddress: instruction.programAddress,
94
+ accounts: {
95
+ payer: getNextAccount(),
96
+ authority: getNextAccount(),
97
+ credential: getNextAccount(),
98
+ schema: getNextAccount(),
99
+ mint: getNextAccount(),
100
+ sasPda: getNextAccount(),
101
+ systemProgram: getNextAccount(),
102
+ tokenProgram: getNextAccount(),
103
+ },
104
+ data: getTokenizeSchemaInstructionDataDecoder().decode(instruction.data),
105
+ };
106
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ export * from './trezoaAttestationService';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("./trezoaAttestationService"), exports);