Skip to content

Commit

Permalink
Remove use of deprecated calls (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanz authored Jan 25, 2024
1 parent 43fcc8e commit 5daaaa0
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keypair = Keypair.create_from_uri('//Alice')

balance_call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
'value': 1 * 10**15
Expand Down Expand Up @@ -73,7 +73,7 @@ keypair = Keypair.create_from_uri('//Alice')

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
'value': 1 * 10**15
Expand Down Expand Up @@ -124,7 +124,7 @@ multisig_account = substrate.generate_multisig_account(

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': keypair_alice.ss58_address,
'value': 3 * 10 ** 3
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ print(result.value['data']['free']) # 635278638077956496
```python
call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
'value': 1 * 10**12
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/extrinsics.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ _Example:_
```python
call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
'value': 1 * 10**12
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/keypair-creation-and-signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ substrate = SubstrateInterface(

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
'value': 2 * 10**8
Expand Down
8 changes: 7 additions & 1 deletion examples/balance_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@
url="ws://127.0.0.1:9944"
)

substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
keypair_alice = Keypair.create_from_uri('//Alice', ss58_format=substrate.ss58_format)
print(keypair_alice.ss58_address)

keypair = Keypair.create_from_uri('//Alice')

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
'value': 1 * 10**15
}
)

print(call.data.to_hex())

extrinsic = substrate.create_signed_extrinsic(
call=call,
keypair=keypair,
Expand Down
2 changes: 1 addition & 1 deletion examples/batch_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

balance_call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
'value': 1 * 10**15
Expand Down
2 changes: 1 addition & 1 deletion examples/fee_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
'value': 1 * 10**15
Expand Down
2 changes: 1 addition & 1 deletion examples/multisig.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': keypair_alice.ss58_address,
'value': 3 * 10 ** 3
Expand Down
14 changes: 7 additions & 7 deletions test/test_create_extrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_create_extrinsic_metadata_v14(self):
# Create balance transfer call
call = self.kusama_substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 3 * 10 ** 3
Expand All @@ -66,7 +66,7 @@ def test_create_extrinsic_metadata_v14(self):
decoded_extrinsic.decode(extrinsic.data)

self.assertEqual(decoded_extrinsic['call']['call_module'].name, 'Balances')
self.assertEqual(decoded_extrinsic['call']['call_function'].name, 'transfer')
self.assertEqual(decoded_extrinsic['call']['call_function'].name, 'transfer_keep_alive')
self.assertEqual(extrinsic['nonce'], 0)
self.assertEqual(extrinsic['tip'], 1)

Expand All @@ -77,7 +77,7 @@ def test_create_mortal_extrinsic(self):
# Create balance transfer call
call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 3 * 10 ** 3
Expand All @@ -99,7 +99,7 @@ def test_create_batch_extrinsic(self):

balance_call = self.polkadot_substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 3 * 10 ** 3
Expand All @@ -126,7 +126,7 @@ def test_create_multisig_extrinsic(self):

call = self.kusama_substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 3 * 10 ** 3
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_payment_info(self):

call = self.kusama_substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 2000
Expand Down Expand Up @@ -218,7 +218,7 @@ def test_create_extrinsic_bytes_signature(self):
# Create balance transfer call
call = self.kusama_substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 3 * 10 ** 3
Expand Down
6 changes: 3 additions & 3 deletions test/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def test_system_account(self):
module='System',
storage_function='Account',
params=['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'],
block_hash='0x176e064454388fd78941a0bace38db424e71db9d5d5ed0272ead7003a02234fa'
block_hash='0xbf787e2f322080e137ed53e763b1cc97d5c5585be1f736914e27d68ac97f5f2c'
)

self.assertEqual(7673, result.value['nonce'])
self.assertEqual(637747267365404068, result.value['data']['free'])
self.assertEqual(67501, result.value['nonce'])
self.assertEqual(1099945000512, result.value['data']['free'])
self.assertEqual(result.meta_info['result_found'], True)

def test_system_account_non_existing(self):
Expand Down
2 changes: 1 addition & 1 deletion test/test_runtime_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_core_version_at_not_best_block(self):
def test_transaction_payment(self):
call = self.substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
'value': 3 * 10 ** 3
Expand Down
4 changes: 2 additions & 2 deletions test/test_type_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_default_substrate_address(self):

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': keypair_alice.ss58_address,
'value': 2000
Expand All @@ -216,7 +216,7 @@ def test_eth_address(self):

call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_function='transfer_keep_alive',
call_params={
'dest': keypair_alice.ss58_address,
'value': 2000
Expand Down

0 comments on commit 5daaaa0

Please sign in to comment.