How to use scalecodec - 10 common examples

To help you get started, we’ve selected a few scalecodec 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 polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_system_fill_block_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'System',
            'call_function': 'fill_block',
            'call_args': {

            }
        })

        self.assertEqual(str(payload), "0x0c040000")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_democracy_resign_proxy_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Democracy',
            'call_function': 'resign_proxy',
            'call_args': {

            }
        })

        self.assertEqual(str(payload), "0x0c040d0d")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_registrar_set_thread_count_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Registrar',
            'call_function': 'set_thread_count',
            'call_args': {
                'count': 1000
            }
        })

        self.assertEqual(str(payload), "0x1c041702e8030000")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_staking_withdraw_unbonded_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Staking',
            'call_function': 'withdraw_unbonded',
            'call_args': {

            }
        })

        self.assertEqual(str(payload), "0x0c040603")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_identity_set_identity_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Identity',
            'call_function': 'set_identity',
            'call_args': {
                'info': {
                    "additional": [],
                    "display": {"Raw": "Test1"},
                    "legal": {"Raw": "Test2"},
                    "web": {"None": None},
                    "riot": {"Raw": "Test3"},
                    "email": {"None": None},
                    "pgpFingerprint": None,
                    "image": {"None": None},
                    "twitter": {"None": None}
                }
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_identity_provide_judgement_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Identity',
            'call_function': 'provide_judgement',
            'call_args': {
                'judgement': {"KnownGood": None},
                'reg_index': 1,
                'target': '0x586cb27c291c813ce74e86a60dad270609abf2fc8bee107e44a80ac00225c409'
            }
        })

        self.assertEqual(str(payload),
                         "0x9804190904ff586cb27c291c813ce74e86a60dad270609abf2fc8bee107e44a80ac00225c40903")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_democracy_delegate_withconviction_ss58_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Democracy',
            'call_function': 'delegate',
            'call_args': {
                'conviction': 'Locked5x',
                'to': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk'
            }
        })

        self.assertEqual(str(payload), "0x90040d0f586cb27c291c813ce74e86a60dad270609abf2fc8bee107e44a80ac00225c40905")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_slots_set_offboarding_ss58_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Slots',
            'call_function': 'set_offboarding',
            'call_args': {
                'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk'
            }
        })

        self.assertEqual(str(payload), "0x90041603ff586cb27c291c813ce74e86a60dad270609abf2fc8bee107e44a80ac00225c409")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_identity_provide_judgement_ss58_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Identity',
            'call_function': 'provide_judgement',
            'call_args': {
                'judgement': {"KnownGood": None},
                'reg_index': 1,
                'target': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk'
            }
        })

        self.assertEqual(str(payload),
                         "0x9804190904ff586cb27c291c813ce74e86a60dad270609abf2fc8bee107e44a80ac00225c40903")
github polkascan / py-scale-codec / test / test_extrinsic_payload.py View on Github external
def test_encode_claims_mint_claim_withvesting_payload(self):
        extrinsic = ExtrinsicsDecoder(metadata=self.metadata_decoder)

        payload = extrinsic.encode({
            'call_module': 'Claims',
            'call_function': 'mint_claim',
            'call_args': {
                'value': 1000000000000,
                'vesting_schedule': [2000000000000, 3000000000000, 1000000],
                'who': '0x0123456789012345678901234567890123456789'
            }
        })

        self.assertEqual(str(payload),
                         "0x310104130101234567890123456789012345678901234567890010a5d4e800000000000000000000000100204aa9d101000000000000000000000030ef7dba020000000000000000000040420f00")