@thawgate/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2391 @@
1
+ import { PublicKey, Connection, TransactionInstruction, Commitment, Signer, AccountMeta, Keypair, Transaction, VersionedTransaction } from '@solana/web3.js';
2
+ import { AnchorProvider, Program } from '@coral-xyz/anchor';
3
+ import BN from 'bn.js';
4
+ export { default as BN } from 'bn.js';
5
+ import { GateAction, GateVerdict } from './reasons.js';
6
+ export { FLAG_CODES, FlagCode, GATE_DENY_ERRORS, GateLogs, STRUCTURAL_DENY_CODES, StructuralDenyCode, THAWGATE_GATE_ID, THAW_ALLOW_CODES, TgCode, ThawAllowCode, classifyGateLogs, describe as describeGateCode, isTgCode, parseGateLogs } from './reasons.js';
7
+
8
+ /**
9
+ * Program IDL in camelCase format in order to be used in JS/TS.
10
+ *
11
+ * Note that this is only a type helper and is not the actual IDL. The original
12
+ * IDL can be found at `target/idl/thawgate_gate.json`.
13
+ */
14
+ type ThawgateGate = {
15
+ "address": "THAW2daLXyUtCLtTsJWDTKZctiAGmGX4wT1kqKXugUZ";
16
+ "metadata": {
17
+ "name": "thawgateGate";
18
+ "version": "0.1.0";
19
+ "spec": "0.1.0";
20
+ "description": "ThawGate: Token ACL (sRFC 37) gating program with issuer blacklist, allowlist and SAS KYC policies";
21
+ };
22
+ "instructions": [
23
+ {
24
+ "name": "canFreezePermissionless";
25
+ "docs": [
26
+ "Token ACL gate interface: may this token account be frozen permissionlessly?"
27
+ ];
28
+ "discriminator": [
29
+ 214,
30
+ 141,
31
+ 109,
32
+ 75,
33
+ 248,
34
+ 1,
35
+ 45,
36
+ 29
37
+ ];
38
+ "accounts": [
39
+ {
40
+ "name": "caller";
41
+ },
42
+ {
43
+ "name": "tokenAccount";
44
+ },
45
+ {
46
+ "name": "mint";
47
+ },
48
+ {
49
+ "name": "owner";
50
+ },
51
+ {
52
+ "name": "flagAccount";
53
+ }
54
+ ];
55
+ "args": [];
56
+ },
57
+ {
58
+ "name": "canThawPermissionless";
59
+ "docs": [
60
+ "Token ACL gate interface: may this token account be thawed permissionlessly?"
61
+ ];
62
+ "discriminator": [
63
+ 8,
64
+ 175,
65
+ 169,
66
+ 129,
67
+ 137,
68
+ 74,
69
+ 61,
70
+ 241
71
+ ];
72
+ "accounts": [
73
+ {
74
+ "name": "caller";
75
+ },
76
+ {
77
+ "name": "tokenAccount";
78
+ },
79
+ {
80
+ "name": "mint";
81
+ },
82
+ {
83
+ "name": "owner";
84
+ },
85
+ {
86
+ "name": "flagAccount";
87
+ }
88
+ ];
89
+ "args": [];
90
+ },
91
+ {
92
+ "name": "initPolicy";
93
+ "docs": [
94
+ "Creates the mint's policy and its thaw/freeze extra-metas lists.",
95
+ "Signed by the Token ACL freeze authority; `args.authority` becomes the policy admin."
96
+ ];
97
+ "discriminator": [
98
+ 45,
99
+ 234,
100
+ 110,
101
+ 100,
102
+ 209,
103
+ 146,
104
+ 191,
105
+ 86
106
+ ];
107
+ "accounts": [
108
+ {
109
+ "name": "freezeAuthority";
110
+ "docs": [
111
+ "Token ACL `MintConfig.freeze_authority` of this mint. Can be a PDA signing through CPI",
112
+ "(the sss-token config in S6). The policy admin is `args.authority`, which may be someone else."
113
+ ];
114
+ "signer": true;
115
+ },
116
+ {
117
+ "name": "payer";
118
+ "docs": [
119
+ "Pays rent. Separate from `freeze_authority`, since a program-owned PDA cannot fund `create_account`."
120
+ ];
121
+ "writable": true;
122
+ "signer": true;
123
+ },
124
+ {
125
+ "name": "policy";
126
+ "writable": true;
127
+ "pda": {
128
+ "seeds": [
129
+ {
130
+ "kind": "const";
131
+ "value": [
132
+ 112,
133
+ 111,
134
+ 108,
135
+ 105,
136
+ 99,
137
+ 121
138
+ ];
139
+ },
140
+ {
141
+ "kind": "account";
142
+ "path": "mint";
143
+ }
144
+ ];
145
+ };
146
+ },
147
+ {
148
+ "name": "mint";
149
+ },
150
+ {
151
+ "name": "mintConfig";
152
+ },
153
+ {
154
+ "name": "thawExtraMetas";
155
+ "writable": true;
156
+ },
157
+ {
158
+ "name": "freezeExtraMetas";
159
+ "writable": true;
160
+ },
161
+ {
162
+ "name": "systemProgram";
163
+ "address": "11111111111111111111111111111111";
164
+ }
165
+ ];
166
+ "args": [
167
+ {
168
+ "name": "args";
169
+ "type": {
170
+ "defined": {
171
+ "name": "policyArgs";
172
+ };
173
+ };
174
+ }
175
+ ];
176
+ },
177
+ {
178
+ "name": "setupExtraMetas";
179
+ "docs": [
180
+ "Rewrites both extra-metas lists from the stored policy (idempotent)."
181
+ ];
182
+ "discriminator": [
183
+ 160,
184
+ 172,
185
+ 133,
186
+ 35,
187
+ 114,
188
+ 239,
189
+ 51,
190
+ 158
191
+ ];
192
+ "accounts": [
193
+ {
194
+ "name": "authority";
195
+ "signer": true;
196
+ "relations": [
197
+ "policy"
198
+ ];
199
+ },
200
+ {
201
+ "name": "payer";
202
+ "writable": true;
203
+ "signer": true;
204
+ },
205
+ {
206
+ "name": "policy";
207
+ "writable": true;
208
+ "pda": {
209
+ "seeds": [
210
+ {
211
+ "kind": "const";
212
+ "value": [
213
+ 112,
214
+ 111,
215
+ 108,
216
+ 105,
217
+ 99,
218
+ 121
219
+ ];
220
+ },
221
+ {
222
+ "kind": "account";
223
+ "path": "mint";
224
+ }
225
+ ];
226
+ };
227
+ },
228
+ {
229
+ "name": "mint";
230
+ "relations": [
231
+ "policy"
232
+ ];
233
+ },
234
+ {
235
+ "name": "thawExtraMetas";
236
+ "writable": true;
237
+ },
238
+ {
239
+ "name": "freezeExtraMetas";
240
+ "writable": true;
241
+ },
242
+ {
243
+ "name": "systemProgram";
244
+ "address": "11111111111111111111111111111111";
245
+ }
246
+ ];
247
+ "args": [];
248
+ },
249
+ {
250
+ "name": "updatePolicy";
251
+ "docs": [
252
+ "Changes the policy and rewrites both extra-metas lists to match."
253
+ ];
254
+ "discriminator": [
255
+ 212,
256
+ 245,
257
+ 246,
258
+ 7,
259
+ 163,
260
+ 151,
261
+ 18,
262
+ 57
263
+ ];
264
+ "accounts": [
265
+ {
266
+ "name": "authority";
267
+ "signer": true;
268
+ "relations": [
269
+ "policy"
270
+ ];
271
+ },
272
+ {
273
+ "name": "payer";
274
+ "writable": true;
275
+ "signer": true;
276
+ },
277
+ {
278
+ "name": "policy";
279
+ "writable": true;
280
+ "pda": {
281
+ "seeds": [
282
+ {
283
+ "kind": "const";
284
+ "value": [
285
+ 112,
286
+ 111,
287
+ 108,
288
+ 105,
289
+ 99,
290
+ 121
291
+ ];
292
+ },
293
+ {
294
+ "kind": "account";
295
+ "path": "mint";
296
+ }
297
+ ];
298
+ };
299
+ },
300
+ {
301
+ "name": "mint";
302
+ "relations": [
303
+ "policy"
304
+ ];
305
+ },
306
+ {
307
+ "name": "thawExtraMetas";
308
+ "writable": true;
309
+ },
310
+ {
311
+ "name": "freezeExtraMetas";
312
+ "writable": true;
313
+ },
314
+ {
315
+ "name": "systemProgram";
316
+ "address": "11111111111111111111111111111111";
317
+ }
318
+ ];
319
+ "args": [
320
+ {
321
+ "name": "args";
322
+ "type": {
323
+ "defined": {
324
+ "name": "policyArgs";
325
+ };
326
+ };
327
+ }
328
+ ];
329
+ }
330
+ ];
331
+ "accounts": [
332
+ {
333
+ "name": "gatePolicy";
334
+ "discriminator": [
335
+ 3,
336
+ 77,
337
+ 45,
338
+ 55,
339
+ 30,
340
+ 166,
341
+ 143,
342
+ 147
343
+ ];
344
+ }
345
+ ];
346
+ "errors": [
347
+ {
348
+ "code": 6000;
349
+ "name": "invalidMintConfig";
350
+ "msg": "Not a Token ACL MintConfig (owner, size or discriminator)";
351
+ },
352
+ {
353
+ "code": 6001;
354
+ "name": "mintConfigMismatch";
355
+ "msg": "The MintConfig belongs to a different mint";
356
+ },
357
+ {
358
+ "code": 6002;
359
+ "name": "notFreezeAuthority";
360
+ "msg": "Signer is not the Token ACL freeze authority of this mint";
361
+ },
362
+ {
363
+ "code": 6003;
364
+ "name": "notPolicyAuthority";
365
+ "msg": "Signer is not the policy authority";
366
+ },
367
+ {
368
+ "code": 6004;
369
+ "name": "invalidMint";
370
+ "msg": "Mint is not a Token-2022 mint";
371
+ },
372
+ {
373
+ "code": 6005;
374
+ "name": "invalidExtraMetasAccount";
375
+ "msg": "Extra-metas account is not the expected PDA";
376
+ },
377
+ {
378
+ "code": 6006;
379
+ "name": "missingIssuerProgram";
380
+ "msg": "issuer_program must be set when the blacklist or allowlist is enabled";
381
+ },
382
+ {
383
+ "code": 6007;
384
+ "name": "missingSasConfig";
385
+ "msg": "sas_credential and sas_schema must be set when require_sas is on";
386
+ },
387
+ {
388
+ "code": 6008;
389
+ "name": "bypassNeedsSas";
390
+ "msg": "BypassForPdas stands in for the SAS credential, so it needs require_sas";
391
+ },
392
+ {
393
+ "code": 6009;
394
+ "name": "deniedMissingAccounts";
395
+ "msg": "TG:DENY:MISSING_ACCOUNTS: extra accounts missing";
396
+ },
397
+ {
398
+ "code": 6010;
399
+ "name": "deniedBadPolicy";
400
+ "msg": "TG:DENY:BAD_POLICY: policy account is not this mint's GatePolicy";
401
+ },
402
+ {
403
+ "code": 6011;
404
+ "name": "deniedBadRegistryEntry";
405
+ "msg": "TG:DENY:BAD_REGISTRY_ENTRY: registry account has the wrong owner, type or fields";
406
+ },
407
+ {
408
+ "code": 6012;
409
+ "name": "deniedBadCredential";
410
+ "msg": "TG:DENY:BAD_CREDENTIAL: attestation account is not a SAS attestation of this credential, schema and owner";
411
+ },
412
+ {
413
+ "code": 6013;
414
+ "name": "deniedNoImmutableOwner";
415
+ "msg": "TG:DENY:NO_IMMUTABLE_OWNER: token account lacks the ImmutableOwner extension";
416
+ },
417
+ {
418
+ "code": 6014;
419
+ "name": "deniedBlacklisted";
420
+ "msg": "TG:DENY:BLACKLISTED: owner is on the issuer blacklist";
421
+ },
422
+ {
423
+ "code": 6015;
424
+ "name": "deniedNotAllowlisted";
425
+ "msg": "TG:DENY:NOT_ALLOWLISTED: owner is not on the issuer allowlist";
426
+ },
427
+ {
428
+ "code": 6016;
429
+ "name": "deniedNoCredential";
430
+ "msg": "TG:DENY:NO_CREDENTIAL: owner has no SAS attestation (never issued, or revoked)";
431
+ },
432
+ {
433
+ "code": 6017;
434
+ "name": "deniedCredentialExpired";
435
+ "msg": "TG:DENY:CREDENTIAL_EXPIRED: owner's SAS attestation has expired";
436
+ },
437
+ {
438
+ "code": 6018;
439
+ "name": "deniedKycLevelTooLow";
440
+ "msg": "TG:DENY:KYC_LEVEL_TOO_LOW: owner's kyc_level is below the policy minimum";
441
+ },
442
+ {
443
+ "code": 6019;
444
+ "name": "deniedCompliant";
445
+ "msg": "TG:DENY:COMPLIANT: owner passes the policy, so it cannot be frozen permissionlessly";
446
+ }
447
+ ];
448
+ "types": [
449
+ {
450
+ "name": "allowlistMode";
451
+ "docs": [
452
+ "How the issuer allowlist is used."
453
+ ];
454
+ "type": {
455
+ "kind": "enum";
456
+ "variants": [
457
+ {
458
+ "name": "off";
459
+ },
460
+ {
461
+ "name": "allowOnly";
462
+ },
463
+ {
464
+ "name": "bypassForPdas";
465
+ }
466
+ ];
467
+ };
468
+ },
469
+ {
470
+ "name": "gatePolicy";
471
+ "docs": [
472
+ "One per mint. Token ACL resolves it for the gate as extra account `[6]`."
473
+ ];
474
+ "type": {
475
+ "kind": "struct";
476
+ "fields": [
477
+ {
478
+ "name": "version";
479
+ "type": "u8";
480
+ },
481
+ {
482
+ "name": "bump";
483
+ "type": "u8";
484
+ },
485
+ {
486
+ "name": "mint";
487
+ "type": "pubkey";
488
+ },
489
+ {
490
+ "name": "authority";
491
+ "docs": [
492
+ "May change the policy (`update_policy`, `setup_extra_metas`)."
493
+ ];
494
+ "type": "pubkey";
495
+ },
496
+ {
497
+ "name": "issuerProgram";
498
+ "docs": [
499
+ "Program that owns the registry (sss-token): `BlacklistEntry` at `[\"blacklist\", mint, wallet]`,",
500
+ "`AllowlistEntry` at `[\"allowlist\", mint, wallet]`."
501
+ ];
502
+ "type": "pubkey";
503
+ },
504
+ {
505
+ "name": "checkBlacklist";
506
+ "type": "bool";
507
+ },
508
+ {
509
+ "name": "allowlistMode";
510
+ "type": {
511
+ "defined": {
512
+ "name": "allowlistMode";
513
+ };
514
+ };
515
+ },
516
+ {
517
+ "name": "requireSas";
518
+ "docs": [
519
+ "SAS KYC policy: the owner needs a live attestation at `[\"attestation\", sas_credential, sas_schema, owner]`",
520
+ "under SAS (nonce = holder wallet)."
521
+ ];
522
+ "type": "bool";
523
+ },
524
+ {
525
+ "name": "sasCredential";
526
+ "type": "pubkey";
527
+ },
528
+ {
529
+ "name": "sasSchema";
530
+ "type": "pubkey";
531
+ },
532
+ {
533
+ "name": "minKycLevel";
534
+ "docs": [
535
+ "0 = any level. Otherwise compared with the attestation data's first byte, so the schema's first field must",
536
+ "be `kyc_level: u8`."
537
+ ];
538
+ "type": "u8";
539
+ },
540
+ {
541
+ "name": "reserved";
542
+ "docs": [
543
+ "Room for later policies (sanctions, keeper settings) without a realloc."
544
+ ];
545
+ "type": {
546
+ "array": [
547
+ "u8",
548
+ 64
549
+ ];
550
+ };
551
+ }
552
+ ];
553
+ };
554
+ },
555
+ {
556
+ "name": "policyArgs";
557
+ "docs": [
558
+ "Settable policy fields, for `init_policy` and `update_policy`."
559
+ ];
560
+ "type": {
561
+ "kind": "struct";
562
+ "fields": [
563
+ {
564
+ "name": "authority";
565
+ "type": "pubkey";
566
+ },
567
+ {
568
+ "name": "issuerProgram";
569
+ "type": "pubkey";
570
+ },
571
+ {
572
+ "name": "checkBlacklist";
573
+ "type": "bool";
574
+ },
575
+ {
576
+ "name": "allowlistMode";
577
+ "type": {
578
+ "defined": {
579
+ "name": "allowlistMode";
580
+ };
581
+ };
582
+ },
583
+ {
584
+ "name": "requireSas";
585
+ "type": "bool";
586
+ },
587
+ {
588
+ "name": "sasCredential";
589
+ "type": "pubkey";
590
+ },
591
+ {
592
+ "name": "sasSchema";
593
+ "type": "pubkey";
594
+ },
595
+ {
596
+ "name": "minKycLevel";
597
+ "type": "u8";
598
+ }
599
+ ];
600
+ };
601
+ }
602
+ ];
603
+ };
604
+
605
+ /**
606
+ * @module gate/tokenAcl
607
+ * @description Token ACL (sRFC 37) instructions on @solana/web3.js v1.
608
+ *
609
+ * Hand-built from @token-acl/sdk 0.2.7's generated code, which is @solana/kit-based (and its `*WithExtraMetas`
610
+ * builders print to the console). tests/tokenAcl.test.ts pins every builder here byte-for-byte against it. Extra
611
+ * account metas resolve with @solana/spl-token's resolver, the same algorithm @token-acl/sdk uses.
612
+ */
613
+
614
+ /** Token ACL instruction discriminators (one byte). */
615
+ declare const TOKEN_ACL_IX: {
616
+ readonly createConfig: 0;
617
+ readonly setAuthority: 1;
618
+ readonly setGatingProgram: 2;
619
+ readonly deleteConfig: 3;
620
+ readonly thaw: 4;
621
+ readonly freeze: 5;
622
+ readonly thawPermissionless: 6;
623
+ readonly freezePermissionless: 7;
624
+ readonly togglePermissionlessInstructions: 8;
625
+ readonly thawPermissionlessIdempotent: 9;
626
+ readonly freezePermissionlessIdempotent: 10;
627
+ };
628
+ /** `["MINT_CONFIG", mint]` under Token ACL. */
629
+ declare function findMintConfigPda(mint: PublicKey, programId?: PublicKey): PublicKey;
630
+ /** `["FLAG_ACCOUNT", tokenAccount]` under Token ACL: created and closed inside a permissionless thaw or freeze. */
631
+ declare function findFlagAccountPda(tokenAccount: PublicKey, programId?: PublicKey): PublicKey;
632
+ /** The gating program's extra-metas list for permissionless thaw: `["thaw_extra_account_metas", mint]` under the gate. */
633
+ declare function findThawExtraMetasPda(mint: PublicKey, gatingProgram: PublicKey): PublicKey;
634
+ /** The gating program's extra-metas list for permissionless freeze: `["freeze_extra_account_metas", mint]`. */
635
+ declare function findFreezeExtraMetasPda(mint: PublicKey, gatingProgram: PublicKey): PublicKey;
636
+ /** Token ACL's per-mint config. `freezeAuthority` may freeze, thaw and change the gate; it is the mint's freeze authority. */
637
+ interface MintConfig {
638
+ bump: number;
639
+ enablePermissionlessThaw: boolean;
640
+ enablePermissionlessFreeze: boolean;
641
+ mint: PublicKey;
642
+ freezeAuthority: PublicKey;
643
+ gatingProgram: PublicKey;
644
+ }
645
+ /** u8 discriminator (1), bump, two flags, then three pubkeys. */
646
+ declare const MINT_CONFIG_SIZE = 100;
647
+ declare function decodeMintConfig(data: Buffer | Uint8Array): MintConfig;
648
+ /** The mint's Token ACL config, or `null` if the mint has none (it is not a Token ACL mint). */
649
+ declare function fetchMintConfig(connection: Connection, mint: PublicKey): Promise<MintConfig | null>;
650
+ /** Switch the mint's gating program. Signed by the MintConfig freeze authority. */
651
+ declare function setGatingProgramIx(args: {
652
+ authority: PublicKey;
653
+ mint: PublicKey;
654
+ gatingProgram: PublicKey;
655
+ }): TransactionInstruction;
656
+ /** Enable or disable permissionless freeze and thaw. Signed by the MintConfig freeze authority. */
657
+ declare function togglePermissionlessIx(args: {
658
+ authority: PublicKey;
659
+ mint: PublicKey;
660
+ freeze: boolean;
661
+ thaw: boolean;
662
+ }): TransactionInstruction;
663
+ /**
664
+ * A permissionless Token ACL instruction. The idempotent variants return early, without calling the gate, when the
665
+ * account is already in the target state.
666
+ */
667
+ type PermissionlessKind = "thaw" | "thawIdempotent" | "freeze" | "freezeIdempotent";
668
+ interface PermissionlessArgs {
669
+ /** Signs and pays for the flag account's rent (refunded in the same instruction). Anyone may call. */
670
+ caller: PublicKey;
671
+ mint: PublicKey;
672
+ tokenAccount: PublicKey;
673
+ /** The token account's owner. Token ACL checks it against the account. */
674
+ owner: PublicKey;
675
+ /** The mint's config, if already fetched. */
676
+ mintConfig?: MintConfig;
677
+ }
678
+ /**
679
+ * Builds `thaw_permissionless` / `freeze_permissionless` (or an idempotent variant) with the gating program's extra
680
+ * accounts resolved, like @token-acl/sdk's `create*InstructionWithExtraMetas`.
681
+ *
682
+ * The gate receives `[caller, token_account, mint, owner, flag_account, extra_metas, ...extras]`. Its meta list's
683
+ * seeds index into that list, so the resolver starts from those six accounts and appends each resolved meta in turn
684
+ * (a later seed can reference an earlier extra, e.g. the attestation's credential and schema).
685
+ */
686
+ declare function permissionlessIx(connection: Connection, kind: PermissionlessKind, args: PermissionlessArgs): Promise<TransactionInstruction>;
687
+
688
+ /**
689
+ * @module gate/client
690
+ * @description GateClient: ThawGate policies and the holder-side flows (unlock, explain, freeze-if-invalid) for any
691
+ * Token ACL mint gated by ThawGate, whoever issued it. sss-token mints get it as `SolanaStablecoin#gate`.
692
+ *
693
+ * @example
694
+ * ```ts
695
+ * const gate = new GateClient(connection, wallet);
696
+ * const why = await gate.explain(mint, holder); // simulate: may this wallet unlock? why not?
697
+ * await gate.send(await gate.createAtaAndThaw(mint, holder));
698
+ * await gate.freezeIfInvalid(tokenAccount); // freezes only if the gate allows it
699
+ * ```
700
+ */
701
+
702
+ /** An Anchor-style wallet: a public key that signs transactions. `keypairWallet(keypair)` makes one. */
703
+ type GateWallet = AnchorProvider["wallet"];
704
+ /** How the issuer's allowlist is used. `bypassForPdas` lets allowlisted program-owned accounts (pool vaults) skip SAS. */
705
+ type AllowlistMode = "off" | "allowOnly" | "bypassForPdas";
706
+ /** A policy, as you write it. Every field is optional; the defaults are off. */
707
+ interface PolicyInput {
708
+ /** Deny holders with an active blacklist entry in the issuer program. */
709
+ checkBlacklist?: boolean;
710
+ allowlistMode?: AllowlistMode;
711
+ /** Require a live SAS attestation (nonce = the holder's wallet) under this credential and schema. `null` turns SAS off. */
712
+ sas?: {
713
+ credential: PublicKey;
714
+ schema: PublicKey;
715
+ minKycLevel?: number;
716
+ } | null;
717
+ /** Owner of the blacklist/allowlist entries. Default: sss-token when either list is on. Ignored by `enableTokenAcl`. */
718
+ issuerProgram?: PublicKey;
719
+ /** Who may change the policy. Default: the payer. Ignored by `enableTokenAcl` (it uses the issuer's authority). */
720
+ authority?: PublicKey;
721
+ }
722
+ /** A policy as stored on chain (`["policy", mint]` under the gate). */
723
+ interface GatePolicy {
724
+ address: PublicKey;
725
+ version: number;
726
+ mint: PublicKey;
727
+ authority: PublicKey;
728
+ issuerProgram: PublicKey;
729
+ checkBlacklist: boolean;
730
+ allowlistMode: AllowlistMode;
731
+ requireSas: boolean;
732
+ sasCredential: PublicKey;
733
+ sasSchema: PublicKey;
734
+ minKycLevel: number;
735
+ }
736
+ /** What `explain` found. */
737
+ interface Explanation {
738
+ mint: PublicKey;
739
+ wallet: PublicKey;
740
+ tokenAccount: PublicKey;
741
+ /** The token account before the simulation. */
742
+ account: "missing" | "frozen" | "thawed";
743
+ /**
744
+ * - `can_unlock`: the account is missing or frozen, and a permissionless thaw would succeed.
745
+ * - `denied`: a thaw would be refused (`code` says why).
746
+ * - `compliant`: the account is thawed and nobody can freeze it permissionlessly.
747
+ * - `freezable`: the account is thawed, but the policy flags the owner, so anyone can freeze it (`code` says why).
748
+ * - `not_token_acl`, `permissionless_disabled`, `error`: see `reason`.
749
+ */
750
+ status: "can_unlock" | "denied" | "compliant" | "freezable" | "not_token_acl" | "permissionless_disabled" | "error";
751
+ /** The gate's reason code (`KYC`, `NO_CREDENTIAL`, …), or null when the gate did not decide. */
752
+ code: string | null;
753
+ /** One sentence for a person. */
754
+ reason: string;
755
+ /** What was simulated: a thaw (missing or frozen account) or a freeze (thawed account). */
756
+ simulated: GateAction | null;
757
+ gatingProgram: PublicKey | null;
758
+ verdict: GateVerdict | null;
759
+ logs: string[];
760
+ }
761
+ interface FreezeResult {
762
+ frozen: boolean;
763
+ /** It was frozen before this call. */
764
+ alreadyFrozen: boolean;
765
+ code: string | null;
766
+ reason: string;
767
+ signature?: string;
768
+ }
769
+ /** sss-token's `GatePolicyConfig` (the `enable_token_acl` argument) from a PolicyInput. */
770
+ declare function toGatePolicyConfig(p: PolicyInput): {
771
+ checkBlacklist: boolean;
772
+ allowlistMode: object;
773
+ requireSas: boolean;
774
+ sasCredential: PublicKey;
775
+ sasSchema: PublicKey;
776
+ minKycLevel: number;
777
+ };
778
+ interface GateClientOptions {
779
+ /** Default: the devnet ThawGate deployment. */
780
+ gateProgramId?: PublicKey;
781
+ commitment?: Commitment;
782
+ }
783
+ declare class GateClient {
784
+ readonly connection: Connection;
785
+ readonly wallet?: GateWallet | undefined;
786
+ readonly program: Program<ThawgateGate>;
787
+ readonly gateProgramId: PublicKey;
788
+ private readonly commitment;
789
+ /**
790
+ * @param connection - RPC connection.
791
+ * @param wallet - Signs and pays. Optional for read-only use (`explain`, `getPolicy`, builders with explicit payers).
792
+ */
793
+ constructor(connection: Connection, wallet?: GateWallet | undefined, opts?: GateClientOptions);
794
+ private me;
795
+ /** `["policy", mint]` under the gate. */
796
+ policyAddress(mint: PublicKey): PublicKey;
797
+ /** The mint's Token ACL config (freeze authority, gating program, permissionless flags), or null. */
798
+ getMintConfig(mint: PublicKey): Promise<MintConfig | null>;
799
+ /** The mint's ThawGate policy, or null if it has none. */
800
+ getPolicy(mint: PublicKey): Promise<GatePolicy | null>;
801
+ private metasAccounts;
802
+ /** Refuses mints whose Token ACL freeze authority is sss-token's config PDA: those get their policy from `enable_token_acl`. */
803
+ private freezeAuthorityOf;
804
+ /**
805
+ * Create the mint's policy and write both extra-metas lists. Signed by the Token ACL freeze authority of the mint
806
+ * (not for sss-token mints: `enableTokenAcl` does this there). The gating program is not switched; `swapGate` does both.
807
+ */
808
+ initPolicy(mint: PublicKey, policy: PolicyInput, opts?: {
809
+ freezeAuthority?: PublicKey;
810
+ payer?: PublicKey;
811
+ }): Promise<TransactionInstruction[]>;
812
+ /**
813
+ * Change the policy and rewrite both extra-metas lists. `changes` apply on top of the stored policy (`sas: null`
814
+ * turns SAS off). Signed by the policy authority: the issuer's wallet on sss-token mints.
815
+ */
816
+ updatePolicy(mint: PublicKey, changes: PolicyInput, opts?: {
817
+ authority?: PublicKey;
818
+ payer?: PublicKey;
819
+ }): Promise<TransactionInstruction[]>;
820
+ /** Rewrite both extra-metas lists from the stored policy (idempotent). Signed by the policy authority. */
821
+ setupExtraMetas(mint: PublicKey, opts?: {
822
+ authority?: PublicKey;
823
+ payer?: PublicKey;
824
+ }): Promise<TransactionInstruction[]>;
825
+ /**
826
+ * Move an existing Token ACL mint (e.g. on the ABL gate) to ThawGate in one transaction: create the policy (or
827
+ * rewrite it if it exists), `set_gating_program` to ThawGate, and enable permissionless thaw and freeze if either
828
+ * is off. Signed by the mint's Token ACL freeze authority.
829
+ *
830
+ * Token ACL clients that find the gate through the mint's `token_acl` metadata field (@token-acl/sdk's `*FromMint`
831
+ * builders) would keep resolving the old gate's accounts, so the field is updated too when it names another gate.
832
+ * That needs the metadata update authority (`metadataAuthority`, default the freeze authority); pass
833
+ * `skipMetadata: true` to leave it.
834
+ */
835
+ swapGate(mint: PublicKey, policy: PolicyInput, opts?: {
836
+ freezeAuthority?: PublicKey;
837
+ payer?: PublicKey;
838
+ metadataAuthority?: PublicKey;
839
+ skipMetadata?: boolean;
840
+ }): Promise<TransactionInstruction[]>;
841
+ /** Point the mint's `token_acl` metadata field at this gate, if the mint has the field and it names another program. */
842
+ private tokenAclMetadataIxs;
843
+ /** The owner's associated token account for a Token-2022 mint (off-curve owners allowed). */
844
+ ata(mint: PublicKey, owner: PublicKey): PublicKey;
845
+ /**
846
+ * Create the owner's ATA if missing, then thaw it permissionlessly through the gate (idempotent: a thawed account
847
+ * stays as is). Anyone can pay; the owner doesn't sign. If the gate would deny, the transaction fails: call
848
+ * `explain` first for the reason.
849
+ */
850
+ createAtaAndThaw(mint: PublicKey, owner: PublicKey, opts?: {
851
+ payer?: PublicKey;
852
+ }): Promise<TransactionInstruction[]>;
853
+ private readTokenAccount;
854
+ /**
855
+ * Why may (or can't) this wallet hold the token? Simulates the permissionless instruction that applies, with no
856
+ * signature and no state change:
857
+ * - the wallet's account is missing or frozen: create-ATA + thaw (would it unlock?);
858
+ * - it is thawed: freeze (could anyone freeze it?).
859
+ *
860
+ * The fee payer of the simulation must exist and, for a missing account, afford the ATA rent: `opts.payer`, else the
861
+ * client's wallet, else the policy authority.
862
+ */
863
+ explain(mint: PublicKey, wallet: PublicKey, opts?: {
864
+ payer?: PublicKey;
865
+ tokenAccount?: PublicKey;
866
+ }): Promise<Explanation>;
867
+ /**
868
+ * Freeze `tokenAccount` permissionlessly if, and only if, the gate allows it (the policy flags its owner). Simulates
869
+ * first and sends only on `TG:ALLOW`, so a compliant holder costs no fee. Needs a wallet: it signs and pays.
870
+ */
871
+ freezeIfInvalid(tokenAccount: PublicKey): Promise<FreezeResult>;
872
+ /** Simulate without signatures. `payerMissing` = the fee payer account doesn't exist. */
873
+ simulate(ixs: TransactionInstruction[], payer: PublicKey): Promise<{
874
+ err: unknown;
875
+ logs: string[];
876
+ errorCode?: number;
877
+ payerMissing: boolean;
878
+ unitsConsumed?: number;
879
+ }>;
880
+ /**
881
+ * Sign with the client's wallet, then with `signers`, send, and confirm. Returns the signature.
882
+ *
883
+ * The wallet signs first: Phantom asks for that order on multi-signer transactions (a wallet may change the
884
+ * transaction while signing, which would void signatures made before it). Anchor's `sendAndConfirm` signs the
885
+ * other way round, so it gets no signers here and a wallet that adds them after the real wallet has signed.
886
+ */
887
+ send(ixs: TransactionInstruction[], signers?: Signer[]): Promise<string>;
888
+ }
889
+
890
+ /**
891
+ * @module types
892
+ * @description TypeScript type definitions for the Solana Stablecoin Standard (SSS) SDK.
893
+ *
894
+ * These types mirror the on-chain Anchor program state and instruction arguments.
895
+ */
896
+
897
+ /**
898
+ * Role types matching the on-chain RoleType enum.
899
+ * Numeric values match the Anchor discriminator bytes.
900
+ */
901
+ declare enum RoleType {
902
+ MasterAuthority = 0,
903
+ Minter = 1,
904
+ Burner = 2,
905
+ Pauser = 3,
906
+ Blacklister = 4,
907
+ Seizer = 5
908
+ }
909
+ /**
910
+ * Minter quota period matching the on-chain QuotaPeriod enum.
911
+ */
912
+ declare enum QuotaPeriod {
913
+ Daily = 0,
914
+ Weekly = 1,
915
+ Monthly = 2,
916
+ Lifetime = 3
917
+ }
918
+ /**
919
+ * Supported SSS preset tiers.
920
+ */
921
+ declare enum SSSPreset {
922
+ /** Basic stablecoin — mint, burn, freeze, pause, roles */
923
+ SSS1 = "SSS-1",
924
+ /** Enhanced compliance — adds blacklist, seize, transfer hook */
925
+ SSS2 = "SSS-2",
926
+ /** Private stablecoin — confidential transfers + allowlist */
927
+ SSS3 = "SSS-3",
928
+ /** Token ACL mint gated by ThawGate (no transfer hook); the default for new mints */
929
+ SSS_ACL = "SSS-ACL",
930
+ /** Token ACL plus the SSS transfer hook */
931
+ SSS_BOTH = "SSS-Both"
932
+ }
933
+ /**
934
+ * How a mint enforces compliance (`StablecoinConfig.compliance_mode`, immutable).
935
+ */
936
+ declare enum ComplianceMode {
937
+ /** Transfer hook on every transfer (legacy SSS-2). */
938
+ Hook = 0,
939
+ /** Token ACL: frozen-by-default accounts thawed through the ThawGate gate; no hook. */
940
+ Acl = 1,
941
+ /** Token ACL and the transfer hook. */
942
+ Both = 2
943
+ }
944
+ /**
945
+ * On-chain StablecoinConfig account data.
946
+ */
947
+ interface StablecoinConfig {
948
+ /** The MasterAuthority who controls this stablecoin. */
949
+ authority: PublicKey;
950
+ /** The Token-2022 mint address. */
951
+ mint: PublicKey;
952
+ /** Human-readable name (max 32 chars). */
953
+ name: string;
954
+ /** Ticker symbol (max 10 chars). */
955
+ symbol: string;
956
+ /** Metadata URI (max 200 chars). */
957
+ uri: string;
958
+ /** Number of decimal places. */
959
+ decimals: number;
960
+ /** Whether permanent delegate extension is enabled (immutable). */
961
+ enablePermanentDelegate: boolean;
962
+ /** Whether transfer hook extension is enabled (immutable). */
963
+ enableTransferHook: boolean;
964
+ /** Whether new accounts are frozen by default (immutable). */
965
+ defaultAccountFrozen: boolean;
966
+ /** Whether token operations are currently paused. */
967
+ paused: boolean;
968
+ /** Total tokens minted (cumulative). */
969
+ totalMinted: BN;
970
+ /** Total tokens burned (cumulative). */
971
+ totalBurned: BN;
972
+ /** PDA bump seed. */
973
+ bump: number;
974
+ /** A `ComplianceMode` value (immutable; decodes as 0 = Hook on configs created before S6). */
975
+ complianceMode: number;
976
+ }
977
+ /**
978
+ * On-chain RoleRecord account data.
979
+ */
980
+ interface RoleRecord {
981
+ /** The mint this role is associated with. */
982
+ mint: PublicKey;
983
+ /** The key that holds this role. */
984
+ holder: PublicKey;
985
+ /** The type of role. */
986
+ role: RoleType;
987
+ /** Whether the role is currently active. */
988
+ active: boolean;
989
+ /** Unix timestamp when the role was granted. */
990
+ grantedAt: BN;
991
+ /** PDA bump seed. */
992
+ bump: number;
993
+ }
994
+ /**
995
+ * On-chain MinterQuota account data.
996
+ */
997
+ interface MinterQuota {
998
+ /** The mint this quota applies to. */
999
+ mint: PublicKey;
1000
+ /** The minter this quota belongs to. */
1001
+ minter: PublicKey;
1002
+ /** Maximum amount that can be minted per period. */
1003
+ limit: BN;
1004
+ /** Amount already minted in current period. */
1005
+ used: BN;
1006
+ /** The quota period type. */
1007
+ period: QuotaPeriod;
1008
+ /** PDA bump seed. */
1009
+ bump: number;
1010
+ }
1011
+ /**
1012
+ * On-chain BlacklistEntry account data (SSS-2 only).
1013
+ */
1014
+ interface BlacklistEntry {
1015
+ /** The mint this entry applies to. */
1016
+ mint: PublicKey;
1017
+ /** The blacklisted wallet address. */
1018
+ target: PublicKey;
1019
+ /** Human-readable reason for blacklisting. */
1020
+ reason: string;
1021
+ /** Unix timestamp when added. */
1022
+ addedAt: BN;
1023
+ /** The operator who added the entry. */
1024
+ addedBy: PublicKey;
1025
+ /** Whether the entry is currently active. */
1026
+ active: boolean;
1027
+ /** PDA bump seed. */
1028
+ bump: number;
1029
+ }
1030
+ /**
1031
+ * On-chain PauseState account data.
1032
+ */
1033
+ interface PauseState {
1034
+ /** The mint this pause state applies to. */
1035
+ mint: PublicKey;
1036
+ /** Whether token operations are paused. */
1037
+ paused: boolean;
1038
+ /** Unix timestamp when last paused (0 if never). */
1039
+ pausedAt: BN;
1040
+ /** The operator who last paused. */
1041
+ pausedBy: PublicKey;
1042
+ /** PDA bump seed. */
1043
+ bump: number;
1044
+ }
1045
+ /**
1046
+ * Arguments for the initialize instruction.
1047
+ */
1048
+ interface InitializeArgs {
1049
+ /** Human-readable name (max 32 chars). */
1050
+ name: string;
1051
+ /** Ticker symbol (max 10 chars). */
1052
+ symbol: string;
1053
+ /** Metadata URI (max 200 chars). */
1054
+ uri: string;
1055
+ /** Number of decimal places. */
1056
+ decimals: number;
1057
+ /** Enable permanent delegate extension (SSS-2). */
1058
+ enablePermanentDelegate: boolean;
1059
+ /** Enable transfer hook extension (SSS-2). */
1060
+ enableTransferHook: boolean;
1061
+ /** Freeze new accounts by default. */
1062
+ defaultAccountFrozen: boolean;
1063
+ /** Transfer hook program ID (required if enableTransferHook=true). */
1064
+ hookProgramId?: PublicKey;
1065
+ /** Enable confidential transfers (SSS-3). */
1066
+ enableConfidentialTransfers?: boolean;
1067
+ /** Enable allowlist-based access control (SSS-3). */
1068
+ enableAllowlist?: boolean;
1069
+ /**
1070
+ * How the mint enforces compliance (default `ComplianceMode.Hook`, the pre-S6 behavior). `Acl` and `Both` need
1071
+ * `defaultAccountFrozen`; `Acl` takes no hook and `Both` requires it. Call `enable_token_acl` after initialize.
1072
+ */
1073
+ complianceMode?: ComplianceMode;
1074
+ }
1075
+ /**
1076
+ * Arguments for updating a minter's quota.
1077
+ */
1078
+ interface UpdateMinterArgs {
1079
+ /** The minter's public key. */
1080
+ minter: PublicKey;
1081
+ /** Maximum mint amount per period. */
1082
+ limit: BN;
1083
+ /** The quota period. */
1084
+ period: QuotaPeriod;
1085
+ }
1086
+ /**
1087
+ * Arguments for granting/revoking a role.
1088
+ */
1089
+ interface UpdateRolesArgs {
1090
+ /** The key to grant/revoke the role for. */
1091
+ holder: PublicKey;
1092
+ /** The role type. */
1093
+ role: RoleType;
1094
+ /** Whether to activate or deactivate. */
1095
+ active: boolean;
1096
+ }
1097
+ /**
1098
+ * Arguments for adding a wallet to the blacklist.
1099
+ */
1100
+ interface AddToBlacklistArgs {
1101
+ /** The wallet to blacklist. */
1102
+ target: PublicKey;
1103
+ /** Human-readable reason (max 200 chars). */
1104
+ reason: string;
1105
+ }
1106
+ /**
1107
+ * Configuration for initializing the SDK client.
1108
+ */
1109
+ interface SSSClientConfig {
1110
+ /** Solana RPC endpoint URL. */
1111
+ rpcUrl: string;
1112
+ /** Commitment level for transactions. */
1113
+ commitment?: "processed" | "confirmed" | "finalized";
1114
+ /** Whether to skip preflight checks. */
1115
+ skipPreflight?: boolean;
1116
+ /** SSS-Token program ID (default: the devnet deployment, `SSS_TOKEN_PROGRAM_ID`). */
1117
+ programId?: PublicKey;
1118
+ /** Transfer Hook program ID (default: the devnet deployment, `TRANSFER_HOOK_PROGRAM_ID`). */
1119
+ hookProgramId?: PublicKey;
1120
+ /** ThawGate gate program ID (default: the devnet deployment, `THAWGATE_GATE_PROGRAM_ID`). */
1121
+ gateProgramId?: PublicKey;
1122
+ }
1123
+ /**
1124
+ * Result type for SDK operations that submit transactions.
1125
+ */
1126
+ interface TransactionResult {
1127
+ /** The transaction signature. */
1128
+ signature: string;
1129
+ /** The slot the transaction was confirmed in. */
1130
+ slot?: number;
1131
+ /** Any useful data returned from the transaction. */
1132
+ data?: Record<string, unknown>;
1133
+ }
1134
+ /**
1135
+ * Options for transaction submission.
1136
+ */
1137
+ interface TransactionOptions {
1138
+ /** Whether to skip preflight simulation. */
1139
+ skipPreflight?: boolean;
1140
+ /** Maximum retries for transaction confirmation. */
1141
+ maxRetries?: number;
1142
+ /** Additional signers beyond the payer. */
1143
+ additionalSigners?: unknown[];
1144
+ }
1145
+ /**
1146
+ * Event emitted when a stablecoin is initialized.
1147
+ */
1148
+ interface StablecoinInitializedEvent {
1149
+ mint: PublicKey;
1150
+ authority: PublicKey;
1151
+ name: string;
1152
+ symbol: string;
1153
+ decimals: number;
1154
+ enablePermanentDelegate: boolean;
1155
+ enableTransferHook: boolean;
1156
+ defaultAccountFrozen: boolean;
1157
+ timestamp: BN;
1158
+ }
1159
+ /**
1160
+ * Event emitted when authority is transferred.
1161
+ */
1162
+ interface AuthorityTransferredEvent {
1163
+ mint: PublicKey;
1164
+ oldAuthority: PublicKey;
1165
+ newAuthority: PublicKey;
1166
+ timestamp: BN;
1167
+ }
1168
+ /**
1169
+ * Event emitted when tokens are seized.
1170
+ */
1171
+ interface TokensSeizedEvent {
1172
+ mint: PublicKey;
1173
+ source: PublicKey;
1174
+ treasury: PublicKey;
1175
+ amount: BN;
1176
+ seizer: PublicKey;
1177
+ timestamp: BN;
1178
+ }
1179
+
1180
+ /**
1181
+ * @module modules/compliance
1182
+ * @description ComplianceModule class for SSS-2 compliance operations.
1183
+ *
1184
+ * Provides blacklist management and token seizure capabilities.
1185
+ * All methods are feature-gated — they throw FeatureNotEnabledError
1186
+ * if the stablecoin was not initialized with SSS-2 features.
1187
+ */
1188
+
1189
+ /**
1190
+ * ComplianceModule — SSS-2 compliance operations.
1191
+ *
1192
+ * Encapsulates blacklist and seizure operations. Validates that the
1193
+ * stablecoin has SSS-2 features enabled before executing.
1194
+ *
1195
+ * @example
1196
+ * ```ts
1197
+ * const compliance = new ComplianceModule(program, mint, config);
1198
+ *
1199
+ * // Add to blacklist
1200
+ * const ixs = await compliance.addToBlacklist(operator, target, "OFAC sanctioned");
1201
+ *
1202
+ * // Seize tokens
1203
+ * const seizeIxs = await compliance.seize(seizer, sourceTokenAccount, treasury);
1204
+ * ```
1205
+ */
1206
+ declare class ComplianceModule {
1207
+ private readonly program;
1208
+ private readonly mint;
1209
+ private readonly programId;
1210
+ constructor(program: Program, mint: PublicKey);
1211
+ /**
1212
+ * Adds an address to the blacklist and freezes their token account.
1213
+ *
1214
+ * @param operator - The Blacklister operator's public key
1215
+ * @param target - The wallet to blacklist
1216
+ * @param reason - Human-readable reason (max 200 chars)
1217
+ * @param opts.targetTokenAccount - The target's token account to pass (default: its ATA). sss-token requires an
1218
+ * account owned by `target` (S9); on Token ACL mints it is frozen in the same transaction if thawed.
1219
+ * @returns Transaction instructions
1220
+ * @throws FeatureNotEnabledError if transfer_hook is not enabled
1221
+ */
1222
+ addToBlacklist(operator: PublicKey, target: PublicKey, reason: string, opts?: {
1223
+ targetTokenAccount?: PublicKey;
1224
+ }): Promise<TransactionInstruction[]>;
1225
+ /**
1226
+ * Removes an address from the blacklist.
1227
+ *
1228
+ * Does NOT automatically thaw the account — call thawAccount separately.
1229
+ *
1230
+ * @param operator - The Blacklister operator's public key
1231
+ * @param target - The wallet to remove from blacklist
1232
+ * @returns Transaction instructions
1233
+ */
1234
+ removeFromBlacklist(operator: PublicKey, target: PublicKey): Promise<TransactionInstruction[]>;
1235
+ /**
1236
+ * Adds a wallet to the issuer allowlist (`add_to_allowlist_v3`, MasterAuthority). Needs a mint initialized with
1237
+ * `enableAllowlist`; a ThawGate `allowOnly` or `bypassForPdas` policy reads the entry.
1238
+ */
1239
+ addToAllowlist(authority: PublicKey, wallet: PublicKey): Promise<TransactionInstruction[]>;
1240
+ /** Deactivates a wallet's allowlist entry (`remove_from_allowlist_v3`, MasterAuthority). */
1241
+ removeFromAllowlist(authority: PublicKey, wallet: PublicKey): Promise<TransactionInstruction[]>;
1242
+ private allowlistIx;
1243
+ /**
1244
+ * Seizes all tokens from a frozen, blacklisted account.
1245
+ *
1246
+ * Requires both enable_transfer_hook and enable_permanent_delegate.
1247
+ *
1248
+ * @param seizer - The Seizer operator's public key
1249
+ * @param sourceAuthority - The owner of the source token account
1250
+ * @param sourceTokenAccount - The frozen token account to seize from
1251
+ * @param treasuryTokenAccount - The treasury to receive seized tokens
1252
+ * @returns Transaction instructions
1253
+ */
1254
+ seize(seizer: PublicKey, sourceAuthority: PublicKey, sourceTokenAccount: PublicKey, treasuryTokenAccount: PublicKey, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction[]>;
1255
+ /**
1256
+ * Fetches a blacklist entry for a given target.
1257
+ *
1258
+ * @param target - The wallet to check
1259
+ * @returns The BlacklistEntry or null if not found
1260
+ */
1261
+ getBlacklistEntry(target: PublicKey): Promise<BlacklistEntry | null>;
1262
+ /**
1263
+ * Checks if a wallet is currently blacklisted.
1264
+ *
1265
+ * @param target - The wallet to check
1266
+ * @returns true if actively blacklisted
1267
+ */
1268
+ isBlacklisted(target: PublicKey): Promise<boolean>;
1269
+ }
1270
+
1271
+ /**
1272
+ * @module modules/privacy
1273
+ * @description Privacy module placeholder for SSS-3 (confidential transfers).
1274
+ *
1275
+ * SSS-3 will leverage SPL Confidential Transfer extension
1276
+ * for zero-knowledge proof-based privacy-preserving transfers.
1277
+ *
1278
+ * This module is a placeholder for future implementation.
1279
+ */
1280
+
1281
+ /**
1282
+ * PrivacyModule — SSS-3 confidential transfer operations (placeholder).
1283
+ *
1284
+ * @remarks
1285
+ * This module will be implemented when SPL Confidential Transfer
1286
+ * extension support is mature and audited.
1287
+ */
1288
+ declare class PrivacyModule {
1289
+ private readonly mint;
1290
+ constructor(mint: PublicKey);
1291
+ /**
1292
+ * Initializes confidential transfer extension for the mint.
1293
+ * @throws FeatureNotEnabledError — SSS-3 is not yet implemented
1294
+ */
1295
+ initializeConfidentialTransfer(): Promise<never>;
1296
+ /**
1297
+ * Creates a confidential transfer.
1298
+ * @throws FeatureNotEnabledError — SSS-3 is not yet implemented
1299
+ */
1300
+ confidentialTransfer(): Promise<never>;
1301
+ /**
1302
+ * Retrieves the confidential balance of a token account.
1303
+ * @throws FeatureNotEnabledError — SSS-3 is not yet implemented
1304
+ */
1305
+ getConfidentialBalance(): Promise<never>;
1306
+ }
1307
+
1308
+ /**
1309
+ * @module modules/reserves
1310
+ * @description ReservesModule: the reserve attestation that `mint_tokens` checks (S9).
1311
+ *
1312
+ * MasterAuthority sets the attestor and the staleness window; the attestor posts reserves. `mint_tokens` then
1313
+ * refuses a mint when `mint.supply + amount > reserves` (ReserveInsufficient) or `now - asOf > maxStaleness`
1314
+ * (ReserveStale). Reserves are in the mint's base units (1.00 of a 6-decimal coin = 1_000_000).
1315
+ * Acl/Both mode mints need an attestation to mint at all; Hook mode mints are checked once one exists.
1316
+ */
1317
+
1318
+ /** On-chain `ReserveAttestation` (PDA `["reserve_attestation", mint]`). */
1319
+ interface ReserveAttestation {
1320
+ mint: PublicKey;
1321
+ attestor: PublicKey;
1322
+ /** Base units of the mint. */
1323
+ reserves: BN;
1324
+ /** Unix seconds at which the reserves were measured; 0 until the first post. */
1325
+ asOf: BN;
1326
+ /** Seconds after `asOf` during which minting may rely on the attestation. */
1327
+ maxStaleness: BN;
1328
+ reportUri: string;
1329
+ /** Cluster time of the last post; 0 until the first post. */
1330
+ postedAt: BN;
1331
+ bump: number;
1332
+ }
1333
+ /**
1334
+ * @example
1335
+ * ```ts
1336
+ * const reserves = client.reserves(mint);
1337
+ * await reserves.setReserveAttestor(master, attestor, 86_400); // MasterAuthority
1338
+ * await reserves.attestReserves(attestor, new BN(1_000_000_000), asOf, "https://example.com/report.json");
1339
+ * ```
1340
+ */
1341
+ declare class ReservesModule {
1342
+ private readonly program;
1343
+ private readonly mint;
1344
+ private readonly programId;
1345
+ constructor(program: Program, mint: PublicKey);
1346
+ /** The mint's ReserveAttestation address. */
1347
+ address(): PublicKey;
1348
+ /**
1349
+ * Sets the attestor and the staleness window (seconds). MasterAuthority only; creates the account on first
1350
+ * use. A different attestor clears the posted reserves, so minting waits for its first post.
1351
+ */
1352
+ setReserveAttestor(authority: PublicKey, attestor: PublicKey, maxStalenessSeconds: number | BN): Promise<TransactionInstruction[]>;
1353
+ /**
1354
+ * Posts reserves (base units) measured at `asOf` (unix seconds). Signed by the attestor. `asOf` may not be in
1355
+ * the future or older than the stored one; `reportUri` is at most 200 bytes.
1356
+ */
1357
+ attestReserves(attestor: PublicKey, reserves: BN, asOf: number | BN, reportUri: string): Promise<TransactionInstruction[]>;
1358
+ /** The mint's attestation, or null if MasterAuthority never set an attestor. */
1359
+ fetch(): Promise<ReserveAttestation | null>;
1360
+ }
1361
+
1362
+ /**
1363
+ * @module client
1364
+ * @description SolanaStablecoin — the main SDK entrypoint class.
1365
+ *
1366
+ * Provides a high-level, ergonomic API for interacting with SSS stablecoins.
1367
+ * Wraps all base operations, role management, and compliance modules.
1368
+ *
1369
+ * @example
1370
+ * ```ts
1371
+ * import { SolanaStablecoin, sss1Preset } from "@thawgate/sdk";
1372
+ *
1373
+ * const client = SolanaStablecoin.fromConfig({
1374
+ * rpcUrl: "https://api.devnet.solana.com",
1375
+ * programId: new PublicKey("..."),
1376
+ * });
1377
+ *
1378
+ * // Initialize a new SSS-1 stablecoin
1379
+ * const { instructions, mint } = await client.initialize(
1380
+ * authority.publicKey,
1381
+ * sss1Preset("USD Stablecoin", "USDS", "https://meta.example.com", 6),
1382
+ * );
1383
+ * ```
1384
+ */
1385
+
1386
+ type Amount = BN | bigint | number | string;
1387
+ /** Options for {@link SolanaStablecoin.createStablecoin}. Amounts are base units (10^decimals per token). */
1388
+ interface CreateStablecoinOptions {
1389
+ name: string;
1390
+ symbol: string;
1391
+ uri?: string;
1392
+ /** Default 6. */
1393
+ decimals?: number;
1394
+ /** The ThawGate policy. `issuerProgram` and `authority` are set by sss-token (itself, and the issuer's wallet). */
1395
+ policy: PolicyInput;
1396
+ reserves: {
1397
+ /** Reserves to post now, in base units: the supply can't exceed it. */
1398
+ amount: Amount;
1399
+ /** Link to the reserve report (at most 200 bytes). */
1400
+ reportUri: string;
1401
+ /** How old a post may be before minting stops. Default 86,400 s (1 day). */
1402
+ maxStalenessSeconds?: number;
1403
+ /** Who posts reserves. Default: the wallet, which then posts `amount` now; another attestor posts later. */
1404
+ attestor?: PublicKey;
1405
+ };
1406
+ /** The Minter role and quota; default the wallet with quota = reserves, lifetime. `false` grants none. */
1407
+ minter?: {
1408
+ address?: PublicKey;
1409
+ quota?: Amount;
1410
+ period?: QuotaPeriod;
1411
+ } | false;
1412
+ /** Create the mint with the sss-token allowlist on. Default: on when the policy's allowlistMode isn't "off". */
1413
+ enableAllowlist?: boolean;
1414
+ /** The mint's keypair (vanity addresses); generated by default. */
1415
+ mintKeypair?: Keypair;
1416
+ }
1417
+ interface CreatedStablecoin {
1418
+ mint: PublicKey;
1419
+ signatures: {
1420
+ initialize: string;
1421
+ enableTokenAcl: string;
1422
+ setup: string;
1423
+ };
1424
+ }
1425
+ /** Options for {@link SolanaStablecoin.initializeStablecoin}: the mint part of {@link CreateStablecoinOptions}. */
1426
+ type InitializeStablecoinOptions = Pick<CreateStablecoinOptions, "name" | "symbol" | "uri" | "decimals" | "enableAllowlist" | "mintKeypair">;
1427
+ /** Options for {@link SolanaStablecoin.setupMinting}: the reserves and minter part of {@link CreateStablecoinOptions}. */
1428
+ type SetupMintingOptions = Pick<CreateStablecoinOptions, "reserves" | "minter">;
1429
+ /**
1430
+ * SolanaStablecoin — main SDK class.
1431
+ *
1432
+ * Acts as a facade over all SSS operations. Provides both
1433
+ * instruction builders (for composability) and convenience
1434
+ * methods for common workflows.
1435
+ */
1436
+ declare class SolanaStablecoin {
1437
+ /** The Anchor program instance. */
1438
+ readonly program: Program;
1439
+ /** The Solana connection. */
1440
+ readonly connection: Connection;
1441
+ /** The SSS-Token program ID. */
1442
+ readonly programId: PublicKey;
1443
+ /** The transfer hook program ID. */
1444
+ readonly hookProgramId: PublicKey;
1445
+ /** The signing wallet, if the client was created with one. */
1446
+ readonly wallet?: AnchorProvider["wallet"];
1447
+ /** ThawGate policies and holder flows (unlock, explain, freeze-if-invalid) for this client's mints. */
1448
+ readonly gate: GateClient;
1449
+ private constructor();
1450
+ /**
1451
+ * Creates a new SolanaStablecoin instance.
1452
+ *
1453
+ * Primary static factory method as required by the SSS PRD specification.
1454
+ * Accepts a Connection object directly (PRD pattern) or creates one from config.rpcUrl.
1455
+ *
1456
+ * @param connectionOrConfig - A Solana Connection, or SSSClientConfig
1457
+ * @param configOrWallet - SSSClientConfig if first arg is Connection, or wallet
1458
+ * @param wallet - Anchor wallet (optional for read-only)
1459
+ * @returns A new SolanaStablecoin instance
1460
+ */
1461
+ static create(connectionOrConfig: Connection | SSSClientConfig, configOrWallet?: SSSClientConfig | AnchorProvider["wallet"], wallet?: AnchorProvider["wallet"]): Promise<SolanaStablecoin>;
1462
+ /**
1463
+ * Creates a new SolanaStablecoin instance from configuration.
1464
+ *
1465
+ * Alias for {@link SolanaStablecoin.create} — kept for backward compatibility.
1466
+ *
1467
+ * @param config - Client configuration
1468
+ * @param walletOrKeypair - Anchor wallet or a Keypair (optional for read-only)
1469
+ * @returns A new SolanaStablecoin instance
1470
+ */
1471
+ static fromConfig(config: SSSClientConfig, walletOrKeypair?: AnchorProvider["wallet"] | Keypair): SolanaStablecoin;
1472
+ private requireWallet;
1473
+ /**
1474
+ * sss-token `enable_token_acl`: creates the mint's Token ACL config (gate = ThawGate, permissionless thaw and
1475
+ * freeze on) and its ThawGate policy, with the issuer's master authority as policy authority and sss-token as
1476
+ * the blacklist/allowlist program. MasterAuthority only.
1477
+ */
1478
+ enableTokenAcl(mint: PublicKey, policy: PolicyInput, authority?: PublicKey): Promise<TransactionInstruction[]>;
1479
+ /**
1480
+ * Creates an SSS-ACL stablecoin gated by ThawGate, ready to mint, in three transactions:
1481
+ * 1. `initialize` with the SSS-ACL preset (accounts start frozen);
1482
+ * 2. `enable_token_acl` with `policy`;
1483
+ * 3. the minter role and quota, the reserve attestor, and (when the wallet is the attestor) a first reserve post.
1484
+ *
1485
+ * The wallet becomes MasterAuthority and the policy authority. Minting needs reserves: every `mint_tokens`
1486
+ * checks `supply + amount <= reserves` and that the post is fresher than `maxStalenessSeconds`.
1487
+ */
1488
+ createStablecoin(opts: CreateStablecoinOptions): Promise<CreatedStablecoin>;
1489
+ /** createStablecoin's 1st transaction: `initialize` with the SSS-ACL preset (accounts start frozen). Allowlist off by default. */
1490
+ initializeStablecoin(opts: InitializeStablecoinOptions): Promise<{
1491
+ mint: PublicKey;
1492
+ signature: string;
1493
+ }>;
1494
+ /** createStablecoin's 2nd transaction: `enable_token_acl` with `policy`, sent with the compute budget it needs. */
1495
+ sendEnableTokenAcl(mint: PublicKey, policy: PolicyInput): Promise<string>;
1496
+ /**
1497
+ * createStablecoin's 3rd transaction: the minter role and quota, the reserve attestor, and (when the wallet is the
1498
+ * attestor) a first reserve post.
1499
+ */
1500
+ setupMinting(mint: PublicKey, opts: SetupMintingOptions): Promise<string>;
1501
+ /**
1502
+ * The cluster's unix time (Clock sysvar). Reserve posts must use it: `attest_reserves` refuses an `as_of` in the
1503
+ * future, and a local clock can run ahead of the cluster.
1504
+ */
1505
+ clusterTime(): Promise<number>;
1506
+ /** Sign with the client's wallet (plus `signers`), send, and confirm. Returns the signature. */
1507
+ send(instructions: TransactionInstruction[], signers?: Signer[]): Promise<string>;
1508
+ /**
1509
+ * Initializes a new stablecoin.
1510
+ *
1511
+ * @param authority - The authority's public key (becomes MasterAuthority)
1512
+ * @param args - Initialization arguments (use sss1Preset or sss2Preset)
1513
+ * @param mintKeypair - Optional mint keypair (generated if not provided)
1514
+ */
1515
+ initialize(authority: PublicKey, args: InitializeArgs, mintKeypair?: Keypair): Promise<{
1516
+ instructions: TransactionInstruction[];
1517
+ mint: PublicKey;
1518
+ mintKeypair: Keypair;
1519
+ }>;
1520
+ /**
1521
+ * Mints tokens to a recipient.
1522
+ */
1523
+ mintTokens(mint: PublicKey, minter: PublicKey, recipient: PublicKey, amount: BN): Promise<TransactionInstruction[]>;
1524
+ /**
1525
+ * Burns tokens from the burner's account.
1526
+ */
1527
+ burnTokens(mint: PublicKey, burner: PublicKey, amount: BN): Promise<TransactionInstruction[]>;
1528
+ /**
1529
+ * Freezes a target token account.
1530
+ */
1531
+ freezeAccount(mint: PublicKey, operator: PublicKey, targetTokenAccount: PublicKey, operatorRole?: RoleType.MasterAuthority | RoleType.Blacklister): Promise<TransactionInstruction[]>;
1532
+ /**
1533
+ * Thaws a frozen token account.
1534
+ */
1535
+ thawAccount(mint: PublicKey, operator: PublicKey, targetTokenAccount: PublicKey, operatorRole?: RoleType.MasterAuthority | RoleType.Blacklister): Promise<TransactionInstruction[]>;
1536
+ /**
1537
+ * Pauses all token operations.
1538
+ */
1539
+ pause(mint: PublicKey, operator: PublicKey, operatorRole?: RoleType.Pauser | RoleType.MasterAuthority): Promise<TransactionInstruction[]>;
1540
+ /**
1541
+ * Resumes all token operations.
1542
+ */
1543
+ unpause(mint: PublicKey, operator: PublicKey, operatorRole?: RoleType.Pauser | RoleType.MasterAuthority): Promise<TransactionInstruction[]>;
1544
+ /**
1545
+ * Creates or updates a minter with a quota.
1546
+ */
1547
+ updateMinter(mint: PublicKey, authority: PublicKey, minter: PublicKey, limit: BN, period: QuotaPeriod): Promise<TransactionInstruction[]>;
1548
+ /**
1549
+ * Creates or updates a role for a given key.
1550
+ */
1551
+ updateRoles(mint: PublicKey, authority: PublicKey, holder: PublicKey, role: RoleType, active: boolean): Promise<TransactionInstruction[]>;
1552
+ /**
1553
+ * Transfers MasterAuthority to a new key.
1554
+ */
1555
+ transferAuthority(mint: PublicKey, authority: PublicKey, newAuthority: PublicKey): Promise<TransactionInstruction[]>;
1556
+ /**
1557
+ * Returns a ComplianceModule for SSS-2 operations on a specific mint.
1558
+ */
1559
+ compliance(mint: PublicKey): ComplianceModule;
1560
+ /**
1561
+ * Returns a PrivacyModule for SSS-3 operations on a specific mint.
1562
+ */
1563
+ privacy(mint: PublicKey): PrivacyModule;
1564
+ /**
1565
+ * Returns a ReservesModule for the reserve attestation that `mint_tokens` checks.
1566
+ */
1567
+ reserves(mint: PublicKey): ReservesModule;
1568
+ /**
1569
+ * Typed account fetch helper.
1570
+ * Wraps Anchor's program.account access with proper typing.
1571
+ */
1572
+ private fetchAccount;
1573
+ /**
1574
+ * Fetches the StablecoinConfig for a mint.
1575
+ */
1576
+ getConfig(mint: PublicKey): Promise<StablecoinConfig>;
1577
+ /**
1578
+ * Fetches the PauseState for a mint.
1579
+ */
1580
+ getPauseState(mint: PublicKey): Promise<PauseState>;
1581
+ /**
1582
+ * Fetches a role record for a given holder and role.
1583
+ */
1584
+ getRoleRecord(mint: PublicKey, holder: PublicKey, role: RoleType): Promise<RoleRecord | null>;
1585
+ /**
1586
+ * Fetches a minter's quota.
1587
+ */
1588
+ getMinterQuota(mint: PublicKey, minter: PublicKey): Promise<MinterQuota | null>;
1589
+ /**
1590
+ * Checks if a wallet has a specific active role.
1591
+ */
1592
+ hasRole(mint: PublicKey, holder: PublicKey, role: RoleType): Promise<boolean>;
1593
+ /**
1594
+ * Checks if the token is currently paused.
1595
+ */
1596
+ isPaused(mint: PublicKey): Promise<boolean>;
1597
+ }
1598
+
1599
+ /**
1600
+ * @module wallet
1601
+ * @description An Anchor-style wallet from a Keypair, for scripts and servers (browser apps pass their wallet adapter).
1602
+ */
1603
+
1604
+ interface KeypairWallet {
1605
+ publicKey: Keypair["publicKey"];
1606
+ payer: Keypair;
1607
+ signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
1608
+ signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
1609
+ }
1610
+ declare function keypairWallet(keypair: Keypair): KeypairWallet;
1611
+
1612
+ /**
1613
+ * @module sas
1614
+ * @description Solana Attestation Service (SAS) instructions on @solana/web3.js v1: credentials, schemas and
1615
+ * attestations, enough to issue the KYC credential a ThawGate policy checks.
1616
+ *
1617
+ * Hand-built from sas-lib 1.0.10's generated code (sas-lib is @solana/kit-based); tests/sas.test.ts pins each builder
1618
+ * byte-for-byte against it.
1619
+ *
1620
+ * A credential you create yourself is a **self-issued test credential**: it proves the flow, not anyone's identity.
1621
+ * In production the policy names a KYC provider's credential and schema, and the provider issues attestations.
1622
+ */
1623
+
1624
+ declare const SAS_IX: {
1625
+ readonly createCredential: 0;
1626
+ readonly createSchema: 1;
1627
+ readonly createAttestation: 6;
1628
+ readonly closeAttestation: 7;
1629
+ };
1630
+ /** `["credential", authority, name]`. */
1631
+ declare function findCredentialPda(authority: PublicKey, name: string): PublicKey;
1632
+ /** `["schema", credential, name, version]`. A new schema is version 1. */
1633
+ declare function findSchemaPda(credential: PublicKey, name: string, version?: number): PublicKey;
1634
+ /** `["attestation", credential, schema, nonce]`. ThawGate policies use `nonce = the holder's wallet`. */
1635
+ declare function findAttestationPda(credential: PublicKey, schema: PublicKey, nonce: PublicKey): PublicKey;
1636
+ /** SAS's event authority, `["__event_authority"]`: `close_attestation` emits its event through it. */
1637
+ declare const SAS_EVENT_AUTHORITY: PublicKey;
1638
+ /** A credential: `authority` and the `signers` may issue attestations under it. Returns the instruction and its PDA. */
1639
+ declare function createCredentialIx(args: {
1640
+ payer: PublicKey;
1641
+ authority: PublicKey;
1642
+ name: string;
1643
+ signers?: PublicKey[];
1644
+ }): {
1645
+ instruction: TransactionInstruction;
1646
+ credential: PublicKey;
1647
+ };
1648
+ /** A schema under a credential. `layout` holds SAS compact type codes (0 = u8, 12 = String, …), one per field. */
1649
+ declare function createSchemaIx(args: {
1650
+ payer: PublicKey;
1651
+ authority: PublicKey;
1652
+ credential: PublicKey;
1653
+ name: string;
1654
+ description: string;
1655
+ layout: number[];
1656
+ fieldNames: string[];
1657
+ }): {
1658
+ instruction: TransactionInstruction;
1659
+ schema: PublicKey;
1660
+ };
1661
+ /**
1662
+ * An attestation of `data` (encoded to the schema's layout) for `nonce`. `expiry` is a unix timestamp; 0 = never.
1663
+ * `authority` must be one of the credential's signers.
1664
+ */
1665
+ declare function createAttestationIx(args: {
1666
+ payer: PublicKey;
1667
+ authority: PublicKey;
1668
+ credential: PublicKey;
1669
+ schema: PublicKey;
1670
+ nonce: PublicKey;
1671
+ data: Uint8Array;
1672
+ expiry: number | bigint;
1673
+ }): {
1674
+ instruction: TransactionInstruction;
1675
+ attestation: PublicKey;
1676
+ };
1677
+ /** Close (revoke) an attestation; the rent goes to `payer`. Under a ThawGate SAS policy the holder becomes freezable. */
1678
+ declare function closeAttestationIx(args: {
1679
+ payer: PublicKey;
1680
+ authority: PublicKey;
1681
+ credential: PublicKey;
1682
+ attestation: PublicKey;
1683
+ }): TransactionInstruction;
1684
+ /**
1685
+ * The KYC schema layout ThawGate reads: `kyc_level: u8` must come first (the gate reads it at a fixed offset when the
1686
+ * policy sets `min_kyc_level`), then `country: String`.
1687
+ */
1688
+ declare const KYC_SCHEMA: {
1689
+ readonly layout: readonly [0, 12];
1690
+ readonly fieldNames: readonly ["kyc_level", "country"];
1691
+ };
1692
+ /** Attestation data for {@link KYC_SCHEMA}: u8 kyc_level, then u32-length-prefixed UTF-8 country. */
1693
+ declare function encodeKycData(args: {
1694
+ kycLevel: number;
1695
+ country: string;
1696
+ }): Uint8Array;
1697
+
1698
+ declare const index_KYC_SCHEMA: typeof KYC_SCHEMA;
1699
+ declare const index_SAS_EVENT_AUTHORITY: typeof SAS_EVENT_AUTHORITY;
1700
+ declare const index_SAS_IX: typeof SAS_IX;
1701
+ declare const index_closeAttestationIx: typeof closeAttestationIx;
1702
+ declare const index_createAttestationIx: typeof createAttestationIx;
1703
+ declare const index_createCredentialIx: typeof createCredentialIx;
1704
+ declare const index_createSchemaIx: typeof createSchemaIx;
1705
+ declare const index_encodeKycData: typeof encodeKycData;
1706
+ declare const index_findAttestationPda: typeof findAttestationPda;
1707
+ declare const index_findCredentialPda: typeof findCredentialPda;
1708
+ declare const index_findSchemaPda: typeof findSchemaPda;
1709
+ declare namespace index {
1710
+ export { index_KYC_SCHEMA as KYC_SCHEMA, index_SAS_EVENT_AUTHORITY as SAS_EVENT_AUTHORITY, index_SAS_IX as SAS_IX, index_closeAttestationIx as closeAttestationIx, index_createAttestationIx as createAttestationIx, index_createCredentialIx as createCredentialIx, index_createSchemaIx as createSchemaIx, index_encodeKycData as encodeKycData, index_findAttestationPda as findAttestationPda, index_findCredentialPda as findCredentialPda, index_findSchemaPda as findSchemaPda };
1711
+ }
1712
+
1713
+ /**
1714
+ * @module programs
1715
+ * @description Program IDs the SDK talks to. ThawGate's own programs are deployed on devnet (localnet uses the same
1716
+ * IDs); Token ACL, SAS and the ABL gate are the upstream deployments, the same address on devnet and mainnet.
1717
+ */
1718
+
1719
+ /** sss-token, the example issuer (devnet). */
1720
+ declare const SSS_TOKEN_PROGRAM_ID: PublicKey;
1721
+ /** The SSS transfer hook (devnet). Used by SSS-2 and Both mints only. */
1722
+ declare const TRANSFER_HOOK_PROGRAM_ID: PublicKey;
1723
+ /** The ThawGate gating program (devnet; unaudited, never deployed to mainnet). */
1724
+ declare const THAWGATE_GATE_PROGRAM_ID: PublicKey;
1725
+ /** Token ACL (sRFC 37). */
1726
+ declare const TOKEN_ACL_PROGRAM_ID: PublicKey;
1727
+ /** Solana Attestation Service. */
1728
+ declare const SAS_PROGRAM_ID: PublicKey;
1729
+ /** Token ACL's reference allow/block-list gate (ABL). */
1730
+ declare const ABL_GATE_PROGRAM_ID: PublicKey;
1731
+
1732
+ /**
1733
+ * @module errors
1734
+ * @description Error class hierarchy for the SSS SDK.
1735
+ *
1736
+ * Maps on-chain Anchor error codes to typed JavaScript errors. The code → name → message tables come from the
1737
+ * programs' IDLs (`src/idl.json`, `src/gate/idl.json`), which CI compares byte for byte with its own `anchor build`.
1738
+ */
1739
+ /**
1740
+ * Base error class for all SSS SDK errors.
1741
+ */
1742
+ declare class SSSError extends Error {
1743
+ /** The Anchor error code (if from on-chain). */
1744
+ readonly code?: number;
1745
+ /** The original error that caused this one. */
1746
+ readonly cause?: Error;
1747
+ /** The program's name for the error, from its IDL (e.g. `"ReserveInsufficient"`), when a program raised it. */
1748
+ readonly errorName?: string;
1749
+ /** The program that raised it (base58), when known. */
1750
+ readonly program?: string;
1751
+ constructor(message: string, code?: number, cause?: Error);
1752
+ /**
1753
+ * Alias for `code` — spec requires the field to be named `errorCode`.
1754
+ * LOW-002: added getter for spec API surface compatibility.
1755
+ */
1756
+ get errorCode(): number | undefined;
1757
+ }
1758
+ /**
1759
+ * Error thrown when a transaction fails on-chain.
1760
+ */
1761
+ declare class TransactionError extends SSSError {
1762
+ /** The transaction signature (if available). */
1763
+ readonly signature?: string;
1764
+ /** The transaction logs (if available). */
1765
+ readonly logs?: string[];
1766
+ constructor(message: string, code?: number, signature?: string, logs?: string[]);
1767
+ }
1768
+ /**
1769
+ * Error thrown when authorization/permission checks fail.
1770
+ */
1771
+ declare class AuthorizationError extends SSSError {
1772
+ constructor(message: string, code?: number);
1773
+ }
1774
+ /**
1775
+ * Error thrown when the token is paused and the operation is blocked.
1776
+ */
1777
+ declare class TokenPausedError extends SSSError {
1778
+ constructor(message?: string);
1779
+ }
1780
+ /**
1781
+ * Error thrown when a feature is not enabled (e.g., SSS-2 operations on SSS-1).
1782
+ */
1783
+ declare class FeatureNotEnabledError extends SSSError {
1784
+ constructor(feature: string);
1785
+ }
1786
+ /**
1787
+ * Error thrown when an account is blacklisted.
1788
+ */
1789
+ declare class BlacklistedError extends SSSError {
1790
+ constructor(address: string);
1791
+ }
1792
+ /**
1793
+ * Error thrown when a minter exceeds their quota.
1794
+ */
1795
+ declare class QuotaExceededError extends SSSError {
1796
+ /** The current quota limit. */
1797
+ readonly limit: bigint;
1798
+ /** The amount already used. */
1799
+ readonly used: bigint;
1800
+ /** The amount that was attempted. */
1801
+ readonly attempted: bigint;
1802
+ /** `message` replaces the default text, e.g. when the amounts aren't known (a program error). */
1803
+ constructor(limit: bigint, used: bigint, attempted: bigint, message?: string);
1804
+ }
1805
+ /**
1806
+ * Error thrown for invalid configuration or arguments.
1807
+ */
1808
+ declare class ConfigError extends SSSError {
1809
+ constructor(message: string);
1810
+ }
1811
+ /**
1812
+ * Error thrown when an account is not found on-chain.
1813
+ */
1814
+ declare class AccountNotFoundError extends SSSError {
1815
+ constructor(accountType: string, address: string);
1816
+ }
1817
+ /** One error a program declares in its IDL. */
1818
+ interface ProgramErrorInfo {
1819
+ /** The declaring program (base58, the IDL's `address`). */
1820
+ program: string;
1821
+ code: number;
1822
+ name: string;
1823
+ msg: string;
1824
+ }
1825
+ /** sss-token's errors by code, from its IDL. */
1826
+ declare const SSS_TOKEN_ERRORS: Readonly<Record<number, ProgramErrorInfo>>;
1827
+ /** The ThawGate gate's errors by code, from its IDL. */
1828
+ declare const THAWGATE_GATE_ERRORS: Readonly<Record<number, ProgramErrorInfo>>;
1829
+ /** The IDL entry for `code` raised by `program` (base58); undefined for a program or code the SDK doesn't know. */
1830
+ declare function programError(program: string, code: number): ProgramErrorInfo | undefined;
1831
+ /**
1832
+ * Parses an error from a program call into a typed SSSError.
1833
+ *
1834
+ * Reads, in order: an Anchor `AnchorError` (`error.errorCode.number` and `program`); a numeric `code` (Anchor's
1835
+ * `ProgramError`, raised by the SDK's sss-token calls); the transaction logs (`logs`, as on web3.js's
1836
+ * `SendTransactionError` from `client.send`). Codes are looked up in the raising program's IDL; a program the SDK
1837
+ * doesn't know (Token-2022, Token ACL, …) is left unmapped. A code without a program is read as sss-token's.
1838
+ *
1839
+ * @param error - The raw error from Anchor/web3.js
1840
+ * @returns A typed SSSError instance
1841
+ */
1842
+ declare function parseError(error: unknown): SSSError;
1843
+ /**
1844
+ * @spec SssError — base error class alias required by the SSS spec.
1845
+ */
1846
+ declare class SssError extends SSSError {
1847
+ constructor(message: string, code?: number, cause?: Error);
1848
+ }
1849
+ /**
1850
+ * @spec SssInitError — initialization error class required by the SSS spec.
1851
+ * Maps to TransactionError for initialization transactions.
1852
+ */
1853
+ declare class SssInitError extends SSSError {
1854
+ constructor(message: string, cause?: Error);
1855
+ }
1856
+ /**
1857
+ * @spec SssMintError — minting error class required by the SSS spec.
1858
+ * Maps to QuotaExceededError and related mint errors.
1859
+ */
1860
+ declare class SssMintError extends SSSError {
1861
+ constructor(message: string, cause?: Error);
1862
+ }
1863
+ /**
1864
+ * @spec SssComplianceError — compliance error class required by the SSS spec.
1865
+ * Maps to BlacklistedError and related compliance errors.
1866
+ */
1867
+ declare class SssComplianceError extends SSSError {
1868
+ constructor(message: string, cause?: Error);
1869
+ }
1870
+ /**
1871
+ * @spec SssRpcError — network/RPC error class required by the SSS spec.
1872
+ * Maps to TransactionError for network-level failures.
1873
+ */
1874
+ declare class SssRpcError extends SSSError {
1875
+ constructor(message: string, cause?: Error);
1876
+ }
1877
+
1878
+ /**
1879
+ * @module presets/sssAcl
1880
+ * @description SSS-ACL preset — a Token ACL (sRFC 37) stablecoin gated by ThawGate. The default for new mints.
1881
+ *
1882
+ * Accounts start frozen (DefaultAccountState) and holders thaw themselves through the ThawGate gate, which checks
1883
+ * the issuer's blacklist/allowlist and, optionally, a SAS KYC credential once per account. Transfers carry no
1884
+ * transfer hook. Blacklist, seize (permanent delegate) and pause (Token-2022 Pausable) work through Token ACL.
1885
+ * After `initialize`, the master authority calls `enable_token_acl` to create the Token ACL config and the policy.
1886
+ */
1887
+
1888
+ /**
1889
+ * Default initialization arguments for an SSS-ACL stablecoin.
1890
+ *
1891
+ * @param name - Stablecoin name
1892
+ * @param symbol - Ticker symbol
1893
+ * @param uri - Metadata URI
1894
+ * @param decimals - Decimal places (default: 6)
1895
+ * @returns InitializeArgs configured for SSS-ACL
1896
+ */
1897
+ declare function sssAclPreset(name: string, symbol: string, uri: string, decimals?: number): InitializeArgs;
1898
+ /**
1899
+ * SSS-ACL feature flags for documentation and validation.
1900
+ */
1901
+ declare const SSS_ACL_FEATURES: {
1902
+ readonly mint: true;
1903
+ readonly burn: true;
1904
+ readonly freeze: true;
1905
+ readonly pause: true;
1906
+ readonly roles: true;
1907
+ readonly blacklist: true;
1908
+ readonly seize: true;
1909
+ readonly transferHook: false;
1910
+ readonly permanentDelegate: true;
1911
+ readonly tokenAcl: true;
1912
+ readonly defaultAccountFrozen: true;
1913
+ };
1914
+
1915
+ /**
1916
+ * @module presets/sssBoth
1917
+ * @description SSS-Both preset — Token ACL gating (see sssAcl) plus the SSS transfer hook on every transfer.
1918
+ *
1919
+ * The hook adds a per-transfer pause and blacklist check on top of the gate's per-account check at thaw. Note:
1920
+ * while the mint is paused, the hook also rejects `seize` (its PauseState check has no seize exception).
1921
+ */
1922
+
1923
+ /**
1924
+ * Default initialization arguments for an SSS-Both stablecoin.
1925
+ *
1926
+ * @param name - Stablecoin name
1927
+ * @param symbol - Ticker symbol
1928
+ * @param uri - Metadata URI
1929
+ * @param hookProgramId - The transfer hook program ID
1930
+ * @param decimals - Decimal places (default: 6)
1931
+ * @returns InitializeArgs configured for SSS-Both
1932
+ */
1933
+ declare function sssBothPreset(name: string, symbol: string, uri: string, hookProgramId: PublicKey, decimals?: number): InitializeArgs;
1934
+ /**
1935
+ * SSS-Both feature flags for documentation and validation.
1936
+ */
1937
+ declare const SSS_BOTH_FEATURES: {
1938
+ readonly mint: true;
1939
+ readonly burn: true;
1940
+ readonly freeze: true;
1941
+ readonly pause: true;
1942
+ readonly roles: true;
1943
+ readonly blacklist: true;
1944
+ readonly seize: true;
1945
+ readonly transferHook: true;
1946
+ readonly permanentDelegate: true;
1947
+ readonly tokenAcl: true;
1948
+ readonly defaultAccountFrozen: true;
1949
+ };
1950
+
1951
+ /**
1952
+ * @module presets/sss1
1953
+ * @description SSS-1 preset configuration — basic stablecoin.
1954
+ *
1955
+ * SSS-1 provides: mint, burn, freeze/thaw, pause/unpause, role management.
1956
+ * No compliance features (blacklist, seize, transfer hook).
1957
+ */
1958
+
1959
+ /**
1960
+ * Default initialization arguments for an SSS-1 stablecoin.
1961
+ *
1962
+ * @param name - Stablecoin name
1963
+ * @param symbol - Ticker symbol
1964
+ * @param uri - Metadata URI
1965
+ * @param decimals - Decimal places (default: 6)
1966
+ * @returns InitializeArgs configured for SSS-1
1967
+ */
1968
+ declare function sss1Preset(name: string, symbol: string, uri: string, decimals?: number): InitializeArgs;
1969
+ /**
1970
+ * SSS-1 feature flags for documentation and validation.
1971
+ */
1972
+ declare const SSS1_FEATURES: {
1973
+ readonly mint: true;
1974
+ readonly burn: true;
1975
+ readonly freeze: true;
1976
+ readonly pause: true;
1977
+ readonly roles: true;
1978
+ readonly blacklist: false;
1979
+ readonly seize: false;
1980
+ readonly transferHook: false;
1981
+ readonly permanentDelegate: false;
1982
+ };
1983
+
1984
+ /**
1985
+ * @module presets/sss2
1986
+ * @description SSS-2 preset configuration — enhanced compliance stablecoin.
1987
+ *
1988
+ * SSS-2 extends SSS-1 with: blacklist, seize (permanent delegate),
1989
+ * transfer hook for real-time compliance, and default-frozen accounts.
1990
+ * The strict hook mode (`ComplianceMode.Hook`): every transfer pays for the hook. New mints default to SSS-ACL.
1991
+ */
1992
+
1993
+ /**
1994
+ * Default initialization arguments for an SSS-2 stablecoin.
1995
+ *
1996
+ * @param name - Stablecoin name
1997
+ * @param symbol - Ticker symbol
1998
+ * @param uri - Metadata URI
1999
+ * @param hookProgramId - The transfer hook program ID
2000
+ * @param decimals - Decimal places (default: 6)
2001
+ * @returns InitializeArgs configured for SSS-2
2002
+ */
2003
+ declare function sss2Preset(name: string, symbol: string, uri: string, hookProgramId: PublicKey, decimals?: number): InitializeArgs;
2004
+ /**
2005
+ * SSS-2 feature flags for documentation and validation.
2006
+ */
2007
+ declare const SSS2_FEATURES: {
2008
+ readonly mint: true;
2009
+ readonly burn: true;
2010
+ readonly freeze: true;
2011
+ readonly pause: true;
2012
+ readonly roles: true;
2013
+ readonly blacklist: true;
2014
+ readonly seize: true;
2015
+ readonly transferHook: true;
2016
+ readonly permanentDelegate: true;
2017
+ };
2018
+
2019
+ /**
2020
+ * @module presets/sss3
2021
+ * @description SSS-3 preset configuration — private stablecoin.
2022
+ *
2023
+ * SSS-3 extends SSS-2 with: confidential transfers (via SPL Token-2022
2024
+ * Confidential Transfer extension), and allowlist-based access control.
2025
+ * Only allowlisted wallets can transact with the token.
2026
+ */
2027
+
2028
+ /**
2029
+ * Default initialization arguments for an SSS-3 stablecoin.
2030
+ *
2031
+ * @param name - Stablecoin name
2032
+ * @param symbol - Ticker symbol
2033
+ * @param uri - Metadata URI
2034
+ * @param hookProgramId - The transfer hook program ID
2035
+ * @param decimals - Decimal places (default: 6)
2036
+ * @returns InitializeArgs configured for SSS-3
2037
+ */
2038
+ declare function sss3Preset(name: string, symbol: string, uri: string, hookProgramId: PublicKey, decimals?: number): InitializeArgs;
2039
+ /**
2040
+ * SSS-3 feature flags for documentation and validation.
2041
+ */
2042
+ declare const SSS3_FEATURES: {
2043
+ readonly mint: true;
2044
+ readonly burn: true;
2045
+ readonly freeze: true;
2046
+ readonly pause: true;
2047
+ readonly roles: true;
2048
+ readonly blacklist: true;
2049
+ readonly seize: true;
2050
+ readonly transferHook: true;
2051
+ readonly permanentDelegate: true;
2052
+ readonly confidentialTransfers: true;
2053
+ readonly allowlist: true;
2054
+ };
2055
+
2056
+ /**
2057
+ * @module pda
2058
+ * @description PDA derivation helpers for the SSS-Token program.
2059
+ *
2060
+ * All PDAs are derived from the mint address for consistent addressing.
2061
+ * Seeds match the on-chain constants.rs exactly.
2062
+ */
2063
+
2064
+ /**
2065
+ * Derives the StablecoinConfig PDA address.
2066
+ *
2067
+ * @param mint - The Token-2022 mint address
2068
+ * @param programId - The SSS-Token program ID
2069
+ * @returns [pda, bump]
2070
+ */
2071
+ declare function findConfigPda(mint: PublicKey, programId: PublicKey): [PublicKey, number];
2072
+ /**
2073
+ * Derives the PauseState PDA address.
2074
+ *
2075
+ * @param mint - The Token-2022 mint address
2076
+ * @param programId - The SSS-Token program ID
2077
+ * @returns [pda, bump]
2078
+ */
2079
+ declare function findPauseStatePda(mint: PublicKey, programId: PublicKey): [PublicKey, number];
2080
+ /**
2081
+ * Derives a RoleRecord PDA address.
2082
+ *
2083
+ * @param mint - The Token-2022 mint address
2084
+ * @param holder - The role holder's public key
2085
+ * @param role - The role type
2086
+ * @param programId - The SSS-Token program ID
2087
+ * @returns [pda, bump]
2088
+ */
2089
+ declare function findRolePda(mint: PublicKey, holder: PublicKey, role: RoleType, programId: PublicKey): [PublicKey, number];
2090
+ /**
2091
+ * Derives a MinterQuota PDA address.
2092
+ *
2093
+ * @param mint - The Token-2022 mint address
2094
+ * @param minter - The minter's public key
2095
+ * @param programId - The SSS-Token program ID
2096
+ * @returns [pda, bump]
2097
+ */
2098
+ declare function findQuotaPda(mint: PublicKey, minter: PublicKey, programId: PublicKey): [PublicKey, number];
2099
+ /**
2100
+ * Derives a BlacklistEntry PDA address.
2101
+ *
2102
+ * @param mint - The Token-2022 mint address
2103
+ * @param target - The blacklisted wallet's public key
2104
+ * @param programId - The SSS-Token program ID
2105
+ * @returns [pda, bump]
2106
+ */
2107
+ declare function findBlacklistPda(mint: PublicKey, target: PublicKey, programId: PublicKey): [PublicKey, number];
2108
+ /**
2109
+ * Derives an AllowlistEntry PDA address (`add_to_allowlist_v3`; read by ThawGate AllowOnly / BypassForPdas policies).
2110
+ *
2111
+ * @param mint - The Token-2022 mint address
2112
+ * @param wallet - The allowlisted wallet's public key
2113
+ * @param programId - The SSS-Token program ID
2114
+ * @returns [pda, bump]
2115
+ */
2116
+ declare function findAllowlistPda(mint: PublicKey, wallet: PublicKey, programId: PublicKey): [PublicKey, number];
2117
+ /**
2118
+ * Derives the ReserveAttestation PDA address (S9).
2119
+ *
2120
+ * @param mint - The Token-2022 mint address
2121
+ * @param programId - The SSS-Token program ID
2122
+ * @returns [pda, bump]
2123
+ */
2124
+ declare function findReserveAttestationPda(mint: PublicKey, programId: PublicKey): [PublicKey, number];
2125
+ /**
2126
+ * Derives the ExtraAccountMetaList PDA for the transfer hook.
2127
+ *
2128
+ * @param mint - The Token-2022 mint address
2129
+ * @param hookProgramId - The transfer hook program ID
2130
+ * @returns [pda, bump]
2131
+ */
2132
+ declare function findExtraAccountMetaListPda(mint: PublicKey, hookProgramId: PublicKey): [PublicKey, number];
2133
+
2134
+ /**
2135
+ * @module base/token
2136
+ * @description Core token operations — initialize, mint, burn, freeze, thaw, pause, unpause.
2137
+ *
2138
+ * These functions build Anchor instruction transactions.
2139
+ * The caller is responsible for signing and sending.
2140
+ */
2141
+
2142
+ /**
2143
+ * Initializes a new stablecoin.
2144
+ *
2145
+ * Creates the Token-2022 mint with configured extensions,
2146
+ * plus StablecoinConfig, PauseState, and MasterAuthority PDAs.
2147
+ *
2148
+ * @param program - The Anchor program instance
2149
+ * @param authority - The authority keypair (becomes MasterAuthority)
2150
+ * @param args - Initialization arguments (use presets for defaults)
2151
+ * @param mintKeypair - Optional mint keypair (generated if not provided)
2152
+ * @returns Transaction result with mint address
2153
+ */
2154
+ declare function initialize(program: Program, authority: PublicKey, args: InitializeArgs, mintKeypair?: Keypair): Promise<{
2155
+ instructions: TransactionInstruction[];
2156
+ mint: PublicKey;
2157
+ mintKeypair: Keypair;
2158
+ }>;
2159
+ /**
2160
+ * Mints tokens to a recipient.
2161
+ *
2162
+ * @param program - The Anchor program instance
2163
+ * @param mint - The Token-2022 mint address
2164
+ * @param minter - The minter's public key (must have Minter role)
2165
+ * @param recipient - The recipient's wallet address
2166
+ * @param amount - Amount to mint (raw, not decimal-adjusted)
2167
+ * @returns Transaction instructions
2168
+ */
2169
+ declare function mintTokens(program: Program, mint: PublicKey, minter: PublicKey, recipient: PublicKey, amount: BN): Promise<TransactionInstruction[]>;
2170
+ /**
2171
+ * Burns tokens from the burner's account.
2172
+ *
2173
+ * @param program - The Anchor program instance
2174
+ * @param mint - The Token-2022 mint address
2175
+ * @param burner - The burner's public key (must have Burner role)
2176
+ * @param amount - Amount to burn (raw, not decimal-adjusted)
2177
+ * @returns Transaction instructions
2178
+ */
2179
+ declare function burnTokens(program: Program, mint: PublicKey, burner: PublicKey, amount: BN): Promise<TransactionInstruction[]>;
2180
+ /**
2181
+ * Freezes a target token account.
2182
+ *
2183
+ * @param program - The Anchor program instance
2184
+ * @param mint - The Token-2022 mint address
2185
+ * @param operator - The operator's public key (MasterAuthority or Blacklister)
2186
+ * @param targetTokenAccount - The token account to freeze
2187
+ * @param operatorRole - The role type of the operator
2188
+ * @returns Transaction instructions
2189
+ */
2190
+ declare function freezeAccount(program: Program, mint: PublicKey, operator: PublicKey, targetTokenAccount: PublicKey, operatorRole?: RoleType.MasterAuthority | RoleType.Blacklister): Promise<TransactionInstruction[]>;
2191
+ /**
2192
+ * Thaws a frozen token account.
2193
+ *
2194
+ * @param program - The Anchor program instance
2195
+ * @param mint - The Token-2022 mint address
2196
+ * @param operator - The operator's public key (MasterAuthority or Blacklister)
2197
+ * @param targetTokenAccount - The token account to thaw
2198
+ * @param operatorRole - The role type of the operator
2199
+ * @returns Transaction instructions
2200
+ */
2201
+ declare function thawAccount(program: Program, mint: PublicKey, operator: PublicKey, targetTokenAccount: PublicKey, operatorRole?: RoleType.MasterAuthority | RoleType.Blacklister): Promise<TransactionInstruction[]>;
2202
+ /**
2203
+ * Pauses all token operations.
2204
+ *
2205
+ * @param program - The Anchor program instance
2206
+ * @param mint - The Token-2022 mint address
2207
+ * @param operator - The operator's public key (Pauser or MasterAuthority)
2208
+ * @param operatorRole - The role type of the operator
2209
+ * @returns Transaction instructions
2210
+ */
2211
+ declare function pause(program: Program, mint: PublicKey, operator: PublicKey, operatorRole?: RoleType.Pauser | RoleType.MasterAuthority): Promise<TransactionInstruction[]>;
2212
+ /**
2213
+ * Resumes all token operations.
2214
+ *
2215
+ * @param program - The Anchor program instance
2216
+ * @param mint - The Token-2022 mint address
2217
+ * @param operator - The operator's public key (Pauser or MasterAuthority)
2218
+ * @param operatorRole - The role type of the operator
2219
+ * @returns Transaction instructions
2220
+ */
2221
+ declare function unpause(program: Program, mint: PublicKey, operator: PublicKey, operatorRole?: RoleType.Pauser | RoleType.MasterAuthority): Promise<TransactionInstruction[]>;
2222
+
2223
+ declare const token_burnTokens: typeof burnTokens;
2224
+ declare const token_freezeAccount: typeof freezeAccount;
2225
+ declare const token_initialize: typeof initialize;
2226
+ declare const token_mintTokens: typeof mintTokens;
2227
+ declare const token_pause: typeof pause;
2228
+ declare const token_thawAccount: typeof thawAccount;
2229
+ declare const token_unpause: typeof unpause;
2230
+ declare namespace token {
2231
+ export { token_burnTokens as burnTokens, token_freezeAccount as freezeAccount, token_initialize as initialize, token_mintTokens as mintTokens, token_pause as pause, token_thawAccount as thawAccount, token_unpause as unpause };
2232
+ }
2233
+
2234
+ /**
2235
+ * @module base/roles
2236
+ * @description Role management operations — update_minter, update_roles, transfer_authority.
2237
+ */
2238
+
2239
+ /**
2240
+ * Creates or updates a minter with a quota.
2241
+ *
2242
+ * @param program - The Anchor program instance
2243
+ * @param mint - The Token-2022 mint address
2244
+ * @param authority - The MasterAuthority's public key
2245
+ * @param minter - The minter's public key
2246
+ * @param limit - Maximum mint amount per period
2247
+ * @param period - The quota period
2248
+ * @returns Transaction instructions
2249
+ */
2250
+ declare function updateMinter(program: Program, mint: PublicKey, authority: PublicKey, minter: PublicKey, limit: BN, period: QuotaPeriod): Promise<TransactionInstruction[]>;
2251
+ /**
2252
+ * Creates or updates a role for a given key.
2253
+ *
2254
+ * Cannot grant MasterAuthority — use transferAuthority instead.
2255
+ *
2256
+ * @param program - The Anchor program instance
2257
+ * @param mint - The Token-2022 mint address
2258
+ * @param authority - The MasterAuthority's public key
2259
+ * @param holder - The key to grant/revoke the role for
2260
+ * @param role - The role type (cannot be MasterAuthority)
2261
+ * @param active - Whether to activate or deactivate
2262
+ * @returns Transaction instructions
2263
+ */
2264
+ declare function updateRoles(program: Program, mint: PublicKey, authority: PublicKey, holder: PublicKey, role: RoleType, active: boolean): Promise<TransactionInstruction[]>;
2265
+ /**
2266
+ * Transfers MasterAuthority to a new key.
2267
+ *
2268
+ * The old authority's role record is deactivated (audit trail).
2269
+ *
2270
+ * @param program - The Anchor program instance
2271
+ * @param mint - The Token-2022 mint address
2272
+ * @param authority - The current MasterAuthority's public key
2273
+ * @param newAuthority - The new MasterAuthority's public key
2274
+ * @returns Transaction instructions
2275
+ */
2276
+ declare function transferAuthority(program: Program, mint: PublicKey, authority: PublicKey, newAuthority: PublicKey): Promise<TransactionInstruction[]>;
2277
+
2278
+ declare const roles_transferAuthority: typeof transferAuthority;
2279
+ declare const roles_updateMinter: typeof updateMinter;
2280
+ declare const roles_updateRoles: typeof updateRoles;
2281
+ declare namespace roles {
2282
+ export { roles_transferAuthority as transferAuthority, roles_updateMinter as updateMinter, roles_updateRoles as updateRoles };
2283
+ }
2284
+
2285
+ /**
2286
+ * @module @thawgate/sdk
2287
+ * @description Solana Stablecoin Standard (SSS) TypeScript SDK.
2288
+ *
2289
+ * This package provides a complete TypeScript API for interacting
2290
+ * with SSS stablecoins on Solana: SSS-ACL (Token ACL gated by ThawGate,
2291
+ * the default), SSS-Both (Token ACL + transfer hook), SSS-1 (basic)
2292
+ * and SSS-2 (transfer hook) configurations.
2293
+ *
2294
+ * @example
2295
+ * ```ts
2296
+ * import { SolanaStablecoin, sssAclPreset, SssError } from "@thawgate/sdk";
2297
+ *
2298
+ * const client = SolanaStablecoin.fromConfig({
2299
+ * rpcUrl: "https://api.devnet.solana.com",
2300
+ * });
2301
+ *
2302
+ * // Initialize a Token ACL stablecoin (then call enable_token_acl as the master authority)
2303
+ * const { instructions, mint } = await client.initialize(
2304
+ * authority.publicKey,
2305
+ * sssAclPreset("USD Stablecoin", "USDS", "https://meta.example.com"),
2306
+ * );
2307
+ * ```
2308
+ */
2309
+
2310
+ /**
2311
+ * SSS preset configurations.
2312
+ *
2313
+ * Spec-required export: `Presets.SSS_1` and `Presets.SSS_2`.
2314
+ * Each value provides the feature flags for the respective standard. `SSS_ACL` is the default for new mints.
2315
+ *
2316
+ * @example
2317
+ * ```ts
2318
+ * import { Presets } from "@thawgate/sdk";
2319
+ * const hasPermanentDelegate = Presets.SSS_2.permanentDelegate; // true
2320
+ * ```
2321
+ */
2322
+ declare const Presets: {
2323
+ /** SSS-ACL (default): Token ACL gated by ThawGate — no transfer hook. */
2324
+ readonly SSS_ACL: {
2325
+ readonly mint: true;
2326
+ readonly burn: true;
2327
+ readonly freeze: true;
2328
+ readonly pause: true;
2329
+ readonly roles: true;
2330
+ readonly blacklist: true;
2331
+ readonly seize: true;
2332
+ readonly transferHook: false;
2333
+ readonly permanentDelegate: true;
2334
+ readonly tokenAcl: true;
2335
+ readonly defaultAccountFrozen: true;
2336
+ };
2337
+ /** SSS-Both: Token ACL + the transfer hook. */
2338
+ readonly SSS_BOTH: {
2339
+ readonly mint: true;
2340
+ readonly burn: true;
2341
+ readonly freeze: true;
2342
+ readonly pause: true;
2343
+ readonly roles: true;
2344
+ readonly blacklist: true;
2345
+ readonly seize: true;
2346
+ readonly transferHook: true;
2347
+ readonly permanentDelegate: true;
2348
+ readonly tokenAcl: true;
2349
+ readonly defaultAccountFrozen: true;
2350
+ };
2351
+ /** SSS-1: Basic stablecoin — no compliance extensions. */
2352
+ readonly SSS_1: {
2353
+ readonly mint: true;
2354
+ readonly burn: true;
2355
+ readonly freeze: true;
2356
+ readonly pause: true;
2357
+ readonly roles: true;
2358
+ readonly blacklist: false;
2359
+ readonly seize: false;
2360
+ readonly transferHook: false;
2361
+ readonly permanentDelegate: false;
2362
+ };
2363
+ /** SSS-2: Compliance stablecoin — with permanent delegate + transfer hook. */
2364
+ readonly SSS_2: {
2365
+ readonly mint: true;
2366
+ readonly burn: true;
2367
+ readonly freeze: true;
2368
+ readonly pause: true;
2369
+ readonly roles: true;
2370
+ readonly blacklist: true;
2371
+ readonly seize: true;
2372
+ readonly transferHook: true;
2373
+ readonly permanentDelegate: true;
2374
+ };
2375
+ /** SSS-3: Private stablecoin — confidential transfers + allowlist. */
2376
+ readonly SSS_3: {
2377
+ readonly mint: true;
2378
+ readonly burn: true;
2379
+ readonly freeze: true;
2380
+ readonly pause: true;
2381
+ readonly roles: true;
2382
+ readonly blacklist: true;
2383
+ readonly seize: true;
2384
+ readonly transferHook: true;
2385
+ readonly permanentDelegate: true;
2386
+ readonly confidentialTransfers: true;
2387
+ readonly allowlist: true;
2388
+ };
2389
+ };
2390
+
2391
+ export { ABL_GATE_PROGRAM_ID, AccountNotFoundError, type AddToBlacklistArgs, type AllowlistMode, type AuthorityTransferredEvent, AuthorizationError, type BlacklistEntry, BlacklistedError, ComplianceMode, ComplianceModule, ConfigError, type CreateStablecoinOptions, type CreatedStablecoin, type Explanation, FeatureNotEnabledError, type FreezeResult, GateAction, GateClient, type GateClientOptions, type GatePolicy, GateVerdict, type GateWallet, type InitializeArgs, type InitializeStablecoinOptions, type KeypairWallet, MINT_CONFIG_SIZE, type MintConfig, type MinterQuota, type PauseState, type PermissionlessArgs, type PermissionlessKind, type PolicyInput, Presets, PrivacyModule, type ProgramErrorInfo, QuotaExceededError, QuotaPeriod, type ReserveAttestation, ReservesModule, type RoleRecord, RoleType, SAS_PROGRAM_ID, SSS1_FEATURES, SSS2_FEATURES, SSS3_FEATURES, type SSSClientConfig, SSSError, SSSPreset, SSS_ACL_FEATURES, SSS_BOTH_FEATURES, SSS_TOKEN_ERRORS, SSS_TOKEN_PROGRAM_ID, type SetupMintingOptions, SolanaStablecoin, SssComplianceError, SssError, SssInitError, SssMintError, SssRpcError, type StablecoinConfig, type StablecoinInitializedEvent, THAWGATE_GATE_ERRORS, THAWGATE_GATE_PROGRAM_ID, TOKEN_ACL_IX, TOKEN_ACL_PROGRAM_ID, TRANSFER_HOOK_PROGRAM_ID, TokenPausedError, type TokensSeizedEvent, TransactionError, type TransactionOptions, type TransactionResult, type UpdateMinterArgs, type UpdateRolesArgs, decodeMintConfig, fetchMintConfig, findAllowlistPda, findBlacklistPda, findConfigPda, findExtraAccountMetaListPda, findFlagAccountPda, findFreezeExtraMetasPda, findMintConfigPda, findPauseStatePda, findQuotaPda, findReserveAttestationPda, findRolePda, findThawExtraMetasPda, keypairWallet, parseError, permissionlessIx, programError, roles, index as sas, setGatingProgramIx, sss1Preset, sss2Preset, sss3Preset, sssAclPreset, sssBothPreset, toGatePolicyConfig, togglePermissionlessIx, token };