@@ -6,20 +6,18 @@ const PAS_UNITS = 10_000_000_000;
66// Not needed if using Polkadot.
77const PASEO_AH_RPC = 'wss://asset-hub-paseo.dotters.network' ;
88
9- teleport ( ) ;
10-
11- async function teleport ( ) {
9+ async function batchTeleport ( ) {
1210 const senderAddress = '15whavTNSyceP8SL3Z1JukFcUPzmeR26RxKXkfQiPhsykg7s' ;
1311 const recipientAddress = '14E5nqKAp3oAJcmzgZhUD2RcptBeUBScxKHgJKU4HPNcKVf3' ;
1412
15- // Check if dry run is supported on Polkadot Asset Hub
13+ // Check if dry run is supported on Polkadot Asset Hub.
1614 const supportsDryRun = hasDryRunSupport ( 'AssetHubPolkadot' ) ;
1715 console . log ( `AssetHubPolkadot supports dry run: ${ supportsDryRun } ` ) ;
1816
1917 if ( supportsDryRun ) {
2018 console . log ( 'Running dry run for first transaction...' ) ;
2119
22- // Dry run the first transaction
20+ // Dry run the first transaction.
2321 try {
2422 const dryRunResult1 = await Builder ( [ PASEO_AH_RPC ] )
2523 . from ( 'AssetHubPolkadot' )
@@ -32,7 +30,7 @@ async function teleport() {
3230
3331 console . log ( 'Dry run result 1:' , dryRunResult1 ) ;
3432
35- // Dry run the second transaction
33+ // Dry run the second transaction.
3634 console . log ( 'Running dry run for second transaction...' ) ;
3735 const dryRunResult2 = await Builder ( [ PASEO_AH_RPC ] )
3836 . from ( 'AssetHubPolkadot' )
@@ -45,7 +43,7 @@ async function teleport() {
4543
4644 console . log ( 'Dry run result 2:' , dryRunResult2 ) ;
4745
48- // Log if both dry runs were successful before proceeding
46+ // Log if both dry runs were successful before proceeding.
4947 console . log ( 'Dry run results:' ) ;
5048 console . log ( 'Transaction 1:' ) ;
5149 console . dir ( dryRunResult1 , { depth : null } ) ;
@@ -55,13 +53,13 @@ async function teleport() {
5553
5654 } catch ( error ) {
5755 console . error ( 'Dry run failed:' , error ) ;
58- return ; // Exit early if dry run throws an error
56+ return ; // Exit early if dry run throws an error.
5957 }
6058 } else {
6159 console . log ( 'Dry run not supported, proceeding directly to batch transaction...' ) ;
6260 }
6361
64- // Original batch transaction code
62+ // Original batch transaction code.
6563 const builder = Builder ( [ PASEO_AH_RPC ] )
6664 . from ( 'AssetHubPolkadot' )
6765 . to ( 'Polkadot' )
@@ -78,7 +76,7 @@ async function teleport() {
7876 . addToBatch ( ) ;
7977
8078 const tx = await builder . buildBatch ( {
81- // This settings object is optional and batch all is the default option
79+ // This settings object is optional and batch all is the default option.
8280 mode : BatchMode . BATCH_ALL //or BatchMode.BATCH
8381 } ) ;
8482
@@ -89,4 +87,6 @@ async function teleport() {
8987 console . log ( `Send via PAPI console:
9088 https://dev.papi.how/extrinsics#networkId=paseo_asset_hub&endpoint=light-client&data=${ callData . asHex ( ) }
9189 ` ) ;
92- }
90+ }
91+
92+ batchTeleport ( ) ;
0 commit comments