Skip to content

Commit dbff1c4

Browse files
committed
fix(nft-transfer): WIP for batch outgoing transfers
1 parent c1aed54 commit dbff1c4

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

src/lib/inq/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import {
2828
nftUpdateShowFailedMetasInq,
2929
nftSafeSigningInq,
3030
nftValidateCurrentAuthorityInq,
31-
nftUpdateTryFailuresInq
31+
nftUpdateTryFailuresInq,
32+
nftMintListInq,
33+
nftTransferDestinationInq,
3234
} from "./nftMenu.js";
3335

3436
export {
@@ -61,5 +63,7 @@ export {
6163
nftUpdateShowFailedMetasInq,
6264
nftSafeSigningInq,
6365
nftValidateCurrentAuthorityInq,
64-
nftUpdateTryFailuresInq
66+
nftUpdateTryFailuresInq,
67+
nftMintListInq,
68+
nftTransferDestinationInq,
6569
};

src/lib/inq/nftMenu.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const nftMainInq = () => {
99
choices: [
1010
{name: "Update Authority Change", value: 0},
1111
{name: "Validate Metadata Accounts", value: 1},
12+
{name: "Batch NFT Transfer", value: 2},
1213
"Back",
1314
],
1415
}
@@ -179,4 +180,27 @@ export const nftValidateCurrentAuthorityInq = (vault) => {
179180

180181
];
181182
return inquirer.prompt(questions);
182-
};
183+
};
184+
185+
export const nftMintListInq = () => {
186+
const questions = [
187+
{
188+
type: 'input',
189+
name: 'mintList',
190+
message: 'Enter the location of the mint list file (.json) for the NFTs you want to transfer out. (Press enter to go back)',
191+
}
192+
];
193+
return inquirer.prompt(questions);
194+
}
195+
196+
197+
export const nftTransferDestinationInq = () => {
198+
const questions = [
199+
{
200+
type: 'input',
201+
name: 'destination',
202+
message: 'Where do you want to transfer the NFTs to? (Press enter to go back)',
203+
}
204+
];
205+
return inquirer.prompt(questions);
206+
}

src/lib/menu.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import {
4242
nftSafeSigningInq,
4343
nftValidateCurrentAuthorityInq,
4444
nftUpdateTryFailuresInq,
45+
nftMintListInq,
46+
nftTransferDestinationInq,
4547
} from "./inq/index.js";
4648

4749
import API from "./api.js";
@@ -738,6 +740,8 @@ class Menu{
738740
this.nftAuthorityChange(ms);
739741
} else if (action === 1) {
740742
this.nftValidateMetaAuthorities(ms);
743+
} else if (action === 2) {
744+
this.nftBatchTransfer(ms);
741745
} else {
742746
this.multisig(ms);
743747
}
@@ -1016,6 +1020,29 @@ class Menu{
10161020
}
10171021
this.nfts(ms);
10181022
}
1023+
1024+
nftBatchTransfer = async (ms: any) => {
1025+
clear();
1026+
const [vault] = await getAuthorityPDA(ms.publicKey, new BN(1), this.api.programId);
1027+
this.header(vault);
1028+
const {mintList} = await nftMintListInq();
1029+
if (mintList && mintList.length > 0) {
1030+
const status = new Spinner("Loading the mint list...");
1031+
status.start();
1032+
const mints = await loadNFTMints(mintList);
1033+
status.stop();
1034+
// should check that the vault actually owns these
1035+
console.log(JSON.stringify(mints));
1036+
const {destination} = await nftTransferDestinationInq();
1037+
if (destination && destination.length > 0) {
1038+
console.log('destination: ' + destination);
1039+
console.log('current vault', vault.toBase58());
1040+
}
1041+
}
1042+
1043+
// this goes back to main nft menu
1044+
// this.nfts(ms);
1045+
}
10191046
};
10201047

10211048
export default Menu;

0 commit comments

Comments
 (0)