i want to know which address is optional because i have define main wallet address many time. this is working example. i want to short this method if possible.This method is long and i have doubt that i added unnecessary code or method into this. so anyone know that what is unnecessary code here that i have to remove or how we can short this method?
const forwardPayload = beginCell().
storeUint(0, 32).
storeStringTail("UNSTAKED").
endCell();
const transferNftBody = beginCell().
storeUint(0x5fcc3d14, 32). // Opcode for NFT transfer
storeUint(0, 64). // query_id
storeAddress(Address.parse(toAddress)). // new_owner
storeAddress(walletAddress). // response_destination for excesses
storeBit(0). // we do not have custom_payload
storeCoins(toNano("0.01")). // forward_amount
storeBit(1). // we store forward_payload as a reference
storeRef(forwardPayload). // store forward_payload as a reference
endCell();
const internalMessage = beginCell().
storeUint(0x18, 6). // bounce
storeAddress(Address.parse(nftAddress)).
storeCoins(toNano("0.05")).
storeUint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1). // We store 1 that means we have body as a reference
storeRef(transferNftBody).
endCell();
let toSign = beginCell().
storeUint(698983191, 32). // subwallet_id | We consider this further
storeUint(Math.floor(Date.now() / 1e3) + 60, 32). // Transaction expiration time, +60 = 1 minute
storeUint(seqno, 32). // store seqno
storeUint(0, 8).
storeUint(3, 8). // store mode of our internal transaction
storeRef(internalMessage); // store our internalMessage as a reference
let signature = sign(toSign.endCell().hash(), keyPair.secretKey); // get the hash of our message to wallet smart contract and sign it to get signature
let body = beginCell().
storeBuffer(signature). // store signature
storeBuilder(toSign). // store our message
endCell();
let externalMessage = beginCell().
storeUint(0b10, 2). // ext_in_msg_info$10
storeUint(0, 2). // src -> addr_none
storeAddress(walletAddress). // Destination address
storeCoins(0). // Import Fee
storeBit(0). // No State Init
storeBit(1). // We store Message Body as a reference
storeRef(body). // Store Message Body as a reference
endCell();
const result = client.sendFile(externalMessage.toBoc());
i want to know which address is optional because i have define main wallet address many time. this is working example. i want to short this method if possible.This method is long and i have doubt that i added unnecessary code or method into this. so anyone know that what is unnecessary code here that i have to remove or how we can short this method?
walletAddress : main owner wallet addresstoAddress : destination address (transfer to)nftAddress : NFT address
Using : react js and node js
Answer
No answer found
Original