• 0 Голоса
    1 Сообщения
    63 Просмотры

    я хочу знать, какой адрес является необязательным, потому что я много раз определял адрес основного кошелька. это рабочий пример. я хочу сократить этот метод, если это возможно. Этот метод длинный, и я сомневаюсь, что я добавил в него ненужный код или метод. итак, кто-нибудь знает, что здесь за ненужный код, который я должен удалить, или как мы можем сократить этот метод?

    Адрес кошелька: адрес кошелька основного владельца toAddress : адрес назначения (для перевода) nftAddress : адрес NFT

    Использование : react js и node js

    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());

    Оригинал вопроса