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.
- package/dist/src/generated/accounts/attestation.d.ts +40 -0
- package/dist/src/generated/accounts/attestation.js +69 -0
- package/dist/src/generated/accounts/credential.d.ts +27 -0
- package/dist/src/generated/accounts/credential.js +61 -0
- package/dist/src/generated/accounts/index.d.ts +10 -0
- package/dist/src/generated/accounts/index.js +26 -0
- package/dist/src/generated/accounts/schema.d.ts +31 -0
- package/dist/src/generated/accounts/schema.js +69 -0
- package/dist/src/generated/index.d.ts +11 -0
- package/dist/src/generated/index.js +27 -0
- package/dist/src/generated/instructions/changeAuthorizedSigners.d.ts +51 -0
- package/dist/src/generated/instructions/changeAuthorizedSigners.js +93 -0
- package/dist/src/generated/instructions/changeSchemaDescription.d.ts +56 -0
- package/dist/src/generated/instructions/changeSchemaDescription.js +96 -0
- package/dist/src/generated/instructions/changeSchemaStatus.d.ts +50 -0
- package/dist/src/generated/instructions/changeSchemaStatus.js +82 -0
- package/dist/src/generated/instructions/changeSchemaVersion.d.ts +60 -0
- package/dist/src/generated/instructions/changeSchemaVersion.js +107 -0
- package/dist/src/generated/instructions/closeAttestation.d.ts +56 -0
- package/dist/src/generated/instructions/closeAttestation.js +102 -0
- package/dist/src/generated/instructions/closeTokenizedAttestation.d.ts +74 -0
- package/dist/src/generated/instructions/closeTokenizedAttestation.js +124 -0
- package/dist/src/generated/instructions/createAttestation.d.ts +67 -0
- package/dist/src/generated/instructions/createAttestation.js +100 -0
- package/dist/src/generated/instructions/createCredential.d.ts +52 -0
- package/dist/src/generated/instructions/createCredential.js +92 -0
- package/dist/src/generated/instructions/createSchema.d.ts +63 -0
- package/dist/src/generated/instructions/createSchema.js +105 -0
- package/dist/src/generated/instructions/createTokenizedAttestation.d.ts +110 -0
- package/dist/src/generated/instructions/createTokenizedAttestation.js +146 -0
- package/dist/src/generated/instructions/emitEvent.d.ts +36 -0
- package/dist/src/generated/instructions/emitEvent.js +69 -0
- package/dist/src/generated/instructions/index.d.ts +19 -0
- package/dist/src/generated/instructions/index.js +35 -0
- package/dist/src/generated/instructions/tokenizeSchema.d.ts +67 -0
- package/dist/src/generated/instructions/tokenizeSchema.js +106 -0
- package/dist/src/generated/programs/index.d.ts +8 -0
- package/dist/src/generated/programs/index.js +24 -0
- package/dist/src/generated/programs/trezoaAttestationService.d.ts +57 -0
- package/dist/src/generated/programs/trezoaAttestationService.js +74 -0
- package/dist/src/generated/shared/index.d.ts +49 -0
- package/dist/src/generated/shared/index.js +94 -0
- package/dist/src/generated/types/closeAttestationEvent.d.ts +17 -0
- package/dist/src/generated/types/closeAttestationEvent.js +36 -0
- package/dist/src/generated/types/index.d.ts +8 -0
- package/dist/src/generated/types/index.js +24 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +19 -0
- package/dist/src/pdas.d.ts +69 -0
- package/dist/src/pdas.js +96 -0
- package/dist/src/utils.d.ts +21 -0
- package/dist/src/utils.js +98 -0
- package/dist/test/pdas.d.ts +1 -0
- package/dist/test/pdas.js +61 -0
- package/dist/test/utils.d.ts +1 -0
- package/dist/test/utils.js +29 -0
- package/package.json +29 -0
|
@@ -0,0 +1,96 @@
|
|
|
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.CHANGE_SCHEMA_DESCRIPTION_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getChangeSchemaDescriptionDiscriminatorBytes = getChangeSchemaDescriptionDiscriminatorBytes;
|
|
12
|
+
exports.getChangeSchemaDescriptionInstructionDataEncoder = getChangeSchemaDescriptionInstructionDataEncoder;
|
|
13
|
+
exports.getChangeSchemaDescriptionInstructionDataDecoder = getChangeSchemaDescriptionInstructionDataDecoder;
|
|
14
|
+
exports.getChangeSchemaDescriptionInstructionDataCodec = getChangeSchemaDescriptionInstructionDataCodec;
|
|
15
|
+
exports.getChangeSchemaDescriptionInstruction = getChangeSchemaDescriptionInstruction;
|
|
16
|
+
exports.parseChangeSchemaDescriptionInstruction = parseChangeSchemaDescriptionInstruction;
|
|
17
|
+
const kit_1 = require("@trezoa/kit");
|
|
18
|
+
const programs_1 = require("../programs");
|
|
19
|
+
const shared_1 = require("../shared");
|
|
20
|
+
exports.CHANGE_SCHEMA_DESCRIPTION_DISCRIMINATOR = 4;
|
|
21
|
+
function getChangeSchemaDescriptionDiscriminatorBytes() {
|
|
22
|
+
return (0, kit_1.getU8Encoder)().encode(exports.CHANGE_SCHEMA_DESCRIPTION_DISCRIMINATOR);
|
|
23
|
+
}
|
|
24
|
+
function getChangeSchemaDescriptionInstructionDataEncoder() {
|
|
25
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
26
|
+
['discriminator', (0, kit_1.getU8Encoder)()],
|
|
27
|
+
['description', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getUtf8Encoder)(), (0, kit_1.getU32Encoder)())],
|
|
28
|
+
]), (value) => ({
|
|
29
|
+
...value,
|
|
30
|
+
discriminator: exports.CHANGE_SCHEMA_DESCRIPTION_DISCRIMINATOR,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
function getChangeSchemaDescriptionInstructionDataDecoder() {
|
|
34
|
+
return (0, kit_1.getStructDecoder)([
|
|
35
|
+
['discriminator', (0, kit_1.getU8Decoder)()],
|
|
36
|
+
['description', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getUtf8Decoder)(), (0, kit_1.getU32Decoder)())],
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
function getChangeSchemaDescriptionInstructionDataCodec() {
|
|
40
|
+
return (0, kit_1.combineCodec)(getChangeSchemaDescriptionInstructionDataEncoder(), getChangeSchemaDescriptionInstructionDataDecoder());
|
|
41
|
+
}
|
|
42
|
+
function getChangeSchemaDescriptionInstruction(input, config) {
|
|
43
|
+
// Program address.
|
|
44
|
+
const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
|
|
45
|
+
// Original accounts.
|
|
46
|
+
const originalAccounts = {
|
|
47
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
48
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
49
|
+
credential: { value: input.credential ?? null, isWritable: false },
|
|
50
|
+
schema: { value: input.schema ?? null, isWritable: true },
|
|
51
|
+
systemProgram: { value: input.systemProgram ?? 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
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
62
|
+
return Object.freeze({
|
|
63
|
+
accounts: [
|
|
64
|
+
getAccountMeta(accounts.payer),
|
|
65
|
+
getAccountMeta(accounts.authority),
|
|
66
|
+
getAccountMeta(accounts.credential),
|
|
67
|
+
getAccountMeta(accounts.schema),
|
|
68
|
+
getAccountMeta(accounts.systemProgram),
|
|
69
|
+
],
|
|
70
|
+
data: getChangeSchemaDescriptionInstructionDataEncoder().encode(args),
|
|
71
|
+
programAddress,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function parseChangeSchemaDescriptionInstruction(instruction) {
|
|
75
|
+
if (instruction.accounts.length < 5) {
|
|
76
|
+
// TODO: Coded error.
|
|
77
|
+
throw new Error('Not enough accounts');
|
|
78
|
+
}
|
|
79
|
+
let accountIndex = 0;
|
|
80
|
+
const getNextAccount = () => {
|
|
81
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
82
|
+
accountIndex += 1;
|
|
83
|
+
return accountMeta;
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
programAddress: instruction.programAddress,
|
|
87
|
+
accounts: {
|
|
88
|
+
payer: getNextAccount(),
|
|
89
|
+
authority: getNextAccount(),
|
|
90
|
+
credential: getNextAccount(),
|
|
91
|
+
schema: getNextAccount(),
|
|
92
|
+
systemProgram: getNextAccount(),
|
|
93
|
+
},
|
|
94
|
+
data: getChangeSchemaDescriptionInstructionDataDecoder().decode(instruction.data),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 } from '@trezoa/kit';
|
|
9
|
+
import { TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const CHANGE_SCHEMA_STATUS_DISCRIMINATOR = 2;
|
|
11
|
+
export declare function getChangeSchemaStatusDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type ChangeSchemaStatusInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountAuthority extends string | AccountMeta<string> = string, TAccountCredential extends string | AccountMeta<string> = string, TAccountSchema extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & AccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
14
|
+
TAccountCredential extends string ? ReadonlyAccount<TAccountCredential> : TAccountCredential,
|
|
15
|
+
TAccountSchema extends string ? WritableAccount<TAccountSchema> : TAccountSchema,
|
|
16
|
+
...TRemainingAccounts
|
|
17
|
+
]>;
|
|
18
|
+
export type ChangeSchemaStatusInstructionData = {
|
|
19
|
+
discriminator: number;
|
|
20
|
+
isPaused: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type ChangeSchemaStatusInstructionDataArgs = {
|
|
23
|
+
isPaused: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare function getChangeSchemaStatusInstructionDataEncoder(): FixedSizeEncoder<ChangeSchemaStatusInstructionDataArgs>;
|
|
26
|
+
export declare function getChangeSchemaStatusInstructionDataDecoder(): FixedSizeDecoder<ChangeSchemaStatusInstructionData>;
|
|
27
|
+
export declare function getChangeSchemaStatusInstructionDataCodec(): FixedSizeCodec<ChangeSchemaStatusInstructionDataArgs, ChangeSchemaStatusInstructionData>;
|
|
28
|
+
export type ChangeSchemaStatusInput<TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountSchema extends string = string> = {
|
|
29
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
30
|
+
/** Credential the Schema is associated with */
|
|
31
|
+
credential: Address<TAccountCredential>;
|
|
32
|
+
/** Credential the Schema is associated with */
|
|
33
|
+
schema: Address<TAccountSchema>;
|
|
34
|
+
isPaused: ChangeSchemaStatusInstructionDataArgs['isPaused'];
|
|
35
|
+
};
|
|
36
|
+
export declare function getChangeSchemaStatusInstruction<TAccountAuthority extends string, TAccountCredential extends string, TAccountSchema extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: ChangeSchemaStatusInput<TAccountAuthority, TAccountCredential, TAccountSchema>, config?: {
|
|
37
|
+
programAddress?: TProgramAddress;
|
|
38
|
+
}): ChangeSchemaStatusInstruction<TProgramAddress, TAccountAuthority, TAccountCredential, TAccountSchema>;
|
|
39
|
+
export type ParsedChangeSchemaStatusInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
40
|
+
programAddress: Address<TProgram>;
|
|
41
|
+
accounts: {
|
|
42
|
+
authority: TAccountMetas[0];
|
|
43
|
+
/** Credential the Schema is associated with */
|
|
44
|
+
credential: TAccountMetas[1];
|
|
45
|
+
/** Credential the Schema is associated with */
|
|
46
|
+
schema: TAccountMetas[2];
|
|
47
|
+
};
|
|
48
|
+
data: ChangeSchemaStatusInstructionData;
|
|
49
|
+
};
|
|
50
|
+
export declare function parseChangeSchemaStatusInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedChangeSchemaStatusInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,82 @@
|
|
|
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.CHANGE_SCHEMA_STATUS_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getChangeSchemaStatusDiscriminatorBytes = getChangeSchemaStatusDiscriminatorBytes;
|
|
12
|
+
exports.getChangeSchemaStatusInstructionDataEncoder = getChangeSchemaStatusInstructionDataEncoder;
|
|
13
|
+
exports.getChangeSchemaStatusInstructionDataDecoder = getChangeSchemaStatusInstructionDataDecoder;
|
|
14
|
+
exports.getChangeSchemaStatusInstructionDataCodec = getChangeSchemaStatusInstructionDataCodec;
|
|
15
|
+
exports.getChangeSchemaStatusInstruction = getChangeSchemaStatusInstruction;
|
|
16
|
+
exports.parseChangeSchemaStatusInstruction = parseChangeSchemaStatusInstruction;
|
|
17
|
+
const kit_1 = require("@trezoa/kit");
|
|
18
|
+
const programs_1 = require("../programs");
|
|
19
|
+
const shared_1 = require("../shared");
|
|
20
|
+
exports.CHANGE_SCHEMA_STATUS_DISCRIMINATOR = 2;
|
|
21
|
+
function getChangeSchemaStatusDiscriminatorBytes() {
|
|
22
|
+
return (0, kit_1.getU8Encoder)().encode(exports.CHANGE_SCHEMA_STATUS_DISCRIMINATOR);
|
|
23
|
+
}
|
|
24
|
+
function getChangeSchemaStatusInstructionDataEncoder() {
|
|
25
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
26
|
+
['discriminator', (0, kit_1.getU8Encoder)()],
|
|
27
|
+
['isPaused', (0, kit_1.getBooleanEncoder)()],
|
|
28
|
+
]), (value) => ({ ...value, discriminator: exports.CHANGE_SCHEMA_STATUS_DISCRIMINATOR }));
|
|
29
|
+
}
|
|
30
|
+
function getChangeSchemaStatusInstructionDataDecoder() {
|
|
31
|
+
return (0, kit_1.getStructDecoder)([
|
|
32
|
+
['discriminator', (0, kit_1.getU8Decoder)()],
|
|
33
|
+
['isPaused', (0, kit_1.getBooleanDecoder)()],
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
function getChangeSchemaStatusInstructionDataCodec() {
|
|
37
|
+
return (0, kit_1.combineCodec)(getChangeSchemaStatusInstructionDataEncoder(), getChangeSchemaStatusInstructionDataDecoder());
|
|
38
|
+
}
|
|
39
|
+
function getChangeSchemaStatusInstruction(input, config) {
|
|
40
|
+
// Program address.
|
|
41
|
+
const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
|
|
42
|
+
// Original accounts.
|
|
43
|
+
const originalAccounts = {
|
|
44
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
45
|
+
credential: { value: input.credential ?? null, isWritable: false },
|
|
46
|
+
schema: { value: input.schema ?? null, isWritable: true },
|
|
47
|
+
};
|
|
48
|
+
const accounts = originalAccounts;
|
|
49
|
+
// Original args.
|
|
50
|
+
const args = { ...input };
|
|
51
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
accounts: [
|
|
54
|
+
getAccountMeta(accounts.authority),
|
|
55
|
+
getAccountMeta(accounts.credential),
|
|
56
|
+
getAccountMeta(accounts.schema),
|
|
57
|
+
],
|
|
58
|
+
data: getChangeSchemaStatusInstructionDataEncoder().encode(args),
|
|
59
|
+
programAddress,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function parseChangeSchemaStatusInstruction(instruction) {
|
|
63
|
+
if (instruction.accounts.length < 3) {
|
|
64
|
+
// TODO: Coded error.
|
|
65
|
+
throw new Error('Not enough accounts');
|
|
66
|
+
}
|
|
67
|
+
let accountIndex = 0;
|
|
68
|
+
const getNextAccount = () => {
|
|
69
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
70
|
+
accountIndex += 1;
|
|
71
|
+
return accountMeta;
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
programAddress: instruction.programAddress,
|
|
75
|
+
accounts: {
|
|
76
|
+
authority: getNextAccount(),
|
|
77
|
+
credential: getNextAccount(),
|
|
78
|
+
schema: getNextAccount(),
|
|
79
|
+
},
|
|
80
|
+
data: getChangeSchemaStatusInstructionDataDecoder().decode(instruction.data),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 CHANGE_SCHEMA_VERSION_DISCRIMINATOR = 5;
|
|
11
|
+
export declare function getChangeSchemaVersionDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type ChangeSchemaVersionInstruction<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, TAccountExistingSchema extends string | AccountMeta<string> = string, TAccountNewSchema extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', 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
|
+
TAccountExistingSchema extends string ? ReadonlyAccount<TAccountExistingSchema> : TAccountExistingSchema,
|
|
17
|
+
TAccountNewSchema extends string ? WritableAccount<TAccountNewSchema> : TAccountNewSchema,
|
|
18
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
19
|
+
...TRemainingAccounts
|
|
20
|
+
]>;
|
|
21
|
+
export type ChangeSchemaVersionInstructionData = {
|
|
22
|
+
discriminator: number;
|
|
23
|
+
layout: ReadonlyUint8Array;
|
|
24
|
+
fieldNames: Array<string>;
|
|
25
|
+
};
|
|
26
|
+
export type ChangeSchemaVersionInstructionDataArgs = {
|
|
27
|
+
layout: ReadonlyUint8Array;
|
|
28
|
+
fieldNames: Array<string>;
|
|
29
|
+
};
|
|
30
|
+
export declare function getChangeSchemaVersionInstructionDataEncoder(): Encoder<ChangeSchemaVersionInstructionDataArgs>;
|
|
31
|
+
export declare function getChangeSchemaVersionInstructionDataDecoder(): Decoder<ChangeSchemaVersionInstructionData>;
|
|
32
|
+
export declare function getChangeSchemaVersionInstructionDataCodec(): Codec<ChangeSchemaVersionInstructionDataArgs, ChangeSchemaVersionInstructionData>;
|
|
33
|
+
export type ChangeSchemaVersionInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountExistingSchema extends string = string, TAccountNewSchema extends string = string, TAccountSystemProgram extends string = string> = {
|
|
34
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
35
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
36
|
+
/** Credential the Schema is associated with */
|
|
37
|
+
credential: Address<TAccountCredential>;
|
|
38
|
+
existingSchema: Address<TAccountExistingSchema>;
|
|
39
|
+
newSchema: Address<TAccountNewSchema>;
|
|
40
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
41
|
+
layout: ChangeSchemaVersionInstructionDataArgs['layout'];
|
|
42
|
+
fieldNames: ChangeSchemaVersionInstructionDataArgs['fieldNames'];
|
|
43
|
+
};
|
|
44
|
+
export declare function getChangeSchemaVersionInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountExistingSchema extends string, TAccountNewSchema extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: ChangeSchemaVersionInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountExistingSchema, TAccountNewSchema, TAccountSystemProgram>, config?: {
|
|
45
|
+
programAddress?: TProgramAddress;
|
|
46
|
+
}): ChangeSchemaVersionInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountExistingSchema, TAccountNewSchema, TAccountSystemProgram>;
|
|
47
|
+
export type ParsedChangeSchemaVersionInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
48
|
+
programAddress: Address<TProgram>;
|
|
49
|
+
accounts: {
|
|
50
|
+
payer: TAccountMetas[0];
|
|
51
|
+
authority: TAccountMetas[1];
|
|
52
|
+
/** Credential the Schema is associated with */
|
|
53
|
+
credential: TAccountMetas[2];
|
|
54
|
+
existingSchema: TAccountMetas[3];
|
|
55
|
+
newSchema: TAccountMetas[4];
|
|
56
|
+
systemProgram: TAccountMetas[5];
|
|
57
|
+
};
|
|
58
|
+
data: ChangeSchemaVersionInstructionData;
|
|
59
|
+
};
|
|
60
|
+
export declare function parseChangeSchemaVersionInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedChangeSchemaVersionInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,107 @@
|
|
|
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.CHANGE_SCHEMA_VERSION_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getChangeSchemaVersionDiscriminatorBytes = getChangeSchemaVersionDiscriminatorBytes;
|
|
12
|
+
exports.getChangeSchemaVersionInstructionDataEncoder = getChangeSchemaVersionInstructionDataEncoder;
|
|
13
|
+
exports.getChangeSchemaVersionInstructionDataDecoder = getChangeSchemaVersionInstructionDataDecoder;
|
|
14
|
+
exports.getChangeSchemaVersionInstructionDataCodec = getChangeSchemaVersionInstructionDataCodec;
|
|
15
|
+
exports.getChangeSchemaVersionInstruction = getChangeSchemaVersionInstruction;
|
|
16
|
+
exports.parseChangeSchemaVersionInstruction = parseChangeSchemaVersionInstruction;
|
|
17
|
+
const kit_1 = require("@trezoa/kit");
|
|
18
|
+
const programs_1 = require("../programs");
|
|
19
|
+
const shared_1 = require("../shared");
|
|
20
|
+
exports.CHANGE_SCHEMA_VERSION_DISCRIMINATOR = 5;
|
|
21
|
+
function getChangeSchemaVersionDiscriminatorBytes() {
|
|
22
|
+
return (0, kit_1.getU8Encoder)().encode(exports.CHANGE_SCHEMA_VERSION_DISCRIMINATOR);
|
|
23
|
+
}
|
|
24
|
+
function getChangeSchemaVersionInstructionDataEncoder() {
|
|
25
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
26
|
+
['discriminator', (0, kit_1.getU8Encoder)()],
|
|
27
|
+
['layout', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
|
|
28
|
+
[
|
|
29
|
+
'fieldNames',
|
|
30
|
+
(0, kit_1.getArrayEncoder)((0, kit_1.addEncoderSizePrefix)((0, kit_1.getUtf8Encoder)(), (0, kit_1.getU32Encoder)())),
|
|
31
|
+
],
|
|
32
|
+
]), (value) => ({
|
|
33
|
+
...value,
|
|
34
|
+
discriminator: exports.CHANGE_SCHEMA_VERSION_DISCRIMINATOR,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function getChangeSchemaVersionInstructionDataDecoder() {
|
|
38
|
+
return (0, kit_1.getStructDecoder)([
|
|
39
|
+
['discriminator', (0, kit_1.getU8Decoder)()],
|
|
40
|
+
['layout', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
|
|
41
|
+
[
|
|
42
|
+
'fieldNames',
|
|
43
|
+
(0, kit_1.getArrayDecoder)((0, kit_1.addDecoderSizePrefix)((0, kit_1.getUtf8Decoder)(), (0, kit_1.getU32Decoder)())),
|
|
44
|
+
],
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
function getChangeSchemaVersionInstructionDataCodec() {
|
|
48
|
+
return (0, kit_1.combineCodec)(getChangeSchemaVersionInstructionDataEncoder(), getChangeSchemaVersionInstructionDataDecoder());
|
|
49
|
+
}
|
|
50
|
+
function getChangeSchemaVersionInstruction(input, config) {
|
|
51
|
+
// Program address.
|
|
52
|
+
const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
|
|
53
|
+
// Original accounts.
|
|
54
|
+
const originalAccounts = {
|
|
55
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
56
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
57
|
+
credential: { value: input.credential ?? null, isWritable: false },
|
|
58
|
+
existingSchema: { value: input.existingSchema ?? null, isWritable: false },
|
|
59
|
+
newSchema: { value: input.newSchema ?? null, isWritable: true },
|
|
60
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
61
|
+
};
|
|
62
|
+
const accounts = originalAccounts;
|
|
63
|
+
// Original args.
|
|
64
|
+
const args = { ...input };
|
|
65
|
+
// Resolve default values.
|
|
66
|
+
if (!accounts.systemProgram.value) {
|
|
67
|
+
accounts.systemProgram.value =
|
|
68
|
+
'11111111111111111111111111111111';
|
|
69
|
+
}
|
|
70
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
71
|
+
return Object.freeze({
|
|
72
|
+
accounts: [
|
|
73
|
+
getAccountMeta(accounts.payer),
|
|
74
|
+
getAccountMeta(accounts.authority),
|
|
75
|
+
getAccountMeta(accounts.credential),
|
|
76
|
+
getAccountMeta(accounts.existingSchema),
|
|
77
|
+
getAccountMeta(accounts.newSchema),
|
|
78
|
+
getAccountMeta(accounts.systemProgram),
|
|
79
|
+
],
|
|
80
|
+
data: getChangeSchemaVersionInstructionDataEncoder().encode(args),
|
|
81
|
+
programAddress,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function parseChangeSchemaVersionInstruction(instruction) {
|
|
85
|
+
if (instruction.accounts.length < 6) {
|
|
86
|
+
// TODO: Coded error.
|
|
87
|
+
throw new Error('Not enough accounts');
|
|
88
|
+
}
|
|
89
|
+
let accountIndex = 0;
|
|
90
|
+
const getNextAccount = () => {
|
|
91
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
92
|
+
accountIndex += 1;
|
|
93
|
+
return accountMeta;
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
programAddress: instruction.programAddress,
|
|
97
|
+
accounts: {
|
|
98
|
+
payer: getNextAccount(),
|
|
99
|
+
authority: getNextAccount(),
|
|
100
|
+
credential: getNextAccount(),
|
|
101
|
+
existingSchema: getNextAccount(),
|
|
102
|
+
newSchema: getNextAccount(),
|
|
103
|
+
systemProgram: getNextAccount(),
|
|
104
|
+
},
|
|
105
|
+
data: getChangeSchemaVersionInstructionDataDecoder().decode(instruction.data),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 CLOSE_ATTESTATION_DISCRIMINATOR = 7;
|
|
11
|
+
export declare function getCloseAttestationDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type CloseAttestationInstruction<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, TAccountAttestation extends string | AccountMeta<string> = string, TAccountEventAuthority extends string | AccountMeta<string> = '9qmfijJ9MX4XVGdgWB64UuGUb19guVXrpn1HxweCybVb', TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', TAccountAttestationProgram extends string | AccountMeta<string> = '8AVGA5ygh9XXLYLdnZRc2M5oEPyRLx7zdfjR57XHuFBL', 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
|
+
TAccountAttestation extends string ? WritableAccount<TAccountAttestation> : TAccountAttestation,
|
|
17
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
18
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
19
|
+
TAccountAttestationProgram extends string ? ReadonlyAccount<TAccountAttestationProgram> : TAccountAttestationProgram,
|
|
20
|
+
...TRemainingAccounts
|
|
21
|
+
]>;
|
|
22
|
+
export type CloseAttestationInstructionData = {
|
|
23
|
+
discriminator: number;
|
|
24
|
+
};
|
|
25
|
+
export type CloseAttestationInstructionDataArgs = {};
|
|
26
|
+
export declare function getCloseAttestationInstructionDataEncoder(): FixedSizeEncoder<CloseAttestationInstructionDataArgs>;
|
|
27
|
+
export declare function getCloseAttestationInstructionDataDecoder(): FixedSizeDecoder<CloseAttestationInstructionData>;
|
|
28
|
+
export declare function getCloseAttestationInstructionDataCodec(): FixedSizeCodec<CloseAttestationInstructionDataArgs, CloseAttestationInstructionData>;
|
|
29
|
+
export type CloseAttestationInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountAttestation extends string = string, TAccountEventAuthority extends string = string, TAccountSystemProgram extends string = string, TAccountAttestationProgram extends string = string> = {
|
|
30
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
31
|
+
/** Authorized signer of the Schema's Credential */
|
|
32
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
33
|
+
credential: Address<TAccountCredential>;
|
|
34
|
+
attestation: Address<TAccountAttestation>;
|
|
35
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
36
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
37
|
+
attestationProgram?: Address<TAccountAttestationProgram>;
|
|
38
|
+
};
|
|
39
|
+
export declare function getCloseAttestationInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountAttestation extends string, TAccountEventAuthority extends string, TAccountSystemProgram extends string, TAccountAttestationProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: CloseAttestationInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountAttestation, TAccountEventAuthority, TAccountSystemProgram, TAccountAttestationProgram>, config?: {
|
|
40
|
+
programAddress?: TProgramAddress;
|
|
41
|
+
}): CloseAttestationInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountAttestation, TAccountEventAuthority, TAccountSystemProgram, TAccountAttestationProgram>;
|
|
42
|
+
export type ParsedCloseAttestationInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
43
|
+
programAddress: Address<TProgram>;
|
|
44
|
+
accounts: {
|
|
45
|
+
payer: TAccountMetas[0];
|
|
46
|
+
/** Authorized signer of the Schema's Credential */
|
|
47
|
+
authority: TAccountMetas[1];
|
|
48
|
+
credential: TAccountMetas[2];
|
|
49
|
+
attestation: TAccountMetas[3];
|
|
50
|
+
eventAuthority: TAccountMetas[4];
|
|
51
|
+
systemProgram: TAccountMetas[5];
|
|
52
|
+
attestationProgram: TAccountMetas[6];
|
|
53
|
+
};
|
|
54
|
+
data: CloseAttestationInstructionData;
|
|
55
|
+
};
|
|
56
|
+
export declare function parseCloseAttestationInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCloseAttestationInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,102 @@
|
|
|
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.CLOSE_ATTESTATION_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getCloseAttestationDiscriminatorBytes = getCloseAttestationDiscriminatorBytes;
|
|
12
|
+
exports.getCloseAttestationInstructionDataEncoder = getCloseAttestationInstructionDataEncoder;
|
|
13
|
+
exports.getCloseAttestationInstructionDataDecoder = getCloseAttestationInstructionDataDecoder;
|
|
14
|
+
exports.getCloseAttestationInstructionDataCodec = getCloseAttestationInstructionDataCodec;
|
|
15
|
+
exports.getCloseAttestationInstruction = getCloseAttestationInstruction;
|
|
16
|
+
exports.parseCloseAttestationInstruction = parseCloseAttestationInstruction;
|
|
17
|
+
const kit_1 = require("@trezoa/kit");
|
|
18
|
+
const programs_1 = require("../programs");
|
|
19
|
+
const shared_1 = require("../shared");
|
|
20
|
+
exports.CLOSE_ATTESTATION_DISCRIMINATOR = 7;
|
|
21
|
+
function getCloseAttestationDiscriminatorBytes() {
|
|
22
|
+
return (0, kit_1.getU8Encoder)().encode(exports.CLOSE_ATTESTATION_DISCRIMINATOR);
|
|
23
|
+
}
|
|
24
|
+
function getCloseAttestationInstructionDataEncoder() {
|
|
25
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.getU8Encoder)()]]), (value) => ({ ...value, discriminator: exports.CLOSE_ATTESTATION_DISCRIMINATOR }));
|
|
26
|
+
}
|
|
27
|
+
function getCloseAttestationInstructionDataDecoder() {
|
|
28
|
+
return (0, kit_1.getStructDecoder)([['discriminator', (0, kit_1.getU8Decoder)()]]);
|
|
29
|
+
}
|
|
30
|
+
function getCloseAttestationInstructionDataCodec() {
|
|
31
|
+
return (0, kit_1.combineCodec)(getCloseAttestationInstructionDataEncoder(), getCloseAttestationInstructionDataDecoder());
|
|
32
|
+
}
|
|
33
|
+
function getCloseAttestationInstruction(input, config) {
|
|
34
|
+
// Program address.
|
|
35
|
+
const programAddress = config?.programAddress ?? programs_1.TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS;
|
|
36
|
+
// Original accounts.
|
|
37
|
+
const originalAccounts = {
|
|
38
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
39
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
40
|
+
credential: { value: input.credential ?? null, isWritable: false },
|
|
41
|
+
attestation: { value: input.attestation ?? null, isWritable: true },
|
|
42
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
43
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
44
|
+
attestationProgram: {
|
|
45
|
+
value: input.attestationProgram ?? null,
|
|
46
|
+
isWritable: false,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const accounts = originalAccounts;
|
|
50
|
+
// Resolve default values.
|
|
51
|
+
if (!accounts.eventAuthority.value) {
|
|
52
|
+
accounts.eventAuthority.value =
|
|
53
|
+
'9qmfijJ9MX4XVGdgWB64UuGUb19guVXrpn1HxweCybVb';
|
|
54
|
+
}
|
|
55
|
+
if (!accounts.systemProgram.value) {
|
|
56
|
+
accounts.systemProgram.value =
|
|
57
|
+
'11111111111111111111111111111111';
|
|
58
|
+
}
|
|
59
|
+
if (!accounts.attestationProgram.value) {
|
|
60
|
+
accounts.attestationProgram.value =
|
|
61
|
+
'8AVGA5ygh9XXLYLdnZRc2M5oEPyRLx7zdfjR57XHuFBL';
|
|
62
|
+
}
|
|
63
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
accounts: [
|
|
66
|
+
getAccountMeta(accounts.payer),
|
|
67
|
+
getAccountMeta(accounts.authority),
|
|
68
|
+
getAccountMeta(accounts.credential),
|
|
69
|
+
getAccountMeta(accounts.attestation),
|
|
70
|
+
getAccountMeta(accounts.eventAuthority),
|
|
71
|
+
getAccountMeta(accounts.systemProgram),
|
|
72
|
+
getAccountMeta(accounts.attestationProgram),
|
|
73
|
+
],
|
|
74
|
+
data: getCloseAttestationInstructionDataEncoder().encode({}),
|
|
75
|
+
programAddress,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function parseCloseAttestationInstruction(instruction) {
|
|
79
|
+
if (instruction.accounts.length < 7) {
|
|
80
|
+
// TODO: Coded error.
|
|
81
|
+
throw new Error('Not enough accounts');
|
|
82
|
+
}
|
|
83
|
+
let accountIndex = 0;
|
|
84
|
+
const getNextAccount = () => {
|
|
85
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
86
|
+
accountIndex += 1;
|
|
87
|
+
return accountMeta;
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
programAddress: instruction.programAddress,
|
|
91
|
+
accounts: {
|
|
92
|
+
payer: getNextAccount(),
|
|
93
|
+
authority: getNextAccount(),
|
|
94
|
+
credential: getNextAccount(),
|
|
95
|
+
attestation: getNextAccount(),
|
|
96
|
+
eventAuthority: getNextAccount(),
|
|
97
|
+
systemProgram: getNextAccount(),
|
|
98
|
+
attestationProgram: getNextAccount(),
|
|
99
|
+
},
|
|
100
|
+
data: getCloseAttestationInstructionDataDecoder().decode(instruction.data),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 CLOSE_TOKENIZED_ATTESTATION_DISCRIMINATOR = 11;
|
|
11
|
+
export declare function getCloseTokenizedAttestationDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type CloseTokenizedAttestationInstruction<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, TAccountAttestation extends string | AccountMeta<string> = string, TAccountEventAuthority extends string | AccountMeta<string> = '9qmfijJ9MX4XVGdgWB64UuGUb19guVXrpn1HxweCybVb', TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', TAccountAttestationProgram extends string | AccountMeta<string> = '8AVGA5ygh9XXLYLdnZRc2M5oEPyRLx7zdfjR57XHuFBL', TAccountAttestationMint extends string | AccountMeta<string> = string, TAccountSasPda extends string | AccountMeta<string> = string, TAccountAttestationTokenAccount extends string | AccountMeta<string> = string, 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
|
+
TAccountAttestation extends string ? WritableAccount<TAccountAttestation> : TAccountAttestation,
|
|
17
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
18
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
19
|
+
TAccountAttestationProgram extends string ? ReadonlyAccount<TAccountAttestationProgram> : TAccountAttestationProgram,
|
|
20
|
+
TAccountAttestationMint extends string ? WritableAccount<TAccountAttestationMint> : TAccountAttestationMint,
|
|
21
|
+
TAccountSasPda extends string ? ReadonlyAccount<TAccountSasPda> : TAccountSasPda,
|
|
22
|
+
TAccountAttestationTokenAccount extends string ? WritableAccount<TAccountAttestationTokenAccount> : TAccountAttestationTokenAccount,
|
|
23
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
24
|
+
...TRemainingAccounts
|
|
25
|
+
]>;
|
|
26
|
+
export type CloseTokenizedAttestationInstructionData = {
|
|
27
|
+
discriminator: number;
|
|
28
|
+
};
|
|
29
|
+
export type CloseTokenizedAttestationInstructionDataArgs = {};
|
|
30
|
+
export declare function getCloseTokenizedAttestationInstructionDataEncoder(): FixedSizeEncoder<CloseTokenizedAttestationInstructionDataArgs>;
|
|
31
|
+
export declare function getCloseTokenizedAttestationInstructionDataDecoder(): FixedSizeDecoder<CloseTokenizedAttestationInstructionData>;
|
|
32
|
+
export declare function getCloseTokenizedAttestationInstructionDataCodec(): FixedSizeCodec<CloseTokenizedAttestationInstructionDataArgs, CloseTokenizedAttestationInstructionData>;
|
|
33
|
+
export type CloseTokenizedAttestationInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountAttestation extends string = string, TAccountEventAuthority extends string = string, TAccountSystemProgram extends string = string, TAccountAttestationProgram extends string = string, TAccountAttestationMint extends string = string, TAccountSasPda extends string = string, TAccountAttestationTokenAccount extends string = string, TAccountTokenProgram extends string = string> = {
|
|
34
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
35
|
+
/** Authorized signer of the Schema's Credential */
|
|
36
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
37
|
+
credential: Address<TAccountCredential>;
|
|
38
|
+
attestation: Address<TAccountAttestation>;
|
|
39
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
40
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
41
|
+
attestationProgram?: Address<TAccountAttestationProgram>;
|
|
42
|
+
/** Mint of Attestation Token */
|
|
43
|
+
attestationMint: Address<TAccountAttestationMint>;
|
|
44
|
+
/** Program derived address used as program signer authority */
|
|
45
|
+
sasPda: Address<TAccountSasPda>;
|
|
46
|
+
/** Associated token account of the related Attestation Token */
|
|
47
|
+
attestationTokenAccount: Address<TAccountAttestationTokenAccount>;
|
|
48
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
49
|
+
};
|
|
50
|
+
export declare function getCloseTokenizedAttestationInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountAttestation extends string, TAccountEventAuthority extends string, TAccountSystemProgram extends string, TAccountAttestationProgram extends string, TAccountAttestationMint extends string, TAccountSasPda extends string, TAccountAttestationTokenAccount extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: CloseTokenizedAttestationInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountAttestation, TAccountEventAuthority, TAccountSystemProgram, TAccountAttestationProgram, TAccountAttestationMint, TAccountSasPda, TAccountAttestationTokenAccount, TAccountTokenProgram>, config?: {
|
|
51
|
+
programAddress?: TProgramAddress;
|
|
52
|
+
}): CloseTokenizedAttestationInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountAttestation, TAccountEventAuthority, TAccountSystemProgram, TAccountAttestationProgram, TAccountAttestationMint, TAccountSasPda, TAccountAttestationTokenAccount, TAccountTokenProgram>;
|
|
53
|
+
export type ParsedCloseTokenizedAttestationInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
54
|
+
programAddress: Address<TProgram>;
|
|
55
|
+
accounts: {
|
|
56
|
+
payer: TAccountMetas[0];
|
|
57
|
+
/** Authorized signer of the Schema's Credential */
|
|
58
|
+
authority: TAccountMetas[1];
|
|
59
|
+
credential: TAccountMetas[2];
|
|
60
|
+
attestation: TAccountMetas[3];
|
|
61
|
+
eventAuthority: TAccountMetas[4];
|
|
62
|
+
systemProgram: TAccountMetas[5];
|
|
63
|
+
attestationProgram: TAccountMetas[6];
|
|
64
|
+
/** Mint of Attestation Token */
|
|
65
|
+
attestationMint: TAccountMetas[7];
|
|
66
|
+
/** Program derived address used as program signer authority */
|
|
67
|
+
sasPda: TAccountMetas[8];
|
|
68
|
+
/** Associated token account of the related Attestation Token */
|
|
69
|
+
attestationTokenAccount: TAccountMetas[9];
|
|
70
|
+
tokenProgram: TAccountMetas[10];
|
|
71
|
+
};
|
|
72
|
+
data: CloseTokenizedAttestationInstructionData;
|
|
73
|
+
};
|
|
74
|
+
export declare function parseCloseTokenizedAttestationInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCloseTokenizedAttestationInstruction<TProgram, TAccountMetas>;
|