Transact with NFTs - MPC
Transfer ERC-721 and ERC-1155 NFTs from MPC Ethereum and Polygon wallets. See the Guide.
-
Transfer an ERC-721 or ERC-1155 NFT from an MPC wallet. You must set the
amountto0andisTsstotruefor MPC wallets. Use thetokenDataobject to specify the token contract address, token type (ERC721orERC1155), token ID, and token quantity. Set thetypetotransfertoken. CryptoPunks are not compatible with MPC wallets. Only V2 forwarder wallets can make outgoing NFT transactions.
// 1. Send NFT Transaction
// Use the JavaScript SDK for this step (see JavaScript tab)
// 1. Send NFT Transaction
interface PrebuildAndSignResponse {
txRequestId: 'string'; // id of internal document consisting of tx data
txHash: 'string'; // on chain tx hash
}
async function sendToken(params): Promise<PrebuildAndSignResponse> {
const {
walletId,
} = params;
const walletInstance = await bitgo
.coin('hteth')
.wallets()
.get({ id: walletId });
return walletInstance.sendMany({
isTss: true,
recipients: [
{
amount: '0',
address: '0xE514EE5028934565C3f839429Ea3c091EFE4C701',
tokenData: {
tokenContractAddress: '0x252B4F5B517057dB563E14CF7274b4467289feA8',
tokenType: 'ERC721', // Can be ERC20, ERC721, or ERC1155
tokenId: '17',
tokenQuantity: '1',
},
},
],
type: 'transfertoken',
walletPassphrase: 'VerySecurePassword1234',
feeOptions: {
maxFeePerGas: '81130354893',
maxPriorityFeePerGas: '71130354893',
},
nonce: '0',
});
}
Response
// 1. Send NFT Transaction Response (ECDSA)
export type TxRequest = {
txRequestId: string;
walletId: string;
walletType: WalletType;
version: number;
enterpriseId?: string;
state: TxRequestState;
date: string;
userId: string;
intent: unknown;
pendingApprovalId?: string;
policiesChecked: boolean;
signatureShares?: SignatureShareRecord[];
pendingTxHashes?: string[];
txHashes?: string[];
unsignedMessages?: UnsignedMessageTss[];
unsignedTxs: UnsignedTransactionTss[];
transactions?: {
state: TransactionState;
unsignedTx: UnsignedTransactionTss;
signatureShares: SignatureShareRecord[];
}[];
messages?: {
state: TransactionState;
signatureShares: SignatureShareRecord[];
combineSigShare?: string;
txHash?: string;
}[];
apiVersion?: TxRequestVersion;
latest: boolean;
};
// 1. Send NFT Transaction Response (Non-ECDSA)
{
sendQueue?: SendQueueDocument;
status: string;
transfer?: TransferDocument;
transfers?: TransferDocument[];
tx?: string;
txid?: string;
}
{ txRequestId: '<uuid>' }
{
sendQueue?: SendQueueDocument;
status: string;
transfer?: TransferDocument;
transfers?: TransferDocument[];
tx?: string;
txid?: string;
}