Skip to content

Commit 5daaaa0

Browse files
authored
Remove use of deprecated calls (#375)
1 parent 43fcc8e commit 5daaaa0

12 files changed

+29
-23
lines changed

Diff for: docs/examples.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keypair = Keypair.create_from_uri('//Alice')
1212

1313
balance_call = substrate.compose_call(
1414
call_module='Balances',
15-
call_function='transfer',
15+
call_function='transfer_keep_alive',
1616
call_params={
1717
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
1818
'value': 1 * 10**15
@@ -73,7 +73,7 @@ keypair = Keypair.create_from_uri('//Alice')
7373

7474
call = substrate.compose_call(
7575
call_module='Balances',
76-
call_function='transfer',
76+
call_function='transfer_keep_alive',
7777
call_params={
7878
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
7979
'value': 1 * 10**15
@@ -124,7 +124,7 @@ multisig_account = substrate.generate_multisig_account(
124124

125125
call = substrate.compose_call(
126126
call_module='Balances',
127-
call_function='transfer',
127+
call_function='transfer_keep_alive',
128128
call_params={
129129
'dest': keypair_alice.ss58_address,
130130
'value': 3 * 10 ** 3

Diff for: docs/getting-started/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ print(result.value['data']['free']) # 635278638077956496
2525
```python
2626
call = substrate.compose_call(
2727
call_module='Balances',
28-
call_function='transfer',
28+
call_function='transfer_keep_alive',
2929
call_params={
3030
'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
3131
'value': 1 * 10**12

Diff for: docs/usage/extrinsics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _Example:_
1313
```python
1414
call = substrate.compose_call(
1515
call_module='Balances',
16-
call_function='transfer',
16+
call_function='transfer_keep_alive',
1717
call_params={
1818
'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
1919
'value': 1 * 10**12

Diff for: docs/usage/keypair-creation-and-signing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ substrate = SubstrateInterface(
8383

8484
call = substrate.compose_call(
8585
call_module='Balances',
86-
call_function='transfer',
86+
call_function='transfer_keep_alive',
8787
call_params={
8888
'dest': '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
8989
'value': 2 * 10**8

Diff for: examples/balance_transfer.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,23 @@
2424
url="ws://127.0.0.1:9944"
2525
)
2626

27+
substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
28+
keypair_alice = Keypair.create_from_uri('//Alice', ss58_format=substrate.ss58_format)
29+
print(keypair_alice.ss58_address)
30+
2731
keypair = Keypair.create_from_uri('//Alice')
2832

2933
call = substrate.compose_call(
3034
call_module='Balances',
31-
call_function='transfer',
35+
call_function='transfer_keep_alive',
3236
call_params={
3337
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
3438
'value': 1 * 10**15
3539
}
3640
)
3741

42+
print(call.data.to_hex())
43+
3844
extrinsic = substrate.create_signed_extrinsic(
3945
call=call,
4046
keypair=keypair,

Diff for: examples/batch_call.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
balance_call = substrate.compose_call(
3030
call_module='Balances',
31-
call_function='transfer',
31+
call_function='transfer_keep_alive',
3232
call_params={
3333
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
3434
'value': 1 * 10**15

Diff for: examples/fee_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
call = substrate.compose_call(
3131
call_module='Balances',
32-
call_function='transfer',
32+
call_function='transfer_keep_alive',
3333
call_params={
3434
'dest': '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
3535
'value': 1 * 10**15

Diff for: examples/multisig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
call = substrate.compose_call(
3939
call_module='Balances',
40-
call_function='transfer',
40+
call_function='transfer_keep_alive',
4141
call_params={
4242
'dest': keypair_alice.ss58_address,
4343
'value': 3 * 10 ** 3

Diff for: test/test_create_extrinsics.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_create_extrinsic_metadata_v14(self):
5353
# Create balance transfer call
5454
call = self.kusama_substrate.compose_call(
5555
call_module='Balances',
56-
call_function='transfer',
56+
call_function='transfer_keep_alive',
5757
call_params={
5858
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
5959
'value': 3 * 10 ** 3
@@ -66,7 +66,7 @@ def test_create_extrinsic_metadata_v14(self):
6666
decoded_extrinsic.decode(extrinsic.data)
6767

6868
self.assertEqual(decoded_extrinsic['call']['call_module'].name, 'Balances')
69-
self.assertEqual(decoded_extrinsic['call']['call_function'].name, 'transfer')
69+
self.assertEqual(decoded_extrinsic['call']['call_function'].name, 'transfer_keep_alive')
7070
self.assertEqual(extrinsic['nonce'], 0)
7171
self.assertEqual(extrinsic['tip'], 1)
7272

@@ -77,7 +77,7 @@ def test_create_mortal_extrinsic(self):
7777
# Create balance transfer call
7878
call = substrate.compose_call(
7979
call_module='Balances',
80-
call_function='transfer',
80+
call_function='transfer_keep_alive',
8181
call_params={
8282
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
8383
'value': 3 * 10 ** 3
@@ -99,7 +99,7 @@ def test_create_batch_extrinsic(self):
9999

100100
balance_call = self.polkadot_substrate.compose_call(
101101
call_module='Balances',
102-
call_function='transfer',
102+
call_function='transfer_keep_alive',
103103
call_params={
104104
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
105105
'value': 3 * 10 ** 3
@@ -126,7 +126,7 @@ def test_create_multisig_extrinsic(self):
126126

127127
call = self.kusama_substrate.compose_call(
128128
call_module='Balances',
129-
call_function='transfer',
129+
call_function='transfer_keep_alive',
130130
call_params={
131131
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
132132
'value': 3 * 10 ** 3
@@ -172,7 +172,7 @@ def test_payment_info(self):
172172

173173
call = self.kusama_substrate.compose_call(
174174
call_module='Balances',
175-
call_function='transfer',
175+
call_function='transfer_keep_alive',
176176
call_params={
177177
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
178178
'value': 2000
@@ -218,7 +218,7 @@ def test_create_extrinsic_bytes_signature(self):
218218
# Create balance transfer call
219219
call = self.kusama_substrate.compose_call(
220220
call_module='Balances',
221-
call_function='transfer',
221+
call_function='transfer_keep_alive',
222222
call_params={
223223
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
224224
'value': 3 * 10 ** 3

Diff for: test/test_query.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def test_system_account(self):
4444
module='System',
4545
storage_function='Account',
4646
params=['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'],
47-
block_hash='0x176e064454388fd78941a0bace38db424e71db9d5d5ed0272ead7003a02234fa'
47+
block_hash='0xbf787e2f322080e137ed53e763b1cc97d5c5585be1f736914e27d68ac97f5f2c'
4848
)
4949

50-
self.assertEqual(7673, result.value['nonce'])
51-
self.assertEqual(637747267365404068, result.value['data']['free'])
50+
self.assertEqual(67501, result.value['nonce'])
51+
self.assertEqual(1099945000512, result.value['data']['free'])
5252
self.assertEqual(result.meta_info['result_found'], True)
5353

5454
def test_system_account_non_existing(self):

Diff for: test/test_runtime_call.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_core_version_at_not_best_block(self):
5151
def test_transaction_payment(self):
5252
call = self.substrate.compose_call(
5353
call_module='Balances',
54-
call_function='transfer',
54+
call_function='transfer_keep_alive',
5555
call_params={
5656
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
5757
'value': 3 * 10 ** 3

Diff for: test/test_type_registry.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def test_default_substrate_address(self):
196196

197197
call = substrate.compose_call(
198198
call_module='Balances',
199-
call_function='transfer',
199+
call_function='transfer_keep_alive',
200200
call_params={
201201
'dest': keypair_alice.ss58_address,
202202
'value': 2000
@@ -216,7 +216,7 @@ def test_eth_address(self):
216216

217217
call = substrate.compose_call(
218218
call_module='Balances',
219-
call_function='transfer',
219+
call_function='transfer_keep_alive',
220220
call_params={
221221
'dest': keypair_alice.ss58_address,
222222
'value': 2000

0 commit comments

Comments
 (0)