@zcomb/programs-sdk 1.1.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.
- package/dist/futarchy/client.d.ts +53 -298
- package/dist/futarchy/client.js +209 -40
- package/dist/futarchy/instructions.d.ts +2 -0
- package/dist/generated/idls/futarchy.json +1 -0
- package/dist/generated/types/futarchy.d.ts +1 -0
- package/dist/generated/types/futarchy.js +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/src/futarchy/client.ts +288 -57
- package/src/generated/idls/futarchy.json +1 -0
- package/src/generated/types/futarchy.ts +1 -0
- package/src/utils.ts +6 -0
|
@@ -189,6 +189,7 @@ export declare class FutarchyClient {
|
|
|
189
189
|
"signer": true;
|
|
190
190
|
}, {
|
|
191
191
|
"name": "moderator";
|
|
192
|
+
"writable": true;
|
|
192
193
|
"pda": {
|
|
193
194
|
"seeds": [{
|
|
194
195
|
"kind": "const";
|
|
@@ -253,6 +254,7 @@ export declare class FutarchyClient {
|
|
|
253
254
|
signer: true;
|
|
254
255
|
} | {
|
|
255
256
|
name: "moderator";
|
|
257
|
+
writable: true;
|
|
256
258
|
pda: {
|
|
257
259
|
"seeds": [{
|
|
258
260
|
"kind": "const";
|
|
@@ -484,6 +486,26 @@ export declare class FutarchyClient {
|
|
|
484
486
|
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
485
487
|
}>;
|
|
486
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;
|
|
487
509
|
finalizeProposal(signer: PublicKey, proposalPda: PublicKey, options?: TxOptions): Promise<{
|
|
488
510
|
builder: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
|
|
489
511
|
name: "finalizeProposal";
|
|
@@ -647,12 +669,43 @@ export declare class FutarchyClient {
|
|
|
647
669
|
name: "systemProgram";
|
|
648
670
|
address: "11111111111111111111111111111111";
|
|
649
671
|
}>;
|
|
672
|
+
numOptions: number;
|
|
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;
|
|
650
698
|
}>;
|
|
699
|
+
/**
|
|
700
|
+
* Helper to send a signed versioned transaction.
|
|
701
|
+
*/
|
|
702
|
+
sendVersionedTransaction(signedTx: VersionedTransaction): Promise<string>;
|
|
651
703
|
createProposalALT(creator: PublicKey, moderatorPda: PublicKey, numOptions?: number): Promise<{
|
|
652
704
|
altAddress: PublicKey;
|
|
653
705
|
}>;
|
|
654
706
|
fetchALT(altAddress: PublicKey): Promise<AddressLookupTableAccount>;
|
|
655
707
|
buildVersionedTx(payer: PublicKey, instructions: TransactionInstruction[], altAddress: PublicKey): Promise<VersionedTransaction>;
|
|
708
|
+
buildVersionedTxWithALT(payer: PublicKey, instructions: TransactionInstruction[], alt: AddressLookupTableAccount, blockhash: string): VersionedTransaction;
|
|
656
709
|
deriveMintCreateKeyPDA(daoPda: PublicKey, name: string): [PublicKey, number];
|
|
657
710
|
private fetchSquadsProgramConfig;
|
|
658
711
|
private deriveMultisigPda;
|
|
@@ -1086,302 +1139,4 @@ export declare class FutarchyClient {
|
|
|
1086
1139
|
daoPda: PublicKey;
|
|
1087
1140
|
moderatorPda: PublicKey;
|
|
1088
1141
|
}>;
|
|
1089
|
-
createProposal(creator: PublicKey, moderatorPda: PublicKey, proposalParams: ProposalParams, baseAmount: BN | number, quoteAmount: BN | number, numOptions?: number, metadata?: string, options?: TxOptions): Promise<{
|
|
1090
|
-
altAddress: PublicKey;
|
|
1091
|
-
proposalPda: PublicKey;
|
|
1092
|
-
proposalId: number;
|
|
1093
|
-
vaultPda: PublicKey;
|
|
1094
|
-
pools: PublicKey[];
|
|
1095
|
-
condBaseMints: PublicKey[];
|
|
1096
|
-
condQuoteMints: PublicKey[];
|
|
1097
|
-
initializeBuilder: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
|
|
1098
|
-
name: "initializeProposal";
|
|
1099
|
-
discriminator: [50, 73, 156, 98, 129, 149, 21, 158];
|
|
1100
|
-
accounts: [{
|
|
1101
|
-
"name": "creator";
|
|
1102
|
-
"writable": true;
|
|
1103
|
-
"signer": true;
|
|
1104
|
-
}, {
|
|
1105
|
-
"name": "moderator";
|
|
1106
|
-
"pda": {
|
|
1107
|
-
"seeds": [{
|
|
1108
|
-
"kind": "const";
|
|
1109
|
-
"value": [109, 111, 100, 101, 114, 97, 116, 111, 114];
|
|
1110
|
-
}, {
|
|
1111
|
-
"kind": "account";
|
|
1112
|
-
"path": "moderator.name";
|
|
1113
|
-
"account": "moderatorAccount";
|
|
1114
|
-
}];
|
|
1115
|
-
};
|
|
1116
|
-
}, {
|
|
1117
|
-
"name": "proposal";
|
|
1118
|
-
"writable": true;
|
|
1119
|
-
"pda": {
|
|
1120
|
-
"seeds": [{
|
|
1121
|
-
"kind": "const";
|
|
1122
|
-
"value": [112, 114, 111, 112, 111, 115, 97, 108];
|
|
1123
|
-
}, {
|
|
1124
|
-
"kind": "account";
|
|
1125
|
-
"path": "moderator";
|
|
1126
|
-
}, {
|
|
1127
|
-
"kind": "account";
|
|
1128
|
-
"path": "moderator.proposal_id_counter";
|
|
1129
|
-
"account": "moderatorAccount";
|
|
1130
|
-
}];
|
|
1131
|
-
};
|
|
1132
|
-
}, {
|
|
1133
|
-
"name": "systemProgram";
|
|
1134
|
-
"address": "11111111111111111111111111111111";
|
|
1135
|
-
}, {
|
|
1136
|
-
"name": "vaultProgram";
|
|
1137
|
-
"address": "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
|
|
1138
|
-
}, {
|
|
1139
|
-
"name": "ammProgram";
|
|
1140
|
-
"address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
|
|
1141
|
-
}, {
|
|
1142
|
-
"name": "tokenProgram";
|
|
1143
|
-
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1144
|
-
}, {
|
|
1145
|
-
"name": "associatedTokenProgram";
|
|
1146
|
-
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1147
|
-
}];
|
|
1148
|
-
args: [{
|
|
1149
|
-
"name": "proposalParams";
|
|
1150
|
-
"type": {
|
|
1151
|
-
"defined": {
|
|
1152
|
-
"name": "proposalParams";
|
|
1153
|
-
};
|
|
1154
|
-
};
|
|
1155
|
-
}, {
|
|
1156
|
-
"name": "metadata";
|
|
1157
|
-
"type": {
|
|
1158
|
-
"option": "string";
|
|
1159
|
-
};
|
|
1160
|
-
}];
|
|
1161
|
-
returns: "u16";
|
|
1162
|
-
} & {
|
|
1163
|
-
name: "initializeProposal";
|
|
1164
|
-
}, {
|
|
1165
|
-
name: "creator";
|
|
1166
|
-
writable: true;
|
|
1167
|
-
signer: true;
|
|
1168
|
-
} | {
|
|
1169
|
-
name: "moderator";
|
|
1170
|
-
pda: {
|
|
1171
|
-
"seeds": [{
|
|
1172
|
-
"kind": "const";
|
|
1173
|
-
"value": [109, 111, 100, 101, 114, 97, 116, 111, 114];
|
|
1174
|
-
}, {
|
|
1175
|
-
"kind": "account";
|
|
1176
|
-
"path": "moderator.name";
|
|
1177
|
-
"account": "moderatorAccount";
|
|
1178
|
-
}];
|
|
1179
|
-
};
|
|
1180
|
-
} | {
|
|
1181
|
-
name: "proposal";
|
|
1182
|
-
writable: true;
|
|
1183
|
-
pda: {
|
|
1184
|
-
"seeds": [{
|
|
1185
|
-
"kind": "const";
|
|
1186
|
-
"value": [112, 114, 111, 112, 111, 115, 97, 108];
|
|
1187
|
-
}, {
|
|
1188
|
-
"kind": "account";
|
|
1189
|
-
"path": "moderator";
|
|
1190
|
-
}, {
|
|
1191
|
-
"kind": "account";
|
|
1192
|
-
"path": "moderator.proposal_id_counter";
|
|
1193
|
-
"account": "moderatorAccount";
|
|
1194
|
-
}];
|
|
1195
|
-
};
|
|
1196
|
-
} | {
|
|
1197
|
-
name: "systemProgram";
|
|
1198
|
-
address: "11111111111111111111111111111111";
|
|
1199
|
-
} | {
|
|
1200
|
-
name: "vaultProgram";
|
|
1201
|
-
address: "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
|
|
1202
|
-
} | {
|
|
1203
|
-
name: "ammProgram";
|
|
1204
|
-
address: "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
|
|
1205
|
-
} | {
|
|
1206
|
-
name: "tokenProgram";
|
|
1207
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1208
|
-
} | {
|
|
1209
|
-
name: "associatedTokenProgram";
|
|
1210
|
-
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1211
|
-
}>;
|
|
1212
|
-
addOptionBuilders: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
|
|
1213
|
-
name: "addOption";
|
|
1214
|
-
discriminator: [229, 150, 102, 127, 99, 5, 34, 196];
|
|
1215
|
-
accounts: [{
|
|
1216
|
-
"name": "creator";
|
|
1217
|
-
"writable": true;
|
|
1218
|
-
"signer": true;
|
|
1219
|
-
}, {
|
|
1220
|
-
"name": "proposal";
|
|
1221
|
-
"writable": true;
|
|
1222
|
-
"pda": {
|
|
1223
|
-
"seeds": [{
|
|
1224
|
-
"kind": "const";
|
|
1225
|
-
"value": [112, 114, 111, 112, 111, 115, 97, 108];
|
|
1226
|
-
}, {
|
|
1227
|
-
"kind": "account";
|
|
1228
|
-
"path": "proposal.moderator";
|
|
1229
|
-
"account": "proposalAccount";
|
|
1230
|
-
}, {
|
|
1231
|
-
"kind": "account";
|
|
1232
|
-
"path": "proposal.id";
|
|
1233
|
-
"account": "proposalAccount";
|
|
1234
|
-
}];
|
|
1235
|
-
};
|
|
1236
|
-
}, {
|
|
1237
|
-
"name": "systemProgram";
|
|
1238
|
-
"address": "11111111111111111111111111111111";
|
|
1239
|
-
}, {
|
|
1240
|
-
"name": "vaultProgram";
|
|
1241
|
-
"address": "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
|
|
1242
|
-
}, {
|
|
1243
|
-
"name": "ammProgram";
|
|
1244
|
-
"address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
|
|
1245
|
-
}, {
|
|
1246
|
-
"name": "tokenProgram";
|
|
1247
|
-
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1248
|
-
}, {
|
|
1249
|
-
"name": "associatedTokenProgram";
|
|
1250
|
-
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1251
|
-
}];
|
|
1252
|
-
args: [];
|
|
1253
|
-
} & {
|
|
1254
|
-
name: "addOption";
|
|
1255
|
-
}, {
|
|
1256
|
-
name: "creator";
|
|
1257
|
-
writable: true;
|
|
1258
|
-
signer: true;
|
|
1259
|
-
} | {
|
|
1260
|
-
name: "proposal";
|
|
1261
|
-
writable: true;
|
|
1262
|
-
pda: {
|
|
1263
|
-
"seeds": [{
|
|
1264
|
-
"kind": "const";
|
|
1265
|
-
"value": [112, 114, 111, 112, 111, 115, 97, 108];
|
|
1266
|
-
}, {
|
|
1267
|
-
"kind": "account";
|
|
1268
|
-
"path": "proposal.moderator";
|
|
1269
|
-
"account": "proposalAccount";
|
|
1270
|
-
}, {
|
|
1271
|
-
"kind": "account";
|
|
1272
|
-
"path": "proposal.id";
|
|
1273
|
-
"account": "proposalAccount";
|
|
1274
|
-
}];
|
|
1275
|
-
};
|
|
1276
|
-
} | {
|
|
1277
|
-
name: "systemProgram";
|
|
1278
|
-
address: "11111111111111111111111111111111";
|
|
1279
|
-
} | {
|
|
1280
|
-
name: "vaultProgram";
|
|
1281
|
-
address: "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
|
|
1282
|
-
} | {
|
|
1283
|
-
name: "ammProgram";
|
|
1284
|
-
address: "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
|
|
1285
|
-
} | {
|
|
1286
|
-
name: "tokenProgram";
|
|
1287
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1288
|
-
} | {
|
|
1289
|
-
name: "associatedTokenProgram";
|
|
1290
|
-
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1291
|
-
}>[];
|
|
1292
|
-
launchBuilder: import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<Futarchy, {
|
|
1293
|
-
name: "launchProposal";
|
|
1294
|
-
discriminator: [16, 211, 189, 119, 245, 72, 0, 229];
|
|
1295
|
-
accounts: [{
|
|
1296
|
-
"name": "creator";
|
|
1297
|
-
"writable": true;
|
|
1298
|
-
"signer": true;
|
|
1299
|
-
}, {
|
|
1300
|
-
"name": "proposal";
|
|
1301
|
-
"writable": true;
|
|
1302
|
-
"pda": {
|
|
1303
|
-
"seeds": [{
|
|
1304
|
-
"kind": "const";
|
|
1305
|
-
"value": [112, 114, 111, 112, 111, 115, 97, 108];
|
|
1306
|
-
}, {
|
|
1307
|
-
"kind": "account";
|
|
1308
|
-
"path": "proposal.moderator";
|
|
1309
|
-
"account": "proposalAccount";
|
|
1310
|
-
}, {
|
|
1311
|
-
"kind": "account";
|
|
1312
|
-
"path": "proposal.id";
|
|
1313
|
-
"account": "proposalAccount";
|
|
1314
|
-
}];
|
|
1315
|
-
};
|
|
1316
|
-
}, {
|
|
1317
|
-
"name": "vault";
|
|
1318
|
-
"writable": true;
|
|
1319
|
-
"relations": ["proposal"];
|
|
1320
|
-
}, {
|
|
1321
|
-
"name": "systemProgram";
|
|
1322
|
-
"address": "11111111111111111111111111111111";
|
|
1323
|
-
}, {
|
|
1324
|
-
"name": "vaultProgram";
|
|
1325
|
-
"address": "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
|
|
1326
|
-
}, {
|
|
1327
|
-
"name": "ammProgram";
|
|
1328
|
-
"address": "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
|
|
1329
|
-
}, {
|
|
1330
|
-
"name": "tokenProgram";
|
|
1331
|
-
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1332
|
-
}, {
|
|
1333
|
-
"name": "associatedTokenProgram";
|
|
1334
|
-
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1335
|
-
}];
|
|
1336
|
-
args: [{
|
|
1337
|
-
"name": "baseAmount";
|
|
1338
|
-
"type": "u64";
|
|
1339
|
-
}, {
|
|
1340
|
-
"name": "quoteAmount";
|
|
1341
|
-
"type": "u64";
|
|
1342
|
-
}];
|
|
1343
|
-
} & {
|
|
1344
|
-
name: "launchProposal";
|
|
1345
|
-
}, {
|
|
1346
|
-
name: "creator";
|
|
1347
|
-
writable: true;
|
|
1348
|
-
signer: true;
|
|
1349
|
-
} | {
|
|
1350
|
-
name: "proposal";
|
|
1351
|
-
writable: true;
|
|
1352
|
-
pda: {
|
|
1353
|
-
"seeds": [{
|
|
1354
|
-
"kind": "const";
|
|
1355
|
-
"value": [112, 114, 111, 112, 111, 115, 97, 108];
|
|
1356
|
-
}, {
|
|
1357
|
-
"kind": "account";
|
|
1358
|
-
"path": "proposal.moderator";
|
|
1359
|
-
"account": "proposalAccount";
|
|
1360
|
-
}, {
|
|
1361
|
-
"kind": "account";
|
|
1362
|
-
"path": "proposal.id";
|
|
1363
|
-
"account": "proposalAccount";
|
|
1364
|
-
}];
|
|
1365
|
-
};
|
|
1366
|
-
} | {
|
|
1367
|
-
name: "vault";
|
|
1368
|
-
writable: true;
|
|
1369
|
-
relations: ["proposal"];
|
|
1370
|
-
} | {
|
|
1371
|
-
name: "systemProgram";
|
|
1372
|
-
address: "11111111111111111111111111111111";
|
|
1373
|
-
} | {
|
|
1374
|
-
name: "vaultProgram";
|
|
1375
|
-
address: "VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU";
|
|
1376
|
-
} | {
|
|
1377
|
-
name: "ammProgram";
|
|
1378
|
-
address: "AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx";
|
|
1379
|
-
} | {
|
|
1380
|
-
name: "tokenProgram";
|
|
1381
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1382
|
-
} | {
|
|
1383
|
-
name: "associatedTokenProgram";
|
|
1384
|
-
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1385
|
-
}>;
|
|
1386
|
-
}>;
|
|
1387
1142
|
}
|