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,40 @@
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 { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@trezoa/kit';
9
+ export type Attestation = {
10
+ discriminator: number;
11
+ nonce: Address;
12
+ credential: Address;
13
+ schema: Address;
14
+ data: ReadonlyUint8Array;
15
+ signer: Address;
16
+ expiry: bigint;
17
+ tokenAccount: Address;
18
+ };
19
+ export type AttestationArgs = {
20
+ discriminator: number;
21
+ nonce: Address;
22
+ credential: Address;
23
+ schema: Address;
24
+ data: ReadonlyUint8Array;
25
+ signer: Address;
26
+ expiry: number | bigint;
27
+ tokenAccount: Address;
28
+ };
29
+ /** Gets the encoder for {@link AttestationArgs} account data. */
30
+ export declare function getAttestationEncoder(): Encoder<AttestationArgs>;
31
+ /** Gets the decoder for {@link Attestation} account data. */
32
+ export declare function getAttestationDecoder(): Decoder<Attestation>;
33
+ /** Gets the codec for {@link Attestation} account data. */
34
+ export declare function getAttestationCodec(): Codec<AttestationArgs, Attestation>;
35
+ export declare function decodeAttestation<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Attestation, TAddress>;
36
+ export declare function decodeAttestation<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Attestation, TAddress>;
37
+ export declare function fetchAttestation<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Attestation, TAddress>>;
38
+ export declare function fetchMaybeAttestation<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Attestation, TAddress>>;
39
+ export declare function fetchAllAttestation(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Attestation>[]>;
40
+ export declare function fetchAllMaybeAttestation(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Attestation>[]>;
@@ -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.getAttestationEncoder = getAttestationEncoder;
11
+ exports.getAttestationDecoder = getAttestationDecoder;
12
+ exports.getAttestationCodec = getAttestationCodec;
13
+ exports.decodeAttestation = decodeAttestation;
14
+ exports.fetchAttestation = fetchAttestation;
15
+ exports.fetchMaybeAttestation = fetchMaybeAttestation;
16
+ exports.fetchAllAttestation = fetchAllAttestation;
17
+ exports.fetchAllMaybeAttestation = fetchAllMaybeAttestation;
18
+ const kit_1 = require("@trezoa/kit");
19
+ /** Gets the encoder for {@link AttestationArgs} account data. */
20
+ function getAttestationEncoder() {
21
+ return (0, kit_1.getStructEncoder)([
22
+ ['discriminator', (0, kit_1.getU8Encoder)()],
23
+ ['nonce', (0, kit_1.getAddressEncoder)()],
24
+ ['credential', (0, kit_1.getAddressEncoder)()],
25
+ ['schema', (0, kit_1.getAddressEncoder)()],
26
+ ['data', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
27
+ ['signer', (0, kit_1.getAddressEncoder)()],
28
+ ['expiry', (0, kit_1.getI64Encoder)()],
29
+ ['tokenAccount', (0, kit_1.getAddressEncoder)()],
30
+ ]);
31
+ }
32
+ /** Gets the decoder for {@link Attestation} account data. */
33
+ function getAttestationDecoder() {
34
+ return (0, kit_1.getStructDecoder)([
35
+ ['discriminator', (0, kit_1.getU8Decoder)()],
36
+ ['nonce', (0, kit_1.getAddressDecoder)()],
37
+ ['credential', (0, kit_1.getAddressDecoder)()],
38
+ ['schema', (0, kit_1.getAddressDecoder)()],
39
+ ['data', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
40
+ ['signer', (0, kit_1.getAddressDecoder)()],
41
+ ['expiry', (0, kit_1.getI64Decoder)()],
42
+ ['tokenAccount', (0, kit_1.getAddressDecoder)()],
43
+ ]);
44
+ }
45
+ /** Gets the codec for {@link Attestation} account data. */
46
+ function getAttestationCodec() {
47
+ return (0, kit_1.combineCodec)(getAttestationEncoder(), getAttestationDecoder());
48
+ }
49
+ function decodeAttestation(encodedAccount) {
50
+ return (0, kit_1.decodeAccount)(encodedAccount, getAttestationDecoder());
51
+ }
52
+ async function fetchAttestation(rpc, address, config) {
53
+ const maybeAccount = await fetchMaybeAttestation(rpc, address, config);
54
+ (0, kit_1.assertAccountExists)(maybeAccount);
55
+ return maybeAccount;
56
+ }
57
+ async function fetchMaybeAttestation(rpc, address, config) {
58
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
59
+ return decodeAttestation(maybeAccount);
60
+ }
61
+ async function fetchAllAttestation(rpc, addresses, config) {
62
+ const maybeAccounts = await fetchAllMaybeAttestation(rpc, addresses, config);
63
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
64
+ return maybeAccounts;
65
+ }
66
+ async function fetchAllMaybeAttestation(rpc, addresses, config) {
67
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
68
+ return maybeAccounts.map((maybeAccount) => decodeAttestation(maybeAccount));
69
+ }
@@ -0,0 +1,27 @@
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 { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@trezoa/kit';
9
+ export type Credential = {
10
+ discriminator: number;
11
+ authority: Address;
12
+ name: ReadonlyUint8Array;
13
+ authorizedSigners: Array<Address>;
14
+ };
15
+ export type CredentialArgs = Credential;
16
+ /** Gets the encoder for {@link CredentialArgs} account data. */
17
+ export declare function getCredentialEncoder(): Encoder<CredentialArgs>;
18
+ /** Gets the decoder for {@link Credential} account data. */
19
+ export declare function getCredentialDecoder(): Decoder<Credential>;
20
+ /** Gets the codec for {@link Credential} account data. */
21
+ export declare function getCredentialCodec(): Codec<CredentialArgs, Credential>;
22
+ export declare function decodeCredential<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Credential, TAddress>;
23
+ export declare function decodeCredential<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Credential, TAddress>;
24
+ export declare function fetchCredential<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Credential, TAddress>>;
25
+ export declare function fetchMaybeCredential<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Credential, TAddress>>;
26
+ export declare function fetchAllCredential(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Credential>[]>;
27
+ export declare function fetchAllMaybeCredential(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Credential>[]>;
@@ -0,0 +1,61 @@
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.getCredentialEncoder = getCredentialEncoder;
11
+ exports.getCredentialDecoder = getCredentialDecoder;
12
+ exports.getCredentialCodec = getCredentialCodec;
13
+ exports.decodeCredential = decodeCredential;
14
+ exports.fetchCredential = fetchCredential;
15
+ exports.fetchMaybeCredential = fetchMaybeCredential;
16
+ exports.fetchAllCredential = fetchAllCredential;
17
+ exports.fetchAllMaybeCredential = fetchAllMaybeCredential;
18
+ const kit_1 = require("@trezoa/kit");
19
+ /** Gets the encoder for {@link CredentialArgs} account data. */
20
+ function getCredentialEncoder() {
21
+ return (0, kit_1.getStructEncoder)([
22
+ ['discriminator', (0, kit_1.getU8Encoder)()],
23
+ ['authority', (0, kit_1.getAddressEncoder)()],
24
+ ['name', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
25
+ ['authorizedSigners', (0, kit_1.getArrayEncoder)((0, kit_1.getAddressEncoder)())],
26
+ ]);
27
+ }
28
+ /** Gets the decoder for {@link Credential} account data. */
29
+ function getCredentialDecoder() {
30
+ return (0, kit_1.getStructDecoder)([
31
+ ['discriminator', (0, kit_1.getU8Decoder)()],
32
+ ['authority', (0, kit_1.getAddressDecoder)()],
33
+ ['name', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
34
+ ['authorizedSigners', (0, kit_1.getArrayDecoder)((0, kit_1.getAddressDecoder)())],
35
+ ]);
36
+ }
37
+ /** Gets the codec for {@link Credential} account data. */
38
+ function getCredentialCodec() {
39
+ return (0, kit_1.combineCodec)(getCredentialEncoder(), getCredentialDecoder());
40
+ }
41
+ function decodeCredential(encodedAccount) {
42
+ return (0, kit_1.decodeAccount)(encodedAccount, getCredentialDecoder());
43
+ }
44
+ async function fetchCredential(rpc, address, config) {
45
+ const maybeAccount = await fetchMaybeCredential(rpc, address, config);
46
+ (0, kit_1.assertAccountExists)(maybeAccount);
47
+ return maybeAccount;
48
+ }
49
+ async function fetchMaybeCredential(rpc, address, config) {
50
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
51
+ return decodeCredential(maybeAccount);
52
+ }
53
+ async function fetchAllCredential(rpc, addresses, config) {
54
+ const maybeAccounts = await fetchAllMaybeCredential(rpc, addresses, config);
55
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
56
+ return maybeAccounts;
57
+ }
58
+ async function fetchAllMaybeCredential(rpc, addresses, config) {
59
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
60
+ return maybeAccounts.map((maybeAccount) => decodeCredential(maybeAccount));
61
+ }
@@ -0,0 +1,10 @@
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 './attestation';
9
+ export * from './credential';
10
+ export * from './schema';
@@ -0,0 +1,26 @@
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("./attestation"), exports);
25
+ __exportStar(require("./credential"), exports);
26
+ __exportStar(require("./schema"), exports);
@@ -0,0 +1,31 @@
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 { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@trezoa/kit';
9
+ export type Schema = {
10
+ discriminator: number;
11
+ credential: Address;
12
+ name: ReadonlyUint8Array;
13
+ description: ReadonlyUint8Array;
14
+ layout: ReadonlyUint8Array;
15
+ fieldNames: ReadonlyUint8Array;
16
+ isPaused: boolean;
17
+ version: number;
18
+ };
19
+ export type SchemaArgs = Schema;
20
+ /** Gets the encoder for {@link SchemaArgs} account data. */
21
+ export declare function getSchemaEncoder(): Encoder<SchemaArgs>;
22
+ /** Gets the decoder for {@link Schema} account data. */
23
+ export declare function getSchemaDecoder(): Decoder<Schema>;
24
+ /** Gets the codec for {@link Schema} account data. */
25
+ export declare function getSchemaCodec(): Codec<SchemaArgs, Schema>;
26
+ export declare function decodeSchema<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Schema, TAddress>;
27
+ export declare function decodeSchema<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Schema, TAddress>;
28
+ export declare function fetchSchema<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Schema, TAddress>>;
29
+ export declare function fetchMaybeSchema<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Schema, TAddress>>;
30
+ export declare function fetchAllSchema(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Schema>[]>;
31
+ export declare function fetchAllMaybeSchema(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Schema>[]>;
@@ -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.getSchemaEncoder = getSchemaEncoder;
11
+ exports.getSchemaDecoder = getSchemaDecoder;
12
+ exports.getSchemaCodec = getSchemaCodec;
13
+ exports.decodeSchema = decodeSchema;
14
+ exports.fetchSchema = fetchSchema;
15
+ exports.fetchMaybeSchema = fetchMaybeSchema;
16
+ exports.fetchAllSchema = fetchAllSchema;
17
+ exports.fetchAllMaybeSchema = fetchAllMaybeSchema;
18
+ const kit_1 = require("@trezoa/kit");
19
+ /** Gets the encoder for {@link SchemaArgs} account data. */
20
+ function getSchemaEncoder() {
21
+ return (0, kit_1.getStructEncoder)([
22
+ ['discriminator', (0, kit_1.getU8Encoder)()],
23
+ ['credential', (0, kit_1.getAddressEncoder)()],
24
+ ['name', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
25
+ ['description', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
26
+ ['layout', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
27
+ ['fieldNames', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
28
+ ['isPaused', (0, kit_1.getBooleanEncoder)()],
29
+ ['version', (0, kit_1.getU8Encoder)()],
30
+ ]);
31
+ }
32
+ /** Gets the decoder for {@link Schema} account data. */
33
+ function getSchemaDecoder() {
34
+ return (0, kit_1.getStructDecoder)([
35
+ ['discriminator', (0, kit_1.getU8Decoder)()],
36
+ ['credential', (0, kit_1.getAddressDecoder)()],
37
+ ['name', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
38
+ ['description', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
39
+ ['layout', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
40
+ ['fieldNames', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
41
+ ['isPaused', (0, kit_1.getBooleanDecoder)()],
42
+ ['version', (0, kit_1.getU8Decoder)()],
43
+ ]);
44
+ }
45
+ /** Gets the codec for {@link Schema} account data. */
46
+ function getSchemaCodec() {
47
+ return (0, kit_1.combineCodec)(getSchemaEncoder(), getSchemaDecoder());
48
+ }
49
+ function decodeSchema(encodedAccount) {
50
+ return (0, kit_1.decodeAccount)(encodedAccount, getSchemaDecoder());
51
+ }
52
+ async function fetchSchema(rpc, address, config) {
53
+ const maybeAccount = await fetchMaybeSchema(rpc, address, config);
54
+ (0, kit_1.assertAccountExists)(maybeAccount);
55
+ return maybeAccount;
56
+ }
57
+ async function fetchMaybeSchema(rpc, address, config) {
58
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
59
+ return decodeSchema(maybeAccount);
60
+ }
61
+ async function fetchAllSchema(rpc, addresses, config) {
62
+ const maybeAccounts = await fetchAllMaybeSchema(rpc, addresses, config);
63
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
64
+ return maybeAccounts;
65
+ }
66
+ async function fetchAllMaybeSchema(rpc, addresses, config) {
67
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
68
+ return maybeAccounts.map((maybeAccount) => decodeSchema(maybeAccount));
69
+ }
@@ -0,0 +1,11 @@
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 './accounts';
9
+ export * from './instructions';
10
+ export * from './programs';
11
+ export * from './types';
@@ -0,0 +1,27 @@
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("./accounts"), exports);
25
+ __exportStar(require("./instructions"), exports);
26
+ __exportStar(require("./programs"), exports);
27
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,51 @@
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_AUTHORIZED_SIGNERS_DISCRIMINATOR = 3;
11
+ export declare function getChangeAuthorizedSignersDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type ChangeAuthorizedSignersInstruction<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, 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 ? WritableAccount<TAccountCredential> : TAccountCredential,
16
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
17
+ ...TRemainingAccounts
18
+ ]>;
19
+ export type ChangeAuthorizedSignersInstructionData = {
20
+ discriminator: number;
21
+ signers: Array<Address>;
22
+ };
23
+ export type ChangeAuthorizedSignersInstructionDataArgs = {
24
+ signers: Array<Address>;
25
+ };
26
+ export declare function getChangeAuthorizedSignersInstructionDataEncoder(): Encoder<ChangeAuthorizedSignersInstructionDataArgs>;
27
+ export declare function getChangeAuthorizedSignersInstructionDataDecoder(): Decoder<ChangeAuthorizedSignersInstructionData>;
28
+ export declare function getChangeAuthorizedSignersInstructionDataCodec(): Codec<ChangeAuthorizedSignersInstructionDataArgs, ChangeAuthorizedSignersInstructionData>;
29
+ export type ChangeAuthorizedSignersInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountSystemProgram extends string = string> = {
30
+ payer: TransactionSigner<TAccountPayer>;
31
+ authority: TransactionSigner<TAccountAuthority>;
32
+ /** Credential the Schema is associated with */
33
+ credential: Address<TAccountCredential>;
34
+ systemProgram?: Address<TAccountSystemProgram>;
35
+ signers: ChangeAuthorizedSignersInstructionDataArgs['signers'];
36
+ };
37
+ export declare function getChangeAuthorizedSignersInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: ChangeAuthorizedSignersInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSystemProgram>, config?: {
38
+ programAddress?: TProgramAddress;
39
+ }): ChangeAuthorizedSignersInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSystemProgram>;
40
+ export type ParsedChangeAuthorizedSignersInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
41
+ programAddress: Address<TProgram>;
42
+ accounts: {
43
+ payer: TAccountMetas[0];
44
+ authority: TAccountMetas[1];
45
+ /** Credential the Schema is associated with */
46
+ credential: TAccountMetas[2];
47
+ systemProgram: TAccountMetas[3];
48
+ };
49
+ data: ChangeAuthorizedSignersInstructionData;
50
+ };
51
+ export declare function parseChangeAuthorizedSignersInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedChangeAuthorizedSignersInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,93 @@
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_AUTHORIZED_SIGNERS_DISCRIMINATOR = void 0;
11
+ exports.getChangeAuthorizedSignersDiscriminatorBytes = getChangeAuthorizedSignersDiscriminatorBytes;
12
+ exports.getChangeAuthorizedSignersInstructionDataEncoder = getChangeAuthorizedSignersInstructionDataEncoder;
13
+ exports.getChangeAuthorizedSignersInstructionDataDecoder = getChangeAuthorizedSignersInstructionDataDecoder;
14
+ exports.getChangeAuthorizedSignersInstructionDataCodec = getChangeAuthorizedSignersInstructionDataCodec;
15
+ exports.getChangeAuthorizedSignersInstruction = getChangeAuthorizedSignersInstruction;
16
+ exports.parseChangeAuthorizedSignersInstruction = parseChangeAuthorizedSignersInstruction;
17
+ const kit_1 = require("@trezoa/kit");
18
+ const programs_1 = require("../programs");
19
+ const shared_1 = require("../shared");
20
+ exports.CHANGE_AUTHORIZED_SIGNERS_DISCRIMINATOR = 3;
21
+ function getChangeAuthorizedSignersDiscriminatorBytes() {
22
+ return (0, kit_1.getU8Encoder)().encode(exports.CHANGE_AUTHORIZED_SIGNERS_DISCRIMINATOR);
23
+ }
24
+ function getChangeAuthorizedSignersInstructionDataEncoder() {
25
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
26
+ ['discriminator', (0, kit_1.getU8Encoder)()],
27
+ ['signers', (0, kit_1.getArrayEncoder)((0, kit_1.getAddressEncoder)())],
28
+ ]), (value) => ({
29
+ ...value,
30
+ discriminator: exports.CHANGE_AUTHORIZED_SIGNERS_DISCRIMINATOR,
31
+ }));
32
+ }
33
+ function getChangeAuthorizedSignersInstructionDataDecoder() {
34
+ return (0, kit_1.getStructDecoder)([
35
+ ['discriminator', (0, kit_1.getU8Decoder)()],
36
+ ['signers', (0, kit_1.getArrayDecoder)((0, kit_1.getAddressDecoder)())],
37
+ ]);
38
+ }
39
+ function getChangeAuthorizedSignersInstructionDataCodec() {
40
+ return (0, kit_1.combineCodec)(getChangeAuthorizedSignersInstructionDataEncoder(), getChangeAuthorizedSignersInstructionDataDecoder());
41
+ }
42
+ function getChangeAuthorizedSignersInstruction(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: true },
50
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
51
+ };
52
+ const accounts = originalAccounts;
53
+ // Original args.
54
+ const args = { ...input };
55
+ // Resolve default values.
56
+ if (!accounts.systemProgram.value) {
57
+ accounts.systemProgram.value =
58
+ '11111111111111111111111111111111';
59
+ }
60
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
61
+ return Object.freeze({
62
+ accounts: [
63
+ getAccountMeta(accounts.payer),
64
+ getAccountMeta(accounts.authority),
65
+ getAccountMeta(accounts.credential),
66
+ getAccountMeta(accounts.systemProgram),
67
+ ],
68
+ data: getChangeAuthorizedSignersInstructionDataEncoder().encode(args),
69
+ programAddress,
70
+ });
71
+ }
72
+ function parseChangeAuthorizedSignersInstruction(instruction) {
73
+ if (instruction.accounts.length < 4) {
74
+ // TODO: Coded error.
75
+ throw new Error('Not enough accounts');
76
+ }
77
+ let accountIndex = 0;
78
+ const getNextAccount = () => {
79
+ const accountMeta = instruction.accounts[accountIndex];
80
+ accountIndex += 1;
81
+ return accountMeta;
82
+ };
83
+ return {
84
+ programAddress: instruction.programAddress,
85
+ accounts: {
86
+ payer: getNextAccount(),
87
+ authority: getNextAccount(),
88
+ credential: getNextAccount(),
89
+ systemProgram: getNextAccount(),
90
+ },
91
+ data: getChangeAuthorizedSignersInstructionDataDecoder().decode(instruction.data),
92
+ };
93
+ }
@@ -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 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_DESCRIPTION_DISCRIMINATOR = 4;
11
+ export declare function getChangeSchemaDescriptionDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type ChangeSchemaDescriptionInstruction<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, 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
+ TAccountSchema extends string ? WritableAccount<TAccountSchema> : TAccountSchema,
17
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
18
+ ...TRemainingAccounts
19
+ ]>;
20
+ export type ChangeSchemaDescriptionInstructionData = {
21
+ discriminator: number;
22
+ description: string;
23
+ };
24
+ export type ChangeSchemaDescriptionInstructionDataArgs = {
25
+ description: string;
26
+ };
27
+ export declare function getChangeSchemaDescriptionInstructionDataEncoder(): Encoder<ChangeSchemaDescriptionInstructionDataArgs>;
28
+ export declare function getChangeSchemaDescriptionInstructionDataDecoder(): Decoder<ChangeSchemaDescriptionInstructionData>;
29
+ export declare function getChangeSchemaDescriptionInstructionDataCodec(): Codec<ChangeSchemaDescriptionInstructionDataArgs, ChangeSchemaDescriptionInstructionData>;
30
+ export type ChangeSchemaDescriptionInput<TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountCredential extends string = string, TAccountSchema extends string = string, TAccountSystemProgram extends string = string> = {
31
+ payer: TransactionSigner<TAccountPayer>;
32
+ authority: TransactionSigner<TAccountAuthority>;
33
+ /** Credential the Schema is associated with */
34
+ credential: Address<TAccountCredential>;
35
+ /** Credential the Schema is associated with */
36
+ schema: Address<TAccountSchema>;
37
+ systemProgram?: Address<TAccountSystemProgram>;
38
+ description: ChangeSchemaDescriptionInstructionDataArgs['description'];
39
+ };
40
+ export declare function getChangeSchemaDescriptionInstruction<TAccountPayer extends string, TAccountAuthority extends string, TAccountCredential extends string, TAccountSchema extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS>(input: ChangeSchemaDescriptionInput<TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSchema, TAccountSystemProgram>, config?: {
41
+ programAddress?: TProgramAddress;
42
+ }): ChangeSchemaDescriptionInstruction<TProgramAddress, TAccountPayer, TAccountAuthority, TAccountCredential, TAccountSchema, TAccountSystemProgram>;
43
+ export type ParsedChangeSchemaDescriptionInstruction<TProgram extends string = typeof TREZOA_ATTESTATION_SERVICE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
44
+ programAddress: Address<TProgram>;
45
+ accounts: {
46
+ payer: TAccountMetas[0];
47
+ authority: TAccountMetas[1];
48
+ /** Credential the Schema is associated with */
49
+ credential: TAccountMetas[2];
50
+ /** Credential the Schema is associated with */
51
+ schema: TAccountMetas[3];
52
+ systemProgram: TAccountMetas[4];
53
+ };
54
+ data: ChangeSchemaDescriptionInstructionData;
55
+ };
56
+ export declare function parseChangeSchemaDescriptionInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedChangeSchemaDescriptionInstruction<TProgram, TAccountMetas>;