How to use the iconservice.utils.msgpack_for_db.MsgPackForDB.dumps function in iconservice

To help you get started, we’ve selected a few iconservice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github icon-project / icon-service / iconservice / iiss / storage.py View on Github external
def to_bytes(self):
        data: list = [
            self._VERSION,
            self.reward_prep
        ]
        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / prep / data / prep.py View on Github external
self._irep,
            self._irep_block_height,
            self._last_generate_block_height,
            self._block_height,
            self._tx_index,
            self._total_blocks,
            self._validated_blocks,
        ]

        if version >= 1:
            data.extend((self.penalty.value, self._unvalidated_sequence_blocks))

        if version >= 2:
            data.append(self._node_address)

        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / rollback / metadata.py View on Github external
def to_bytes(self) -> bytes:
        data = [
            self._VERSION,
            self._block_height,
            self._block_hash,
            self._term_start_block_height,
            self._last_block.to_bytes(Revision.IISS.value)
        ]

        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / icx / delegation_part.py View on Github external
def to_bytes(self) -> bytes:
        """Convert Account of Stake object to bytes

        :return: data including information of AccountOfDelegation object
        """

        data = [self._VERSION, self.delegated_amount]
        delegations: list = []
        for address, value in self._delegations:
            delegations.append(address)
            delegations.append(value)
        data.append(delegations)

        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / prep / candidate.py View on Github external
:return: data including information of PrepCandidate object
        """

        data = [
            self._VERSION,
            self.name,
            self.email,
            self.website,
            self.json,
            self.ip,
            self.block_height,
            self.tx_index,
            self.gv.encode()
        ]
        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / icx / stake_part.py View on Github external
def to_bytes(self) -> bytes:
        """Convert Account of Stake object to bytes

        :return: data including information of StakePart object
        """

        assert self.is_set(BasePartState.COMPLETE)

        data = [self._VERSION, self._stake, self._unstake, self._unstake_block_height]
        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / iiss / storage.py View on Github external
def to_bytes(self):
        data: list = [
            self._VERSION,
            self.reward_min,
            self.reward_max,
            self.reward_point,
            self.lock_min,
            self.lock_max
        ]
        return MsgPackForDB.dumps(data)
github icon-project / icon-service / iconservice / iiss / reward_calc / storage.py View on Github external
def _put_version_and_revision(self, revision: int):
        version: int = get_rc_version(revision)
        version_and_revision: bytes = MsgPackForDB.dumps([version, revision])
        self._db.put(self.KEY_FOR_VERSION_AND_REVISION, version_and_revision)