@zcomb/programs-sdk 1.2.0 → 1.3.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.
@@ -486,6 +486,26 @@ export declare class FutarchyClient {
486
486
  address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
487
487
  }>;
488
488
  }>;
489
+ /**
490
+ * Pre-creates all conditional token ATAs for a user before launching a proposal.
491
+ *
492
+ * This is REQUIRED for proposals with 3+ options to avoid exceeding Solana's
493
+ * max instruction trace length limit (64 instructions). The vault's deposit CPI
494
+ * creates ATAs on-the-fly, each requiring 5 inner instructions. For 4 options:
495
+ * 8 ATAs × 5 = 40 extra instructions, pushing the total over 64.
496
+ *
497
+ * Pre-creating ATAs eliminates this overhead, reducing the trace to ~32 instructions.
498
+ *
499
+ * @param creator - The user who will receive conditional tokens
500
+ * @param proposalPda - The proposal PDA (must be initialized but not launched)
501
+ * @returns Transaction signature
502
+ */
503
+ ensureConditionalATAs(creator: PublicKey, proposalPda: PublicKey): Promise<string>;
504
+ /**
505
+ * Internal helper to create conditional ATAs given mint arrays.
506
+ * Used by both ensureConditionalATAs and launchProposal to avoid redundant fetches.
507
+ */
508
+ private _createConditionalATAs;
489
509
  finalizeProposal(signer: PublicKey, proposalPda: PublicKey, options?: TxOptions): Promise<{
490
510
  builder: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
491
511
  name: "finalizeProposal";
@@ -649,12 +669,43 @@ export declare class FutarchyClient {
649
669
  name: "systemProgram";
650
670
  address: "11111111111111111111111111111111";
651
671
  }>;
672
+ numOptions: number;
652
673
  }>;
674
+ /**
675
+ * Creates an Address Lookup Table for redemption operations.
676
+ * Required for proposals with 3+ options to avoid exceeding transaction size limits.
677
+ *
678
+ * @param creator - The user redeeming (creator of proposal or liquidity provider)
679
+ * @param proposalPda - The proposal PDA
680
+ * @returns ALT address
681
+ */
682
+ createRedemptionALT(creator: PublicKey, proposalPda: PublicKey): Promise<{
683
+ altAddress: PublicKey;
684
+ }>;
685
+ /**
686
+ * Builds a versioned transaction for redeeming liquidity with ALT.
687
+ * Required for proposals with 3+ options to avoid exceeding transaction size limits.
688
+ *
689
+ * @param creator - The user redeeming
690
+ * @param proposalPda - The proposal PDA
691
+ * @param altAddress - Optional ALT address (will be created if not provided for 3+ options)
692
+ * @returns Unsigned versioned transaction, ALT address, and number of options
693
+ */
694
+ redeemLiquidityVersioned(creator: PublicKey, proposalPda: PublicKey, altAddress?: PublicKey): Promise<{
695
+ versionedTx: VersionedTransaction;
696
+ altAddress: PublicKey;
697
+ numOptions: number;
698
+ }>;
699
+ /**
700
+ * Helper to send a signed versioned transaction.
701
+ */
702
+ sendVersionedTransaction(signedTx: VersionedTransaction): Promise<string>;
653
703
  createProposalALT(creator: PublicKey, moderatorPda: PublicKey, numOptions?: number): Promise<{
654
704
  altAddress: PublicKey;
655
705
  }>;
656
706
  fetchALT(altAddress: PublicKey): Promise<AddressLookupTableAccount>;
657
707
  buildVersionedTx(payer: PublicKey, instructions: TransactionInstruction[], altAddress: PublicKey): Promise<VersionedTransaction>;
708
+ buildVersionedTxWithALT(payer: PublicKey, instructions: TransactionInstruction[], alt: AddressLookupTableAccount, blockhash: string): VersionedTransaction;
658
709
  deriveMintCreateKeyPDA(daoPda: PublicKey, name: string): [PublicKey, number];
659
710
  private fetchSquadsProgramConfig;
660
711
  private deriveMultisigPda;
@@ -1088,304 +1139,4 @@ export declare class FutarchyClient {
1088
1139
  daoPda: PublicKey;
1089
1140
  moderatorPda: PublicKey;
1090
1141
  }>;
1091
- createProposal(creator: PublicKey, moderatorPda: PublicKey, proposalParams: ProposalParams, baseAmount: BN | number, quoteAmount: BN | number, numOptions?: number, metadata?: string, options?: TxOptions): Promise<{
1092
- altAddress: PublicKey;
1093
- proposalPda: PublicKey;
1094
- proposalId: number;
1095
- vaultPda: PublicKey;
1096
- pools: PublicKey[];
1097
- condBaseMints: PublicKey[];
1098
- condQuoteMints: PublicKey[];
1099
- initializeBuilder: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
1100
- name: "initializeProposal";
1101
- discriminator: [50, 73, 156, 98, 129, 149, 21, 158];
1102
- accounts: [{
1103
- "name": "creator";
1104
- "writable": true;
1105
- "signer": true;
1106
- }, {
1107
- "name": "moderator";
1108
- "writable": true;
1109
- "pda": {
1110
- "seeds": [{
1111
- "kind": "const";
1112
- "value": [109, 111, 100, 101, 114, 97, 116, 111, 114];
1113
- }, {
1114
- "kind": "account";
1115
- "path": "moderator.name";
1116
- "account": "moderatorAccount";
1117
- }];
1118
- };
1119
- }, {
1120
- "name": "proposal";
1121
- "writable": true;
1122
- "pda": {
1123
- "seeds": [{
1124
- "kind": "const";
1125
- "value": [112, 114, 111, 112, 111, 115, 97, 108];
1126
- }, {
1127
- "kind": "account";
1128
- "path": "moderator";
1129
- }, {
1130
- "kind": "account";
1131
- "path": "moderator.proposal_id_counter";
1132
- "account": "moderatorAccount";
1133
- }];
1134
- };
1135
- }, {
1136
- "name": "systemProgram";
1137
- "address": "11111111111111111111111111111111";
1138
- }, {
1139
- "name": "vaultProgram";
1140
- "address": "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
1141
- }, {
1142
- "name": "ammProgram";
1143
- "address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
1144
- }, {
1145
- "name": "tokenProgram";
1146
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1147
- }, {
1148
- "name": "associatedTokenProgram";
1149
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1150
- }];
1151
- args: [{
1152
- "name": "proposalParams";
1153
- "type": {
1154
- "defined": {
1155
- "name": "proposalParams";
1156
- };
1157
- };
1158
- }, {
1159
- "name": "metadata";
1160
- "type": {
1161
- "option": "string";
1162
- };
1163
- }];
1164
- returns: "u16";
1165
- } & {
1166
- name: "initializeProposal";
1167
- }, {
1168
- name: "creator";
1169
- writable: true;
1170
- signer: true;
1171
- } | {
1172
- name: "moderator";
1173
- writable: true;
1174
- pda: {
1175
- "seeds": [{
1176
- "kind": "const";
1177
- "value": [109, 111, 100, 101, 114, 97, 116, 111, 114];
1178
- }, {
1179
- "kind": "account";
1180
- "path": "moderator.name";
1181
- "account": "moderatorAccount";
1182
- }];
1183
- };
1184
- } | {
1185
- name: "proposal";
1186
- writable: true;
1187
- pda: {
1188
- "seeds": [{
1189
- "kind": "const";
1190
- "value": [112, 114, 111, 112, 111, 115, 97, 108];
1191
- }, {
1192
- "kind": "account";
1193
- "path": "moderator";
1194
- }, {
1195
- "kind": "account";
1196
- "path": "moderator.proposal_id_counter";
1197
- "account": "moderatorAccount";
1198
- }];
1199
- };
1200
- } | {
1201
- name: "systemProgram";
1202
- address: "11111111111111111111111111111111";
1203
- } | {
1204
- name: "vaultProgram";
1205
- address: "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
1206
- } | {
1207
- name: "ammProgram";
1208
- address: "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
1209
- } | {
1210
- name: "tokenProgram";
1211
- address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1212
- } | {
1213
- name: "associatedTokenProgram";
1214
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1215
- }>;
1216
- addOptionBuilders: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
1217
- name: "addOption";
1218
- discriminator: [229, 150, 102, 127, 99, 5, 34, 196];
1219
- accounts: [{
1220
- "name": "creator";
1221
- "writable": true;
1222
- "signer": true;
1223
- }, {
1224
- "name": "proposal";
1225
- "writable": true;
1226
- "pda": {
1227
- "seeds": [{
1228
- "kind": "const";
1229
- "value": [112, 114, 111, 112, 111, 115, 97, 108];
1230
- }, {
1231
- "kind": "account";
1232
- "path": "proposal.moderator";
1233
- "account": "proposalAccount";
1234
- }, {
1235
- "kind": "account";
1236
- "path": "proposal.id";
1237
- "account": "proposalAccount";
1238
- }];
1239
- };
1240
- }, {
1241
- "name": "systemProgram";
1242
- "address": "11111111111111111111111111111111";
1243
- }, {
1244
- "name": "vaultProgram";
1245
- "address": "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
1246
- }, {
1247
- "name": "ammProgram";
1248
- "address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
1249
- }, {
1250
- "name": "tokenProgram";
1251
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1252
- }, {
1253
- "name": "associatedTokenProgram";
1254
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1255
- }];
1256
- args: [];
1257
- } & {
1258
- name: "addOption";
1259
- }, {
1260
- name: "creator";
1261
- writable: true;
1262
- signer: true;
1263
- } | {
1264
- name: "proposal";
1265
- writable: true;
1266
- pda: {
1267
- "seeds": [{
1268
- "kind": "const";
1269
- "value": [112, 114, 111, 112, 111, 115, 97, 108];
1270
- }, {
1271
- "kind": "account";
1272
- "path": "proposal.moderator";
1273
- "account": "proposalAccount";
1274
- }, {
1275
- "kind": "account";
1276
- "path": "proposal.id";
1277
- "account": "proposalAccount";
1278
- }];
1279
- };
1280
- } | {
1281
- name: "systemProgram";
1282
- address: "11111111111111111111111111111111";
1283
- } | {
1284
- name: "vaultProgram";
1285
- address: "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
1286
- } | {
1287
- name: "ammProgram";
1288
- address: "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
1289
- } | {
1290
- name: "tokenProgram";
1291
- address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1292
- } | {
1293
- name: "associatedTokenProgram";
1294
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1295
- }>[];
1296
- launchBuilder: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
1297
- name: "launchProposal";
1298
- discriminator: [16, 211, 189, 119, 245, 72, 0, 229];
1299
- accounts: [{
1300
- "name": "creator";
1301
- "writable": true;
1302
- "signer": true;
1303
- }, {
1304
- "name": "proposal";
1305
- "writable": true;
1306
- "pda": {
1307
- "seeds": [{
1308
- "kind": "const";
1309
- "value": [112, 114, 111, 112, 111, 115, 97, 108];
1310
- }, {
1311
- "kind": "account";
1312
- "path": "proposal.moderator";
1313
- "account": "proposalAccount";
1314
- }, {
1315
- "kind": "account";
1316
- "path": "proposal.id";
1317
- "account": "proposalAccount";
1318
- }];
1319
- };
1320
- }, {
1321
- "name": "vault";
1322
- "writable": true;
1323
- "relations": ["proposal"];
1324
- }, {
1325
- "name": "systemProgram";
1326
- "address": "11111111111111111111111111111111";
1327
- }, {
1328
- "name": "vaultProgram";
1329
- "address": "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
1330
- }, {
1331
- "name": "ammProgram";
1332
- "address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
1333
- }, {
1334
- "name": "tokenProgram";
1335
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1336
- }, {
1337
- "name": "associatedTokenProgram";
1338
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1339
- }];
1340
- args: [{
1341
- "name": "baseAmount";
1342
- "type": "u64";
1343
- }, {
1344
- "name": "quoteAmount";
1345
- "type": "u64";
1346
- }];
1347
- } & {
1348
- name: "launchProposal";
1349
- }, {
1350
- name: "creator";
1351
- writable: true;
1352
- signer: true;
1353
- } | {
1354
- name: "proposal";
1355
- writable: true;
1356
- pda: {
1357
- "seeds": [{
1358
- "kind": "const";
1359
- "value": [112, 114, 111, 112, 111, 115, 97, 108];
1360
- }, {
1361
- "kind": "account";
1362
- "path": "proposal.moderator";
1363
- "account": "proposalAccount";
1364
- }, {
1365
- "kind": "account";
1366
- "path": "proposal.id";
1367
- "account": "proposalAccount";
1368
- }];
1369
- };
1370
- } | {
1371
- name: "vault";
1372
- writable: true;
1373
- relations: ["proposal"];
1374
- } | {
1375
- name: "systemProgram";
1376
- address: "11111111111111111111111111111111";
1377
- } | {
1378
- name: "vaultProgram";
1379
- address: "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
1380
- } | {
1381
- name: "ammProgram";
1382
- address: "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
1383
- } | {
1384
- name: "tokenProgram";
1385
- address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1386
- } | {
1387
- name: "associatedTokenProgram";
1388
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1389
- }>;
1390
- }>;
1391
1142
  }