@@ -1012,16 +1012,14 @@ def test_from_xdr_with_soroban_tx(self):
1012
1012
@pytest .mark .integration
1013
1013
def test_append_payment_to_contract_op_with_native_asset (self ):
1014
1014
asset = Asset .native ()
1015
- amount1 = "100.125"
1016
- amount2 = "120.7891"
1017
- destination = asset .contract_id (
1018
- integration_utils .NETWORK_PASSPHRASE
1019
- ) # we use it as the destination, do need to create a new contract
1020
-
1021
1015
kp = Keypair .random ()
1022
1016
integration_utils .fund_account (kp .public_key )
1023
1017
integration_utils .create_asset_contract (asset , kp )
1024
1018
server = Server (horizon_url = integration_utils .HORIZON_URL )
1019
+ amount1 = "100.125"
1020
+ amount2 = "120.7891"
1021
+ destination = integration_utils .get_random_contract_id (kp )
1022
+
1025
1023
source = server .load_account (kp .public_key )
1026
1024
tx1 = (
1027
1025
TransactionBuilder (
@@ -1085,14 +1083,13 @@ def test_append_payment_to_contract_op_with_alphanum4_asset(self):
1085
1083
asset = Asset ("CAT" , issuer_kp .public_key )
1086
1084
amount1 = "100.125"
1087
1085
amount2 = "120.7891"
1088
- destination = asset .contract_id (
1089
- integration_utils .NETWORK_PASSPHRASE
1090
- ) # we use it as the destination, do need to create a new contract
1091
1086
1092
1087
integration_utils .fund_account (issuer_kp .public_key )
1093
1088
integration_utils .fund_account (kp .public_key )
1094
1089
integration_utils .issue_asset (asset .code , issuer_kp , kp , "1000" )
1095
1090
integration_utils .create_asset_contract (asset , kp )
1091
+ destination = integration_utils .get_random_contract_id (kp )
1092
+
1096
1093
server = Server (horizon_url = integration_utils .HORIZON_URL )
1097
1094
source = server .load_account (kp .public_key )
1098
1095
tx1 = (
@@ -1156,14 +1153,12 @@ def test_append_payment_to_contract_op_with_alphanum12_asset(self):
1156
1153
asset = Asset ("BANANA" , issuer_kp .public_key )
1157
1154
amount1 = "100.125"
1158
1155
amount2 = "120.7891"
1159
- destination = asset .contract_id (
1160
- integration_utils .NETWORK_PASSPHRASE
1161
- ) # we use it as the destination, do need to create a new contract
1162
1156
1163
1157
integration_utils .fund_account (issuer_kp .public_key )
1164
1158
integration_utils .fund_account (kp .public_key )
1165
1159
integration_utils .issue_asset (asset .code , issuer_kp , kp , "1000" )
1166
1160
integration_utils .create_asset_contract (asset , kp )
1161
+ destination = integration_utils .get_random_contract_id (kp )
1167
1162
server = Server (horizon_url = integration_utils .HORIZON_URL )
1168
1163
source = server .load_account (kp .public_key )
1169
1164
tx1 = (
@@ -1219,6 +1214,83 @@ def test_append_payment_to_contract_op_with_alphanum12_asset(self):
1219
1214
1220
1215
server .close ()
1221
1216
1217
+ @pytest .mark .integration
1218
+ def test_append_payment_to_contract_op_with_different_op_source (self ):
1219
+ asset = Asset .native ()
1220
+ kp = Keypair .random ()
1221
+ op_kp = Keypair .random ()
1222
+ integration_utils .fund_account (kp .public_key )
1223
+ integration_utils .fund_account (op_kp .public_key )
1224
+ integration_utils .create_asset_contract (asset , kp )
1225
+ server = Server (horizon_url = integration_utils .HORIZON_URL )
1226
+ amount1 = "100.125"
1227
+ amount2 = "120.7891"
1228
+ destination = integration_utils .get_random_contract_id (kp )
1229
+
1230
+ source = server .load_account (kp .public_key )
1231
+ tx1 = (
1232
+ TransactionBuilder (
1233
+ source_account = source ,
1234
+ network_passphrase = integration_utils .NETWORK_PASSPHRASE ,
1235
+ base_fee = 100 ,
1236
+ )
1237
+ .append_payment_to_contract_op (
1238
+ destination , asset , amount1 , source = op_kp .public_key
1239
+ )
1240
+ .set_timeout (30 )
1241
+ .build ()
1242
+ )
1243
+ tx1 .sign (kp )
1244
+ tx1 .sign (op_kp )
1245
+ server .submit_transaction (tx1 )
1246
+ assert (
1247
+ integration_utils .get_balance_for_contract (
1248
+ destination , asset , kp .public_key
1249
+ )
1250
+ == 1001250000
1251
+ )
1252
+
1253
+ tx2 = (
1254
+ TransactionBuilder (
1255
+ source_account = source ,
1256
+ network_passphrase = integration_utils .NETWORK_PASSPHRASE ,
1257
+ base_fee = 100 ,
1258
+ )
1259
+ .append_payment_to_contract_op (
1260
+ destination , asset , amount2 , source = op_kp .public_key
1261
+ )
1262
+ .set_timeout (30 )
1263
+ .build ()
1264
+ )
1265
+ tx2 .sign (kp )
1266
+ tx2 .sign (op_kp )
1267
+ server .submit_transaction (tx2 )
1268
+ assert (
1269
+ integration_utils .get_balance_for_contract (
1270
+ destination , asset , kp .public_key
1271
+ )
1272
+ == 2209141000
1273
+ )
1274
+
1275
+ # In the e2e environment, it has not expired, but we still try to call it.
1276
+ tx3 = (
1277
+ TransactionBuilder (
1278
+ source_account = source ,
1279
+ network_passphrase = integration_utils .NETWORK_PASSPHRASE ,
1280
+ base_fee = 100 ,
1281
+ )
1282
+ .append_restore_asset_balance_entry_op (
1283
+ destination , asset , source = op_kp .public_key
1284
+ )
1285
+ .set_timeout (30 )
1286
+ .build ()
1287
+ )
1288
+ tx3 .sign (kp )
1289
+ tx3 .sign (op_kp )
1290
+ server .submit_transaction (tx3 )
1291
+
1292
+ server .close ()
1293
+
1222
1294
def test_append_payment_to_stellar_address_raise (self ):
1223
1295
kp = Keypair .random ()
1224
1296
asset = Asset .native ()
0 commit comments